Hello community, here is the log from the commit of package python-polib for openSUSE:Factory checked in at 2017-05-06 18:27:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-polib (Old) and /work/SRC/openSUSE:Factory/.python-polib.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-polib" Sat May 6 18:27:28 2017 rev:19 rq:490075 version:1.0.8 Changes: -------- --- /work/SRC/openSUSE:Factory/python-polib/python-polib.changes 2015-05-16 07:14:48.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-polib.new/python-polib.changes 2017-05-06 18:27:30.501371441 +0200 @@ -1,0 +2,20 @@ +Sun Apr 23 20:18:09 UTC 2017 - [email protected] + +- Update to version 1.0.8 + * Fixed issue #70 (occurrences parsing for windows pathes) + * Fixed issue #71 (tcomment and flags not saved for obsolete entries) + * Fixed issue #72 (wrong metadata ordering) + * Fixed issue #73 (can't always unpickle POFile) + * Use natural sorting for additional headers (metadata) + * Fixed typos in various documents +- Update to version 1.0.7 + * Fixed bad parsing of indented msgstr_plural + * Fixed ordering of "Language" metadata entry + * Removed space after "#" in header if comment line is empty (like gettext tools) + * Fixed typos / grammar errors (thanks Jakub Wilk) + * Take into account msgid_plural if needed when comparing entries (thanks Leonardo Constantino Oliveira) + * Fixed issue #63 (str() on a bytes instance when using python3) (thanks Jakub Wilk) +- Implement single-spec version +- Fix source url. + +------------------------------------------------------------------- Old: ---- polib-1.0.6.tar.gz New: ---- polib-1.0.8.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-polib.spec ++++++ --- /var/tmp/diff_new_pack.d7eCJl/_old 2017-05-06 18:27:31.721199317 +0200 +++ /var/tmp/diff_new_pack.d7eCJl/_new 2017-05-06 18:27:31.725198752 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-polib # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2013 LISA GmbH, Bingen, Germany. # # All modifications and additions to the file contributed by third parties @@ -17,22 +17,25 @@ # +%bcond_without tests + +%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-polib -Version: 1.0.6 +Version: 1.0.8 Release: 0 Url: http://bitbucket.org/izi/polib/ Summary: A library to manipulate gettext files License: MIT Group: Development/Languages/Python -Source0: https://pypi.python.org/packages/source/p/polib/polib-%{version}.tar.gz +Source0: https://files.pythonhosted.org/packages/source/p/polib/polib-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: python-Sphinx -BuildRequires: python-devel -%if 0%{?suse_version} && 0%{?suse_version} <= 1110 -%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%else +BuildRequires: fdupes +BuildRequires: python-rpm-macros +BuildRequires: %{python_module devel} +BuildRequires: %{python_module setuptools} +BuildRequires: python3-Sphinx BuildArch: noarch -%endif +%python_subpackages %description polib allows you to manipulate, create, modify gettext catalogs (.pot, .po and @@ -44,12 +47,12 @@ functions 'pofile' and 'mofile', and the 4 core classes: POFile, MOFile, POEntry and MOEntry for creating new files/entries. -%package doc -Summary: A library to manipulate gettext files +%package -n python-polib-doc +Summary: A library to manipulate gettext files - documentation Group: Documentation/Other -Requires: %{name} = %{version} +Provides: %{python_module polib-doc = %{version}} -%description doc +%description -n python-polib-doc polib allows you to manipulate, create, modify gettext catalogs (.pot, .po and binary .mo files). You can load existing files, iterate through it's entries, add, modify entries, comments or metadata, etc... or create new po/pot files @@ -65,24 +68,28 @@ %setup -q -n polib-%{version} %build -python setup.py build +%python_build + pushd docs make html rm _build/html/.buildinfo popd %install -python setup.py install --prefix=%{_prefix} --root=%{buildroot} +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} +%if %{with tests} %check -./runtests.sh +%python_exec tests/tests.py +%endif -%files +%files %{python_files} %defattr(-,root,root) %doc LICENSE CHANGELOG README.rst %{python_sitelib}/* -%files doc +%files -n python-polib-doc %defattr(-,root,root) %doc docs/_build/html ++++++ polib-1.0.6.tar.gz -> polib-1.0.8.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polib-1.0.6/CHANGELOG new/polib-1.0.8/CHANGELOG --- old/polib-1.0.6/CHANGELOG 2015-01-04 12:28:42.000000000 +0100 +++ new/polib-1.0.8/CHANGELOG 2016-11-21 14:30:52.000000000 +0100 @@ -2,6 +2,24 @@ Changelog ========= +Version 1.0.8 (2016/11/21) +-------------------------- + - Fixed issue #70 (occurrences parsing for windows pathes) + - Fixed issue #71 (tcomment and flags not saved for obsolete entries) + - Fixed issue #72 (wrong metadata ordering) + - Fixed issue #73 (can't always unpickle POFile) + - Use natural sorting for additional headers (metadata) + - Fixed typos in various documents + +Version 1.0.7 (2015/07/08) +-------------------------- + - Fixed bad parsing of indented msgstr_plural + - Fixed ordering of "Language" metadata entry + - Removed space after "#" in header if comment line is empty (like gettext tools) + - Fixed typos / grammar errors (thanks Jakub Wilk) + - Take into account msgid_plural if needed when comparing entries (thanks Leonardo Constantino Oliveira) + - Fixed issue #63 (str() on a bytes instance when using python3) (thanks Jakub Wilk) + Version 1.0.6 (2015/01/04) -------------------------- - Wheel support @@ -12,14 +30,14 @@ -------------------------- - Fixed issue #59: tokens variable referenced before assignment - Implemented feature request #56: line number information in PO entries - - Fixed issue #61: polib does not handle previous msgid on multines properly + - Fixed issue #61: polib does not handle previous msgid on multilines properly Version 1.0.4 (2014/02/19) -------------------------- - Fixed issue #43: improved check that determine if polib is dealing with a filepath or unicode content - Fixed issue #44: polib now checks MO files revision number and throws an error if the number is unexpected - Fixed issue #45: parse properly mo files with no header entry - - Fixed issue #47: added flags attribute for MOEntry to be consistant with POEntry + - Fixed issue #47: added flags attribute for MOEntry to be consistent with POEntry - Fixed issue #49: use integers rather than strings for msgstr_plural keys - Fixed issue #51: if a PO file ends with a comment, polib adds a spurious empty entry at the end - Fixed issue #52: bad magic number written on big endian platforms @@ -27,7 +45,7 @@ - Fixed issue #54: use lowercase for state identifiers. This fixes issues with certain locales and string.lower() - Fixed issue #58: use io.open() instead of codecs.open() because the latter doesn't handle very well universal line endings - Make sure the mo file is closed at garbage collection, this prevents warnings on unclosed file when running tests with python >= 3.2 - - Better way to test indianness + - Better way to test endianness - polib download URL is now on Pypi Version 1.0.3 (2013/02/09) @@ -36,11 +54,11 @@ - Fixed issue #39: Added __init__.py file for convenience - Fixed issue #41: UnicodeDecodeError when running setup.py build on python3 with C locale - polib is now fully PEP8 compliant - - Small improvements: remove unused "typ" var (thanks Rodrigo Silva), mproved Makefile, Make sure _BaseFile.__contains__ returns a boolean value + - Small improvements: remove unused "typ" var (thanks Rodrigo Silva), improved Makefile, Make sure _BaseFile.__contains__ returns a boolean value Version 1.0.2 (2012/10/23) -------------------------- - - allow empty comments, flags or occurences lines + - allow empty comments, flags or occurrences lines Version 1.0.1 (2012/09/11) -------------------------- @@ -64,7 +82,7 @@ Version 0.6.4 (2011/07/13) -------------------------- - - Better api, autodetected_encoding is no longer required to explicitely set the encoding (fixes issue #23), + - Better api, autodetected_encoding is no longer required to explicitly set the encoding (fixes issue #23), - Fixed issue #24 Support indented PO files (thanks to François Poirotte). Version 0.6.3 (2011/02/19) @@ -103,7 +121,7 @@ - correctly unescape lines containing both \\\\n and \\n (thanks to Martin Geisler), - fixed issue #6: __str__() methods are returning unicode instead of str, - fixed issue #8: POFile.merge error when an entry is obsolete in a .po, that this entry reappears in the .pot and that we merge the two, - - added support to instanciate POFile objects using data instead of file path (thanks to Diego Búrigo Zacarão), + - added support to instantiate POFile objects using data instead of file path (thanks to Diego Búrigo Zacarão), - fixed issue #9: POFile.merge drop fuzzy attributes from translations (thanks to Tim Gerundt), - fixed issue #10: Finding entries with the same msgid and different context (msgctxt). @@ -136,13 +154,13 @@ - fixed issue #0015: no LICENSE file included in tarball, - removed Version/Date from README, - added test pot files to MANIFEST.in, - - performance improvment in find() method (thanks Thomas !). + - performance improvement in find() method (thanks Thomas !). Version 0.4.1 (2009/03/04) -------------------------- - fixed issue #0006: plural msgstrs were saved unsorted, - fixed issue #0008: long comment lines broke 'save()' method, - - removed performance shortcuts: they were in fact inefficient, I was misleaded by the python profile module, kudos to Thomas for making me realise that, + - removed performance shortcuts: they were in fact inefficient, I was mislead by the python profile module, kudos to Thomas for making me realise that, - fixed issue #0010: wrong polib version number, - fixed issue #0011: occurrences parsing is now more robust and can handle weird references formats (like in eToys OLPC po files), - fixed issue #0012: improved merge() method. @@ -150,7 +168,7 @@ Version 0.4.0 (2008/11/26) -------------------------- - fixed bug #0005: percent_translated divide by 0 on empty po files, - - fixed bug #0004: occurrences that have hiphens are wrapped when they should not, + - fixed bug #0004: occurrences that have hyphens are wrapped when they should not, - changes in how encoding is handled, - remove deprecation warnings for typo on "occurrences", - added POEntry.__cmp__() method to sort entries like gettext does, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polib-1.0.6/PKG-INFO new/polib-1.0.8/PKG-INFO --- old/polib-1.0.6/PKG-INFO 2015-01-04 12:33:25.000000000 +0100 +++ new/polib-1.0.8/PKG-INFO 2016-11-21 14:32:21.000000000 +0100 @@ -1,30 +1,30 @@ Metadata-Version: 1.1 Name: polib -Version: 1.0.6 +Version: 1.0.8 Summary: A library to manipulate gettext files (po and mo files). Home-page: http://bitbucket.org/izi/polib/ Author: David Jean Louis Author-email: [email protected] License: MIT -Download-URL: https://pypi.python.org/packages/source/p/polib/polib-1.0.6.tar.gz +Download-URL: https://pypi.python.org/packages/source/p/polib/polib-1.0.8.tar.gz Description: ===== polib ===== - .. image:: https://pypip.in/download/polib/badge.png + .. image:: https://img.shields.io/pypi/dm/polib.svg :alt: Downloads - .. image:: https://pypip.in/py_versions/polib/badge.png + .. image:: https://img.shields.io/pypi/pyversions/polib.svg :alt: Supported Python versions - .. image:: https://pypip.in/status/polib/badge.png + .. image:: https://img.shields.io/pypi/status/polib.svg :alt: Development Status - .. image:: https://pypip.in/license/polib/badge.png + .. image:: https://img.shields.io/pypi/l/polib.svg :alt: License @@ -52,6 +52,24 @@ Changelog ========= + Version 1.0.8 (2016/11/21) + -------------------------- + - Fixed issue #70 (occurrences parsing for windows pathes) + - Fixed issue #71 (tcomment and flags not saved for obsolete entries) + - Fixed issue #72 (wrong metadata ordering) + - Fixed issue #73 (can't always unpickle POFile) + - Use natural sorting for additional headers (metadata) + - Fixed typos in various documents + + Version 1.0.7 (2015/07/08) + -------------------------- + - Fixed bad parsing of indented msgstr_plural + - Fixed ordering of "Language" metadata entry + - Removed space after "#" in header if comment line is empty (like gettext tools) + - Fixed typos / grammar errors (thanks Jakub Wilk) + - Take into account msgid_plural if needed when comparing entries (thanks Leonardo Constantino Oliveira) + - Fixed issue #63 (str() on a bytes instance when using python3) (thanks Jakub Wilk) + Version 1.0.6 (2015/01/04) -------------------------- - Wheel support @@ -62,14 +80,14 @@ -------------------------- - Fixed issue #59: tokens variable referenced before assignment - Implemented feature request #56: line number information in PO entries - - Fixed issue #61: polib does not handle previous msgid on multines properly + - Fixed issue #61: polib does not handle previous msgid on multilines properly Version 1.0.4 (2014/02/19) -------------------------- - Fixed issue #43: improved check that determine if polib is dealing with a filepath or unicode content - Fixed issue #44: polib now checks MO files revision number and throws an error if the number is unexpected - Fixed issue #45: parse properly mo files with no header entry - - Fixed issue #47: added flags attribute for MOEntry to be consistant with POEntry + - Fixed issue #47: added flags attribute for MOEntry to be consistent with POEntry - Fixed issue #49: use integers rather than strings for msgstr_plural keys - Fixed issue #51: if a PO file ends with a comment, polib adds a spurious empty entry at the end - Fixed issue #52: bad magic number written on big endian platforms @@ -77,7 +95,7 @@ - Fixed issue #54: use lowercase for state identifiers. This fixes issues with certain locales and string.lower() - Fixed issue #58: use io.open() instead of codecs.open() because the latter doesn't handle very well universal line endings - Make sure the mo file is closed at garbage collection, this prevents warnings on unclosed file when running tests with python >= 3.2 - - Better way to test indianness + - Better way to test endianness - polib download URL is now on Pypi Version 1.0.3 (2013/02/09) @@ -86,11 +104,11 @@ - Fixed issue #39: Added __init__.py file for convenience - Fixed issue #41: UnicodeDecodeError when running setup.py build on python3 with C locale - polib is now fully PEP8 compliant - - Small improvements: remove unused "typ" var (thanks Rodrigo Silva), mproved Makefile, Make sure _BaseFile.__contains__ returns a boolean value + - Small improvements: remove unused "typ" var (thanks Rodrigo Silva), improved Makefile, Make sure _BaseFile.__contains__ returns a boolean value Version 1.0.2 (2012/10/23) -------------------------- - - allow empty comments, flags or occurences lines + - allow empty comments, flags or occurrences lines Version 1.0.1 (2012/09/11) -------------------------- @@ -114,7 +132,7 @@ Version 0.6.4 (2011/07/13) -------------------------- - - Better api, autodetected_encoding is no longer required to explicitely set the encoding (fixes issue #23), + - Better api, autodetected_encoding is no longer required to explicitly set the encoding (fixes issue #23), - Fixed issue #24 Support indented PO files (thanks to François Poirotte). Version 0.6.3 (2011/02/19) @@ -153,7 +171,7 @@ - correctly unescape lines containing both \\\\n and \\n (thanks to Martin Geisler), - fixed issue #6: __str__() methods are returning unicode instead of str, - fixed issue #8: POFile.merge error when an entry is obsolete in a .po, that this entry reappears in the .pot and that we merge the two, - - added support to instanciate POFile objects using data instead of file path (thanks to Diego Búrigo Zacarão), + - added support to instantiate POFile objects using data instead of file path (thanks to Diego Búrigo Zacarão), - fixed issue #9: POFile.merge drop fuzzy attributes from translations (thanks to Tim Gerundt), - fixed issue #10: Finding entries with the same msgid and different context (msgctxt). @@ -186,13 +204,13 @@ - fixed issue #0015: no LICENSE file included in tarball, - removed Version/Date from README, - added test pot files to MANIFEST.in, - - performance improvment in find() method (thanks Thomas !). + - performance improvement in find() method (thanks Thomas !). Version 0.4.1 (2009/03/04) -------------------------- - fixed issue #0006: plural msgstrs were saved unsorted, - fixed issue #0008: long comment lines broke 'save()' method, - - removed performance shortcuts: they were in fact inefficient, I was misleaded by the python profile module, kudos to Thomas for making me realise that, + - removed performance shortcuts: they were in fact inefficient, I was mislead by the python profile module, kudos to Thomas for making me realise that, - fixed issue #0010: wrong polib version number, - fixed issue #0011: occurrences parsing is now more robust and can handle weird references formats (like in eToys OLPC po files), - fixed issue #0012: improved merge() method. @@ -200,7 +218,7 @@ Version 0.4.0 (2008/11/26) -------------------------- - fixed bug #0005: percent_translated divide by 0 on empty po files, - - fixed bug #0004: occurrences that have hiphens are wrapped when they should not, + - fixed bug #0004: occurrences that have hyphens are wrapped when they should not, - changes in how encoding is handled, - remove deprecation warnings for typo on "occurrences", - added POEntry.__cmp__() method to sort entries like gettext does, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polib-1.0.6/README.rst new/polib-1.0.8/README.rst --- old/polib-1.0.6/README.rst 2014-12-05 10:19:35.000000000 +0100 +++ new/polib-1.0.8/README.rst 2016-05-19 11:20:52.000000000 +0200 @@ -2,19 +2,19 @@ polib ===== -.. image:: https://pypip.in/download/polib/badge.png +.. image:: https://img.shields.io/pypi/dm/polib.svg :alt: Downloads -.. image:: https://pypip.in/py_versions/polib/badge.png +.. image:: https://img.shields.io/pypi/pyversions/polib.svg :alt: Supported Python versions -.. image:: https://pypip.in/status/polib/badge.png +.. image:: https://img.shields.io/pypi/status/polib.svg :alt: Development Status -.. image:: https://pypip.in/license/polib/badge.png +.. image:: https://img.shields.io/pypi/l/polib.svg :alt: License diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polib-1.0.6/__init__.py new/polib-1.0.8/__init__.py --- old/polib-1.0.6/__init__.py 2014-12-05 10:19:35.000000000 +0100 +++ new/polib-1.0.8/__init__.py 2016-05-19 11:20:52.000000000 +0200 @@ -2,4 +2,4 @@ # version of polib as a mercurial sub-repository for example. # # This file will NOT be installed when installing polib with pip, setuptools, -# or any other mecanism based on the setup.py file. +# or any other mechanism based on the setup.py file. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polib-1.0.6/docs/projects.rst new/polib-1.0.8/docs/projects.rst --- old/polib-1.0.6/docs/projects.rst 2014-12-05 10:19:35.000000000 +0100 +++ new/polib-1.0.8/docs/projects.rst 2016-05-19 11:20:52.000000000 +0200 @@ -11,7 +11,6 @@ * `Django-rosetta <http://code.google.com/p/django-rosetta/>`_ * `The evergreen library system <http://www.open-ils.org/>`_ * `Qooxdoo <http://qooxdoo.org/>`_ -* `<http://www.linux.rk.edu.pl/tra/list/>`_ * `Lictionary <http://www.lictionary.in/>`_ * `Jasy - Web Tooling Framework <https://github.com/sebastian-software/jasy>`_ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polib-1.0.6/docs/quickstart.rst new/polib-1.0.8/docs/quickstart.rst --- old/polib-1.0.6/docs/quickstart.rst 2014-12-05 10:19:35.000000000 +0100 +++ new/polib-1.0.8/docs/quickstart.rst 2016-05-19 11:20:52.000000000 +0200 @@ -69,7 +69,7 @@ Loading a catalog and specifying explicitly the encoding ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -For some reason you may want to specify the file encoding explicitely (because +For some reason you may want to specify the file encoding explicitly (because the charset is not specified in the po file header for example), to do so:: import polib @@ -88,14 +88,14 @@ mo = polib.mofile('path/to/catalog.mo') print mo -As for po files, mofile also allows to specify the encoding explicitely. +As for po files, mofile also allows specifying the encoding explicitly. Creating po catalogs from scratch --------------------------------- polib allows you to create catalog from scratch, this can be done with the -POFile class, for exemple to create a simple catalog you could do:: +POFile class, for example to create a simple catalog you could do:: import polib diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polib-1.0.6/polib.egg-info/PKG-INFO new/polib-1.0.8/polib.egg-info/PKG-INFO --- old/polib-1.0.6/polib.egg-info/PKG-INFO 2015-01-04 12:33:25.000000000 +0100 +++ new/polib-1.0.8/polib.egg-info/PKG-INFO 2016-11-21 14:32:21.000000000 +0100 @@ -1,30 +1,30 @@ Metadata-Version: 1.1 Name: polib -Version: 1.0.6 +Version: 1.0.8 Summary: A library to manipulate gettext files (po and mo files). Home-page: http://bitbucket.org/izi/polib/ Author: David Jean Louis Author-email: [email protected] License: MIT -Download-URL: https://pypi.python.org/packages/source/p/polib/polib-1.0.6.tar.gz +Download-URL: https://pypi.python.org/packages/source/p/polib/polib-1.0.8.tar.gz Description: ===== polib ===== - .. image:: https://pypip.in/download/polib/badge.png + .. image:: https://img.shields.io/pypi/dm/polib.svg :alt: Downloads - .. image:: https://pypip.in/py_versions/polib/badge.png + .. image:: https://img.shields.io/pypi/pyversions/polib.svg :alt: Supported Python versions - .. image:: https://pypip.in/status/polib/badge.png + .. image:: https://img.shields.io/pypi/status/polib.svg :alt: Development Status - .. image:: https://pypip.in/license/polib/badge.png + .. image:: https://img.shields.io/pypi/l/polib.svg :alt: License @@ -52,6 +52,24 @@ Changelog ========= + Version 1.0.8 (2016/11/21) + -------------------------- + - Fixed issue #70 (occurrences parsing for windows pathes) + - Fixed issue #71 (tcomment and flags not saved for obsolete entries) + - Fixed issue #72 (wrong metadata ordering) + - Fixed issue #73 (can't always unpickle POFile) + - Use natural sorting for additional headers (metadata) + - Fixed typos in various documents + + Version 1.0.7 (2015/07/08) + -------------------------- + - Fixed bad parsing of indented msgstr_plural + - Fixed ordering of "Language" metadata entry + - Removed space after "#" in header if comment line is empty (like gettext tools) + - Fixed typos / grammar errors (thanks Jakub Wilk) + - Take into account msgid_plural if needed when comparing entries (thanks Leonardo Constantino Oliveira) + - Fixed issue #63 (str() on a bytes instance when using python3) (thanks Jakub Wilk) + Version 1.0.6 (2015/01/04) -------------------------- - Wheel support @@ -62,14 +80,14 @@ -------------------------- - Fixed issue #59: tokens variable referenced before assignment - Implemented feature request #56: line number information in PO entries - - Fixed issue #61: polib does not handle previous msgid on multines properly + - Fixed issue #61: polib does not handle previous msgid on multilines properly Version 1.0.4 (2014/02/19) -------------------------- - Fixed issue #43: improved check that determine if polib is dealing with a filepath or unicode content - Fixed issue #44: polib now checks MO files revision number and throws an error if the number is unexpected - Fixed issue #45: parse properly mo files with no header entry - - Fixed issue #47: added flags attribute for MOEntry to be consistant with POEntry + - Fixed issue #47: added flags attribute for MOEntry to be consistent with POEntry - Fixed issue #49: use integers rather than strings for msgstr_plural keys - Fixed issue #51: if a PO file ends with a comment, polib adds a spurious empty entry at the end - Fixed issue #52: bad magic number written on big endian platforms @@ -77,7 +95,7 @@ - Fixed issue #54: use lowercase for state identifiers. This fixes issues with certain locales and string.lower() - Fixed issue #58: use io.open() instead of codecs.open() because the latter doesn't handle very well universal line endings - Make sure the mo file is closed at garbage collection, this prevents warnings on unclosed file when running tests with python >= 3.2 - - Better way to test indianness + - Better way to test endianness - polib download URL is now on Pypi Version 1.0.3 (2013/02/09) @@ -86,11 +104,11 @@ - Fixed issue #39: Added __init__.py file for convenience - Fixed issue #41: UnicodeDecodeError when running setup.py build on python3 with C locale - polib is now fully PEP8 compliant - - Small improvements: remove unused "typ" var (thanks Rodrigo Silva), mproved Makefile, Make sure _BaseFile.__contains__ returns a boolean value + - Small improvements: remove unused "typ" var (thanks Rodrigo Silva), improved Makefile, Make sure _BaseFile.__contains__ returns a boolean value Version 1.0.2 (2012/10/23) -------------------------- - - allow empty comments, flags or occurences lines + - allow empty comments, flags or occurrences lines Version 1.0.1 (2012/09/11) -------------------------- @@ -114,7 +132,7 @@ Version 0.6.4 (2011/07/13) -------------------------- - - Better api, autodetected_encoding is no longer required to explicitely set the encoding (fixes issue #23), + - Better api, autodetected_encoding is no longer required to explicitly set the encoding (fixes issue #23), - Fixed issue #24 Support indented PO files (thanks to François Poirotte). Version 0.6.3 (2011/02/19) @@ -153,7 +171,7 @@ - correctly unescape lines containing both \\\\n and \\n (thanks to Martin Geisler), - fixed issue #6: __str__() methods are returning unicode instead of str, - fixed issue #8: POFile.merge error when an entry is obsolete in a .po, that this entry reappears in the .pot and that we merge the two, - - added support to instanciate POFile objects using data instead of file path (thanks to Diego Búrigo Zacarão), + - added support to instantiate POFile objects using data instead of file path (thanks to Diego Búrigo Zacarão), - fixed issue #9: POFile.merge drop fuzzy attributes from translations (thanks to Tim Gerundt), - fixed issue #10: Finding entries with the same msgid and different context (msgctxt). @@ -186,13 +204,13 @@ - fixed issue #0015: no LICENSE file included in tarball, - removed Version/Date from README, - added test pot files to MANIFEST.in, - - performance improvment in find() method (thanks Thomas !). + - performance improvement in find() method (thanks Thomas !). Version 0.4.1 (2009/03/04) -------------------------- - fixed issue #0006: plural msgstrs were saved unsorted, - fixed issue #0008: long comment lines broke 'save()' method, - - removed performance shortcuts: they were in fact inefficient, I was misleaded by the python profile module, kudos to Thomas for making me realise that, + - removed performance shortcuts: they were in fact inefficient, I was mislead by the python profile module, kudos to Thomas for making me realise that, - fixed issue #0010: wrong polib version number, - fixed issue #0011: occurrences parsing is now more robust and can handle weird references formats (like in eToys OLPC po files), - fixed issue #0012: improved merge() method. @@ -200,7 +218,7 @@ Version 0.4.0 (2008/11/26) -------------------------- - fixed bug #0005: percent_translated divide by 0 on empty po files, - - fixed bug #0004: occurrences that have hiphens are wrapped when they should not, + - fixed bug #0004: occurrences that have hyphens are wrapped when they should not, - changes in how encoding is handled, - remove deprecation warnings for typo on "occurrences", - added POEntry.__cmp__() method to sort entries like gettext does, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polib-1.0.6/polib.py new/polib-1.0.8/polib.py --- old/polib-1.0.6/polib.py 2015-01-04 12:24:23.000000000 +0100 +++ new/polib-1.0.8/polib.py 2016-11-21 14:27:20.000000000 +0100 @@ -13,7 +13,7 @@ """ __author__ = 'David Jean Louis <[email protected]>' -__version__ = '1.0.6' +__version__ = '1.0.8' __all__ = ['pofile', 'POFile', 'POEntry', 'mofile', 'MOFile', 'MOEntry', 'default_encoding', 'escape', 'unescape', 'detect_encoding', ] @@ -262,13 +262,25 @@ return m # handles escaped double quote return re.sub(r'\\(\\|n|t|r|")', unescape_repl, st) # }}} +# function natural_sort() {{{ + + +def natural_sort(lst): + """ + Sort naturally the given list. + Credits: http://stackoverflow.com/a/4836734 + """ + convert = lambda text: int(text) if text.isdigit() else text.lower() + alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ] + return sorted(lst, key = alphanum_key) +# }}} # class _BaseFile {{{ class _BaseFile(list): """ Common base class for the :class:`~polib.POFile` and :class:`~polib.MOFile` - classes. This class should **not** be instanciated directly. + classes. This class should **not** be instantiated directly. """ def __init__(self, *args, **kwargs): @@ -339,7 +351,7 @@ def __contains__(self, entry): """ - Overriden ``list`` method to implement the membership test (in and + Overridden ``list`` method to implement the membership test (in and not in). The method considers that an entry is in the file if it finds an entry that has the same msgid (the test is **case sensitive**) and the same @@ -358,7 +370,7 @@ def append(self, entry): """ - Overriden method to check for duplicates entries, if a user tries to + Overridden method to check for duplicates entries, if a user tries to add an entry that is already in the file, the method will raise a ``ValueError`` exception. @@ -367,13 +379,15 @@ ``entry`` an instance of :class:`~polib._BaseEntry`. """ - if self.check_for_duplicates and entry in self: + # check_for_duplicates may not be defined (yet) when unpickling. + # But if pickling, we never want to check for duplicates anyway. + if getattr(self, 'check_for_duplicates', False) and entry in self: raise ValueError('Entry "%s" already exists' % entry.msgid) super(_BaseFile, self).append(entry) def insert(self, index, entry): """ - Overriden method to check for duplicates entries, if a user tries to + Overridden method to check for duplicates entries, if a user tries to add an entry that is already in the file, the method will raise a ``ValueError`` exception. @@ -454,7 +468,7 @@ boolean, whether to also search in entries that are obsolete. ``msgctxt`` - string, allows to specify a specific message context for the + string, allows specifying a specific message context for the search. """ if include_obsolete_entries: @@ -498,7 +512,7 @@ pass # the rest of the metadata will be alphabetically ordered since there # are no specs for this AFAIK - for data in sorted(metadata.keys()): + for data in natural_sort(metadata.keys()): value = metadata[data] ordered_data.append((data, value)) return ordered_data @@ -611,7 +625,9 @@ """ ret, headers = '', self.header.split('\n') for header in headers: - if header[:1] in [',', ':']: + if not len(header): + ret += "#\n" + elif header[:1] in [',', ':']: ret += '#%s\n' % header else: ret += '# %s\n' % header @@ -778,7 +794,7 @@ class _BaseEntry(object): """ Base class for :class:`~polib.POEntry` and :class:`~polib.MOEntry` classes. - This class should **not** be instanciated directly. + This class should **not** be instantiated directly. """ def __init__(self, *args, **kwargs): @@ -897,9 +913,8 @@ ret = ['%s%s%s "%s"' % (delflag, fieldname, plural_index, escape(lines.pop(0)))] - for mstr in lines: - #import pdb; pdb.set_trace() - ret.append('%s"%s"' % (delflag, escape(mstr))) + for line in lines: + ret.append('%s"%s"' % (delflag, escape(line))) return ret # }}} # class POEntry {{{ @@ -952,12 +967,12 @@ """ Returns the unicode representation of the entry. """ - if self.obsolete: - return _BaseEntry.__unicode__(self, wrapwidth) - ret = [] # comments first, if any (with text wrapping as xgettext does) - comments = [('comment', '#. '), ('tcomment', '# ')] + if self.obsolete: + comments = [('tcomment', '# ')] + else: + comments = [('comment', '#. '), ('tcomment', '# ')] for c in comments: val = getattr(self, c[0]) if val: @@ -974,7 +989,7 @@ ret.append('%s%s' % (c[1], comment)) # occurrences (with text wrapping as xgettext does) - if self.occurrences: + if not self.obsolete and self.occurrences: filelist = [] for fpath, lineno in self.occurrences: if lineno: @@ -1004,17 +1019,17 @@ # previous context and previous msgid/msgid_plural fields = ['previous_msgctxt', 'previous_msgid', 'previous_msgid_plural'] + if self.obsolete: + prefix = "#~| " + else: + prefix = "#| " for f in fields: val = getattr(self, f) if val: - ret += self._str_field(f, "#| ", "", val, wrapwidth) + ret += self._str_field(f, prefix, "", val, wrapwidth) ret.append(_BaseEntry.__unicode__(self, wrapwidth)) ret = u('\n').join(ret) - - assert isinstance(ret, text_type) - #if type(ret) != types.UnicodeType: - # return unicode(ret, self.encoding) return ret def __cmp__(self, other): @@ -1048,6 +1063,17 @@ return 1 else: return -1 + # Compare msgid_plural if set + if self.msgid_plural: + if not other.msgid_plural: + return 1 + for pos in self.msgid_plural: + if pos not in other.msgid_plural: + return 1 + if self.msgid_plural[pos] > other.msgid_plural[pos]: + return 1 + if self.msgid_plural[pos] < other.msgid_plural[pos]: + return -1 # Finally: Compare message ID if self.msgid > other.msgid: return 1 @@ -1212,7 +1238,7 @@ # * HE: Header # * TC: a translation comment # * GC: a generated comment - # * OC: a file/line occurence + # * OC: a file/line occurrence # * FL: a flags line # * CT: a message context # * PC: a previous msgctxt @@ -1470,7 +1496,7 @@ return True def handle_oc(self): - """Handle a file:num occurence.""" + """Handle a file:num occurrence.""" if self.current_state in ['mc', 'ms', 'mx']: self.instance.append(self.current_entry) self.current_entry = POEntry(linenum=self.current_line) @@ -1478,7 +1504,7 @@ for occurrence in occurrences: if occurrence != '': try: - fil, line = occurrence.split(':') + fil, line = occurrence.rsplit(':', 1) if not line.isdigit(): fil = fil + line line = '' @@ -1552,7 +1578,8 @@ def handle_mx(self): """Handle a msgstr plural.""" - index, value = self.current_token[7], self.current_token[11:-1] + index = self.current_token[7] + value = self.current_token[self.current_token.find('"') + 1:-1] self.current_entry.msgstr_plural[int(index)] = unescape(value) self.msgstr_index = int(index) return True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polib-1.0.6/setup.py new/polib-1.0.8/setup.py --- old/polib-1.0.6/setup.py 2014-12-05 10:19:35.000000000 +0100 +++ new/polib-1.0.8/setup.py 2016-05-19 11:20:52.000000000 +0200 @@ -23,16 +23,16 @@ desc = 'A library to manipulate gettext files (po and mo files).' if polib.PY3: - mode = 'rb' + enc = {'encoding': 'UTF-8'} else: - mode = 'r' + enc = {} long_desc = r''' %s %s -''' % (open('README.rst', mode).read(), open('CHANGELOG', mode).read()) +''' % (open('README.rst', **enc).read(), open('CHANGELOG', **enc).read()) if __name__ == '__main__': setup( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polib-1.0.6/tests/test_fuzzy_header.po new/polib-1.0.8/tests/test_fuzzy_header.po --- old/polib-1.0.6/tests/test_fuzzy_header.po 2014-12-05 10:19:35.000000000 +0100 +++ new/polib-1.0.8/tests/test_fuzzy_header.po 2016-11-21 13:07:50.000000000 +0100 @@ -12,3 +12,6 @@ "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"X-Poedit-SearchPath-1: Foo\n" +"X-Poedit-SearchPath-2: Bar\n" +"X-Poedit-SearchPath-10: Baz\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polib-1.0.6/tests/test_merge_after.po new/polib-1.0.8/tests/test_merge_after.po --- old/polib-1.0.6/tests/test_merge_after.po 2014-12-05 10:19:35.000000000 +0100 +++ new/polib-1.0.8/tests/test_merge_after.po 2016-05-19 11:20:52.000000000 +0200 @@ -1,7 +1,7 @@ # translation of django.po to Castellano # This file is distributed under the same license as the PACKAGE package. # Copyright (C) 2007 THE PACKAGE'S COPYRIGHT HOLDER. -# +# msgid "" msgstr "" "Project-Id-Version: django\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polib-1.0.6/tests/test_weird_occurrences.po new/polib-1.0.8/tests/test_weird_occurrences.po --- old/polib-1.0.6/tests/test_weird_occurrences.po 2014-12-05 10:19:35.000000000 +0100 +++ new/polib-1.0.8/tests/test_weird_occurrences.po 2016-11-21 13:55:52.000000000 +0100 @@ -14,6 +14,12 @@ "X-Etoys-Domain: etoys\n" "X-Etoys-SystemVersion: etoys3.0 of 24 February 2008 update 2029\n" + +# Windows paths +#: C:\foo\bar.py:12 +msgid "Windows path" +msgstr "Windows path" + #. Test for empty comment lines #. #, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polib-1.0.6/tests/tests.py new/polib-1.0.8/tests/tests.py --- old/polib-1.0.6/tests/tests.py 2014-12-05 10:20:19.000000000 +0100 +++ new/polib-1.0.8/tests/tests.py 2016-11-21 13:04:46.000000000 +0100 @@ -78,7 +78,7 @@ def test_pofile_and_mofile7(self): """ - Test that encoding is ok when encoding is explicitely given. + Test that encoding is ok when encoding is explicitly given. """ po = polib.pofile('tests/test_iso-8859-15.po', encoding='iso-8859-15') self.assertTrue(po.encoding == 'iso-8859-15') @@ -88,7 +88,7 @@ Test that weird occurrences are correctly parsed. """ po = polib.pofile('tests/test_weird_occurrences.po') - self.assertEqual(len(po), 46) + self.assertEqual(len(po), 47) def test_pofile_and_mofile9(self): """ @@ -209,7 +209,7 @@ def test_detect_encoding1(self): """ - Test that given enconding is returned when file has no encoding defined. + Test that given encoding is returned when file has no encoding defined. """ self.assertEqual(polib.detect_encoding('tests/test_noencoding.po'), 'utf-8') @@ -300,7 +300,7 @@ def test_empty(self): po = polib.pofile('') - self.assertEqual(po.__unicode__(), '# \nmsgid ""\nmsgstr ""\n') + self.assertEqual(po.__unicode__(), '#\nmsgid ""\nmsgstr ""\n') def test_linenum_1(self): po = polib.pofile('tests/test_utf8.po') @@ -314,6 +314,10 @@ po = polib.pofile('tests/test_utf8.po') self.assertEqual(po[-1].linenum, 3478) + def test_windows_path_occurrences(self): + po = polib.pofile('tests/test_weird_occurrences.po') + self.assertEqual(po[0].occurrences, [('C:\\foo\\bar.py', '12')]) + class TestBaseFile(unittest.TestCase): """ @@ -414,7 +418,10 @@ ('Language-Team', u('LANGUAGE <[email protected]>')), ('MIME-Version', u('1.0')), ('Content-Type', u('text/plain; charset=UTF-8')), - ('Content-Transfer-Encoding', u('8bit')) + ('Content-Transfer-Encoding', u('8bit')), + ('X-Poedit-SearchPath-1', u('Foo')), + ('X-Poedit-SearchPath-2', u('Bar')), + ('X-Poedit-SearchPath-10', u('Baz')), ] self.assertEqual(pofile.ordered_metadata(), mdata) @@ -481,7 +488,7 @@ pofile.append(c1) pofile.append(c2) pofile.sort() - expected = u('''# + expected = u('''# msgid "" msgstr "" @@ -515,7 +522,7 @@ def test_trailing_comment(self): pofile = polib.pofile('tests/test_trailing_comment.po') - expected = r'''# + expected = r'''# msgid "" msgstr "Content-Type: text/plain; charset=UTF-8\n"
