Hello community,

here is the log from the commit of package python-polib for openSUSE:Factory 
checked in at 2018-01-26 13:39:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-polib (Old)
 and      /work/SRC/openSUSE:Factory/.python-polib.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-polib"

Fri Jan 26 13:39:50 2018 rev:21 rq:569563 version:1.1.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-polib/python-polib.changes        
2017-12-04 12:17:16.262640862 +0100
+++ /work/SRC/openSUSE:Factory/.python-polib.new/python-polib.changes   
2018-01-26 13:39:56.608050764 +0100
@@ -1,0 +2,17 @@
+Thu Jan 25 15:43:04 UTC 2018 - [email protected]
+
+- Version update to 1.1.0:
+  - Fixed entries sorting when generating mo file (Fixes #78)
+  - Fixed find method (Fixes #84)
+  - Refactored POEntry.__cmp__ method (this should fix issues #60, #65 and #79)
+  - Fixed duplicated entries when merging po file with pot file (fixes #68)
+  - Fixed "None" string being outputted when polib deals with syntax error in 
string (Fixes issue #66)
+  - Added a fuzzy property to entries (Fixes #76)
+  - Take into account the message context when comparing entries
+  - Leave occurence untouched if line number is not a number (fixes #80 and 
#90)
+  - Fixed test for mo files that was failing because since gettext version 
0.19.8.1, msgfmt skips the "POT-Creation-Date" metadata entry (Fixes #86)
+  - Fixed major revision number comparison
+  - Dropped python 2.4 support
+- Drop merged patch 2a4caf09e210554018bf0e928690d9617ff89e00.diff
+
+-------------------------------------------------------------------

Old:
----
  2a4caf09e210554018bf0e928690d9617ff89e00.diff
  polib-1.0.8.tar.gz

New:
----
  polib-1.1.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-polib.spec ++++++
--- /var/tmp/diff_new_pack.qGM2k5/_old  2018-01-26 13:39:57.588004996 +0100
+++ /var/tmp/diff_new_pack.qGM2k5/_new  2018-01-26 13:39:57.596004622 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-polib
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 # Copyright (c) 2013 LISA GmbH, Bingen, Germany.
 #
 # All modifications and additions to the file contributed by third parties
@@ -17,21 +17,15 @@
 #
 
 
-%bcond_without tests
-
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-polib
-Version:        1.0.8
+Version:        1.1.0
 Release:        0
-Url:            http://bitbucket.org/izi/polib/
 Summary:        A library to manipulate gettext files
 License:        MIT
 Group:          Development/Languages/Python
+Url:            http://bitbucket.org/izi/polib/
 Source0:        
https://files.pythonhosted.org/packages/source/p/polib/polib-%{version}.tar.gz
-# PATCH-FIX-UPSTREAM 
https://bitbucket.org/izi/polib/commits/2a4caf09e210554018bf0e928690d9617ff89e00
-Patch0:         2a4caf09e210554018bf0e928690d9617ff89e00.diff
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-BuildRequires:  %{python_module devel}
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
@@ -68,13 +62,12 @@
 
 %prep
 %setup -q -n polib-%{version}
-%patch0 -p1
 
 %build
 %python_build
 
 pushd docs
-make html
+make %{?_smp_mflags} html
 rm _build/html/.buildinfo
 popd
 
@@ -82,18 +75,14 @@
 %python_install
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
-%if %{with tests}
 %check
 %python_exec tests/tests.py
-%endif
 
 %files %{python_files}
-%defattr(-,root,root)
 %doc LICENSE CHANGELOG README.rst
 %{python_sitelib}/*
 
 %files -n python-polib-doc
-%defattr(-,root,root)
 %doc docs/_build/html
 
 %changelog

++++++ polib-1.0.8.tar.gz -> polib-1.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-1.0.8/CHANGELOG new/polib-1.1.0/CHANGELOG
--- old/polib-1.0.8/CHANGELOG   2016-11-21 14:30:52.000000000 +0100
+++ new/polib-1.1.0/CHANGELOG   2017-11-27 17:54:40.000000000 +0100
@@ -2,6 +2,20 @@
 Changelog
 =========
 
+Version 1.1.0 (2017/11/27)
+--------------------------
+ - Fixed entries sorting when generating mo file (Fixes #78)
+ - Fixed find method (Fixes #84)
+ - Refactored POEntry.__cmp__ method (this should fix issues #60, #65 and #79)
+ - Fixed duplicated entries when merging po file with pot file (fixes #68)
+ - Fixed "None" string being outputted when polib deals with syntax error in 
string (Fixes issue #66)
+ - Added a fuzzy property to entries (Fixes #76)
+ - Take into account the message context when comparing entries
+ - Leave occurence untouched if line number is not a number (fixes #80 and #90)
+ - Fixed test for mo files that was failing because since gettext version 
0.19.8.1, msgfmt skips the "POT-Creation-Date" metadata entry (Fixes #86)
+ - Fixed major revision number comparison
+ - Dropped python 2.4 support
+
 Version 1.0.8 (2016/11/21)
 --------------------------
  - Fixed issue #70 (occurrences parsing for windows pathes)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-1.0.8/PKG-INFO new/polib-1.1.0/PKG-INFO
--- old/polib-1.0.8/PKG-INFO    2016-11-21 14:32:21.000000000 +0100
+++ new/polib-1.1.0/PKG-INFO    2017-11-27 18:33:18.000000000 +0100
@@ -1,12 +1,13 @@
 Metadata-Version: 1.1
 Name: polib
-Version: 1.0.8
+Version: 1.1.0
 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.8.tar.gz
+Download-URL: 
https://pypi.python.org/packages/source/p/polib/polib-1.1.0.tar.gz
+Description-Content-Type: UNKNOWN
 Description: 
         =====
         polib
@@ -32,7 +33,7 @@
         files). You can load existing files, iterate through it's entries, 
add, modify
         entries, comments or metadata, etc... or create new po files from 
scratch.
         
-        polib supports out of the box any version of python ranging from 2.4 
to latest
+        polib supports out of the box any version of python ranging from 2.5 
to latest
         3.X version.
         
         polib is pretty stable now and is used by many 
@@ -52,6 +53,20 @@
         Changelog
         =========
         
+        Version 1.1.0 (2017/11/27)
+        --------------------------
+         - Fixed entries sorting when generating mo file (Fixes #78)
+         - Fixed find method (Fixes #84)
+         - Refactored POEntry.__cmp__ method (this should fix issues #60, #65 
and #79)
+         - Fixed duplicated entries when merging po file with pot file (fixes 
#68)
+         - Fixed "None" string being outputted when polib deals with syntax 
error in string (Fixes issue #66)
+         - Added a fuzzy property to entries (Fixes #76)
+         - Take into account the message context when comparing entries
+         - Leave occurence untouched if line number is not a number (fixes #80 
and #90)
+         - Fixed test for mo files that was failing because since gettext 
version 0.19.8.1, msgfmt skips the "POT-Creation-Date" metadata entry (Fixes 
#86)
+         - Fixed major revision number comparison
+         - Dropped python 2.4 support
+        
         Version 1.0.8 (2016/11/21)
         --------------------------
          - Fixed issue #70 (occurrences parsing for windows pathes)
@@ -273,6 +288,9 @@
 Classifier: Programming Language :: Python :: 3.2
 Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
 Classifier: Topic :: Software Development :: Internationalization
 Classifier: Topic :: Software Development :: Localization
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-1.0.8/README.rst new/polib-1.1.0/README.rst
--- old/polib-1.0.8/README.rst  2016-05-19 11:20:52.000000000 +0200
+++ new/polib-1.1.0/README.rst  2017-11-27 14:54:29.000000000 +0100
@@ -22,7 +22,7 @@
 files). You can load existing files, iterate through it's entries, add, modify
 entries, comments or metadata, etc... or create new po files from scratch.
 
-polib supports out of the box any version of python ranging from 2.4 to latest
+polib supports out of the box any version of python ranging from 2.5 to latest
 3.X version.
 
 polib is pretty stable now and is used by many 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-1.0.8/polib.egg-info/PKG-INFO 
new/polib-1.1.0/polib.egg-info/PKG-INFO
--- old/polib-1.0.8/polib.egg-info/PKG-INFO     2016-11-21 14:32:21.000000000 
+0100
+++ new/polib-1.1.0/polib.egg-info/PKG-INFO     2017-11-27 18:33:18.000000000 
+0100
@@ -1,12 +1,13 @@
 Metadata-Version: 1.1
 Name: polib
-Version: 1.0.8
+Version: 1.1.0
 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.8.tar.gz
+Download-URL: 
https://pypi.python.org/packages/source/p/polib/polib-1.1.0.tar.gz
+Description-Content-Type: UNKNOWN
 Description: 
         =====
         polib
@@ -32,7 +33,7 @@
         files). You can load existing files, iterate through it's entries, 
add, modify
         entries, comments or metadata, etc... or create new po files from 
scratch.
         
-        polib supports out of the box any version of python ranging from 2.4 
to latest
+        polib supports out of the box any version of python ranging from 2.5 
to latest
         3.X version.
         
         polib is pretty stable now and is used by many 
@@ -52,6 +53,20 @@
         Changelog
         =========
         
+        Version 1.1.0 (2017/11/27)
+        --------------------------
+         - Fixed entries sorting when generating mo file (Fixes #78)
+         - Fixed find method (Fixes #84)
+         - Refactored POEntry.__cmp__ method (this should fix issues #60, #65 
and #79)
+         - Fixed duplicated entries when merging po file with pot file (fixes 
#68)
+         - Fixed "None" string being outputted when polib deals with syntax 
error in string (Fixes issue #66)
+         - Added a fuzzy property to entries (Fixes #76)
+         - Take into account the message context when comparing entries
+         - Leave occurence untouched if line number is not a number (fixes #80 
and #90)
+         - Fixed test for mo files that was failing because since gettext 
version 0.19.8.1, msgfmt skips the "POT-Creation-Date" metadata entry (Fixes 
#86)
+         - Fixed major revision number comparison
+         - Dropped python 2.4 support
+        
         Version 1.0.8 (2016/11/21)
         --------------------------
          - Fixed issue #70 (occurrences parsing for windows pathes)
@@ -273,6 +288,9 @@
 Classifier: Programming Language :: Python :: 3.2
 Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
 Classifier: Topic :: Software Development :: Internationalization
 Classifier: Topic :: Software Development :: Localization
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-1.0.8/polib.egg-info/SOURCES.txt 
new/polib-1.1.0/polib.egg-info/SOURCES.txt
--- old/polib-1.0.8/polib.egg-info/SOURCES.txt  2016-11-21 14:32:21.000000000 
+0100
+++ new/polib-1.1.0/polib.egg-info/SOURCES.txt  2017-11-27 18:33:18.000000000 
+0100
@@ -41,6 +41,7 @@
 tests/test_unusual_metadata_location.po
 tests/test_utf8.mo
 tests/test_utf8.po
+tests/test_version_1.1.mo
 tests/test_weird_occurrences.po
 tests/test_word_garbage.po
 tests/test_wrap.po
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-1.0.8/polib.py new/polib-1.1.0/polib.py
--- old/polib-1.0.8/polib.py    2016-11-21 14:27:20.000000000 +0100
+++ new/polib-1.1.0/polib.py    2017-11-27 18:27:09.000000000 +0100
@@ -12,11 +12,6 @@
 :func:`~polib.mofile` convenience functions.
 """
 
-__author__ = 'David Jean Louis <[email protected]>'
-__version__ = '1.0.8'
-__all__ = ['pofile', 'POFile', 'POEntry', 'mofile', 'MOFile', 'MOEntry',
-           'default_encoding', 'escape', 'unescape', 'detect_encoding', ]
-
 import array
 import codecs
 import os
@@ -36,6 +31,12 @@
             return codecs.open(fpath, mode, encoding)
 
 
+__author__ = 'David Jean Louis <[email protected]>'
+__version__ = '1.1.0'
+__all__ = ['pofile', 'POFile', 'POEntry', 'mofile', 'MOFile', 'MOEntry',
+           'default_encoding', 'escape', 'unescape', 'detect_encoding', ]
+
+
 # the default encoding to use when encoding cannot be detected
 default_encoding = 'utf-8'
 
@@ -270,9 +271,14 @@
     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)
+    def convert(text):
+        return int(text) if text.isdigit() else text.lower()
+
+    def alphanum_key(key):
+        return [convert(c) for c in re.split('([0-9]+)', key)]
+
+    return sorted(lst, key=alphanum_key)
+
 # }}}
 # class _BaseFile {{{
 
@@ -333,10 +339,6 @@
         for entry in self.obsolete_entries():
             ret.append(entry.__unicode__(self.wrapwidth))
         ret = u('\n').join(ret)
-
-        assert isinstance(ret, text_type)
-        #if type(ret) != text_type:
-        #    return unicode(ret, self.encoding)
         return ret
 
     if PY3:
@@ -475,11 +477,25 @@
             entries = self[:]
         else:
             entries = [e for e in self if not e.obsolete]
+        matches = []
         for e in entries:
             if getattr(e, by) == st:
                 if msgctxt is not False and e.msgctxt != msgctxt:
                     continue
-                return e
+                matches.append(e)
+        if len(matches) == 1:
+            return matches[0]
+        elif len(matches) > 1:
+            if not msgctxt:
+                # find the entry with no msgctx
+                e = None
+                for m in matches:
+                    if not m.msgctxt:
+                        e = m
+                if e:
+                    return e
+                # fallback to the first entry found
+                return matches[0]
         return None
 
     def ordered_metadata(self):
@@ -536,9 +552,8 @@
             else:
                 return 0
         # add metadata entry
-        entries.sort(key=lambda o: o.msgctxt or o.msgid)
+        entries.sort(key=lambda o: o.msgid_with_context.encode('utf-8'))
         mentry = self.metadata_as_entry()
-        #mentry.msgstr = mentry.msgstr.replace('\\n', '').lstrip()
         entries = [mentry] + entries
         entries_len = len(entries)
         ids, strs = b(''), b('')
@@ -670,13 +685,13 @@
         Convenience method that returns the list of untranslated entries.
         """
         return [e for e in self if not e.translated() and not e.obsolete
-                and not 'fuzzy' in e.flags]
+                and not e.fuzzy]
 
     def fuzzy_entries(self):
         """
         Convenience method that returns the list of fuzzy entries.
         """
-        return [e for e in self if 'fuzzy' in e.flags]
+        return [e for e in self if e.fuzzy]
 
     def obsolete_entries(self):
         """
@@ -701,18 +716,20 @@
             object POFile, the reference catalog.
         """
         # Store entries in dict/set for faster access
-        self_entries = dict((entry.msgid, entry) for entry in self)
-        refpot_msgids = set(entry.msgid for entry in refpot)
+        self_entries = dict(
+            (entry.msgid_with_context, entry) for entry in self
+        )
+        refpot_msgids = set(entry.msgid_with_context for entry in refpot)
         # Merge entries that are in the refpot
         for entry in refpot:
-            e = self_entries.get(entry.msgid)
+            e = self_entries.get(entry.msgid_with_context)
             if e is None:
                 e = POEntry()
                 self.append(e)
             e.merge(entry)
         # ok, now we must "obsolete" entries that are not in the refpot anymore
         for entry in self:
-            if entry.msgid not in refpot_msgids:
+            if entry.msgid_with_context not in refpot_msgids:
                 entry.obsolete = True
 # }}}
 # class MOFile {{{
@@ -1036,7 +1053,6 @@
         """
         Called by comparison operations if rich comparison is not defined.
         """
-
         # First: Obsolete test
         if self.obsolete != other.obsolete:
             if self.obsolete:
@@ -1047,39 +1063,43 @@
         occ1 = sorted(self.occurrences[:])
         occ2 = sorted(other.occurrences[:])
         pos = 0
-        for entry1 in occ1:
-            try:
-                entry2 = occ2[pos]
-            except IndexError:
-                return 1
-            pos = pos + 1
-            if entry1[0] != entry2[0]:
-                if entry1[0] > entry2[0]:
-                    return 1
-                else:
-                    return -1
-            if entry1[1] != entry2[1]:
-                if entry1[1] > entry2[1]:
-                    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 occ1 > occ2:
+            return 1
+        if occ1 < occ2:
+            return -1
+        # Compare context
+        msgctxt = self.msgctxt or 0
+        othermsgctxt = other.msgctxt or 0
+        if msgctxt > othermsgctxt:
+            return 1
+        elif msgctxt < othermsgctxt:
+            return -1
+        # Compare msgid_plural
+        msgid_plural = self.msgid_plural or 0
+        othermsgid_plural = other.msgid_plural or 0
+        if msgid_plural > othermsgid_plural:
+            return 1
+        elif msgid_plural < othermsgid_plural:
+            return -1
+        # Compare msgstr_plural
+        msgstr_plural = self.msgstr_plural or 0
+        othermsgstr_plural = other.msgstr_plural or 0
+        if msgstr_plural > othermsgstr_plural:
+            return 1
+        elif msgstr_plural < othermsgstr_plural:
+            return -1
+        # Compare msgid
         if self.msgid > other.msgid:
             return 1
         elif self.msgid < other.msgid:
             return -1
         return 0
+        # Compare msgstr
+        if self.msgstr > other.msgstr:
+            return 1
+        elif self.msgstr < other.msgstr:
+            return -1
+        return 0
 
     def __gt__(self, other):
         return self.__cmp__(other) > 0
@@ -1104,7 +1124,7 @@
         Returns ``True`` if the entry has been translated or ``False``
         otherwise.
         """
-        if self.obsolete or 'fuzzy' in self.flags:
+        if self.obsolete or self.fuzzy:
             return False
         if self.msgstr != '':
             return True
@@ -1123,7 +1143,7 @@
         self.msgctxt = other.msgctxt
         self.occurrences = other.occurrences
         self.comment = other.comment
-        fuzzy = 'fuzzy' in self.flags
+        fuzzy = self.fuzzy
         self.flags = other.flags[:]  # clone flags
         if fuzzy:
             self.flags.append('fuzzy')
@@ -1140,6 +1160,16 @@
                 except KeyError:
                     self.msgstr_plural[pos] = ''
 
+    @property
+    def fuzzy(self):
+        return 'fuzzy' in self.flags
+
+    @property
+    def msgid_with_context(self):
+        if self.msgctxt:
+            return '%s%s%s' % (self.msgctxt, "\x04", self.msgid)
+        return self.msgid
+
     def __hash__(self):
         return hash((self.msgid, self.msgstr))
 # }}}
@@ -1288,6 +1318,7 @@
             'msgctxt': 'pc',
         }
         tokens = []
+        fpath = '%s ' % self.instance.fpath if self.instance.fpath else ''
         for line in self.fhandle:
             self.current_line += 1
             line = line.strip()
@@ -1313,9 +1344,9 @@
             if tokens[0] in keywords and nb_tokens > 1:
                 line = line[len(tokens[0]):].lstrip()
                 if re.search(r'([^\\]|^)"', line[1:-1]):
-                    raise IOError('Syntax error in po file %s (line %s): '
+                    raise IOError('Syntax error in po file %s(line %s): '
                                   'unescaped double quote found' %
-                                  (self.instance.fpath, self.current_line))
+                                  (fpath, self.current_line))
                 self.current_token = line
                 self.process(keywords[tokens[0]])
                 continue
@@ -1331,9 +1362,9 @@
             elif line[:1] == '"':
                 # we are on a continuation line
                 if re.search(r'([^\\]|^)"', line[1:-1]):
-                    raise IOError('Syntax error in po file %s (line %s): '
+                    raise IOError('Syntax error in po file %s(line %s): '
                                   'unescaped double quote found' %
-                                  (self.instance.fpath, self.current_line))
+                                  (fpath, self.current_line))
                 self.process('mc')
 
             elif line[:7] == 'msgstr[':
@@ -1360,8 +1391,8 @@
 
             elif tokens[0] == '#|':
                 if nb_tokens <= 1:
-                    raise IOError('Syntax error in po file %s (line %s)' %
-                                  (self.instance.fpath, self.current_line))
+                    raise IOError('Syntax error in po file %s(line %s)' %
+                                  (fpath, self.current_line))
 
                 # Remove the marker and any whitespace right after that.
                 line = line[2:].lstrip()
@@ -1374,16 +1405,16 @@
 
                 if nb_tokens == 2:
                     # Invalid continuation line.
-                    raise IOError('Syntax error in po file %s (line %s): '
+                    raise IOError('Syntax error in po file %s(line %s): '
                                   'invalid continuation line' %
-                                  (self.instance.fpath, self.current_line))
+                                  (fpath, self.current_line))
 
                 # we are on a "previous translation" comment line,
                 if tokens[1] not in prev_keywords:
                     # Unknown keyword in previous translation comment.
-                    raise IOError('Syntax error in po file %s (line %s): '
+                    raise IOError('Syntax error in po file %s(line %s): '
                                   'unknown keyword %s' %
-                                  (self.instance.fpath, self.current_line,
+                                  (fpath, self.current_line,
                                    tokens[1]))
 
                 # Remove the keyword and any whitespace
@@ -1393,8 +1424,8 @@
                 self.process(prev_keywords[tokens[1]])
 
             else:
-                raise IOError('Syntax error in po file %s (line %s)' %
-                              (self.instance.fpath, self.current_line))
+                raise IOError('Syntax error in po file %s(line %s)' %
+                              (fpath, self.current_line))
 
         if self.current_entry and len(tokens) > 0 and \
            not tokens[0].startswith('#'):
@@ -1506,7 +1537,7 @@
                 try:
                     fil, line = occurrence.rsplit(':', 1)
                     if not line.isdigit():
-                        fil = fil + line
+                        fil = occurrence
                         line = ''
                     self.current_entry.occurrences.append((fil, line))
                 except (ValueError, AttributeError):
@@ -1668,7 +1699,7 @@
         version, numofstrings = self._readbinary(ii, 8)
         # from MO file format specs: "A program seeing an unexpected major
         # revision number should stop reading the MO file entirely"
-        if version not in (0, 1):
+        if version >> 16 not in (0, 1):
             raise IOError('Invalid mo file, unexpected major revision number')
         self.instance.version = version
         # original strings and translation strings hash table offset
@@ -1808,12 +1839,12 @@
                 del chunks[-1]
 
             while chunks:
-                l = len(chunks[-1])
+                length = len(chunks[-1])
 
                 # Can at least squeeze this chunk onto the current line.
-                if cur_len + l <= width:
+                if cur_len + length <= width:
                     cur_line.append(chunks.pop())
-                    cur_len += l
+                    cur_len += length
 
                 # Nope, this line is full.
                 else:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-1.0.8/setup.cfg new/polib-1.1.0/setup.cfg
--- old/polib-1.0.8/setup.cfg   2016-11-21 14:32:21.000000000 +0100
+++ new/polib-1.1.0/setup.cfg   2017-11-27 18:33:18.000000000 +0100
@@ -4,5 +4,4 @@
 [egg_info]
 tag_build = 
 tag_date = 0
-tag_svn_revision = 0
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-1.0.8/setup.py new/polib-1.1.0/setup.py
--- old/polib-1.0.8/setup.py    2016-05-19 11:20:52.000000000 +0200
+++ new/polib-1.1.0/setup.py    2017-11-27 14:28:33.000000000 +0100
@@ -67,6 +67,9 @@
             'Programming Language :: Python :: 3.2',
             'Programming Language :: Python :: 3.3',
             'Programming Language :: Python :: 3.4',
+            'Programming Language :: Python :: 3.5',
+            'Programming Language :: Python :: 3.6',
+            'Programming Language :: Python :: Implementation :: PyPy',
             'Topic :: Software Development :: Libraries :: Python Modules',
             'Topic :: Software Development :: Internationalization',
             'Topic :: Software Development :: Localization',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-1.0.8/tests/test_iso-8859-15.po 
new/polib-1.1.0/tests/test_iso-8859-15.po
--- old/polib-1.0.8/tests/test_iso-8859-15.po   2016-05-19 11:20:52.000000000 
+0200
+++ new/polib-1.1.0/tests/test_iso-8859-15.po   2017-11-27 13:14:47.000000000 
+0100
@@ -3,7 +3,6 @@
 msgstr ""
 "Project-Id-Version: Vim(Fran�ais)\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-05-01 19:42+0200\n"
 "PO-Revision-Date: 2006-05-02 14:15+0200\n"
 "Last-Translator: David Blanchet <[email protected]>\n"
 "Language-Team: Adrien Beau <[email protected]>\n"
Binary files old/polib-1.0.8/tests/test_msgctxt.mo and 
new/polib-1.1.0/tests/test_msgctxt.mo differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-1.0.8/tests/test_msgctxt.po 
new/polib-1.1.0/tests/test_msgctxt.po
--- old/polib-1.0.8/tests/test_msgctxt.po       2016-05-19 11:20:52.000000000 
+0200
+++ new/polib-1.1.0/tests/test_msgctxt.po       2017-11-27 16:51:41.000000000 
+0100
@@ -5,10 +5,13 @@
 
 msgctxt "Some message context"
 msgid "some string"
-msgstr "une chaîne"
+msgstr "une chaîne avec contexte"
 
 msgctxt "Some other message context"
 msgid "singular"
 msgid_plural "plural"
 msgstr[0] "singulier"
 msgstr[1] "pluriel"
+
+msgid "some string"
+msgstr "une chaîne sans contexte"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-1.0.8/tests/test_utf8.po 
new/polib-1.1.0/tests/test_utf8.po
--- old/polib-1.0.8/tests/test_utf8.po  2016-05-19 11:20:52.000000000 +0200
+++ new/polib-1.1.0/tests/test_utf8.po  2017-11-27 13:14:51.000000000 +0100
@@ -6,7 +6,6 @@
 msgstr ""
 "Project-Id-Version: django\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-08-17 15:35-0400\n"
 "PO-Revision-Date: 2007-07-14 13:00-0500\n"
 "Last-Translator: Mario Gonzalez <gonzalemario @t gmail.com>\n"
 "Language-Team: Castellano <[email protected]>\n"
Binary files old/polib-1.0.8/tests/test_version_1.1.mo and 
new/polib-1.1.0/tests/test_version_1.1.mo differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-1.0.8/tests/tests.py 
new/polib-1.1.0/tests/tests.py
--- old/polib-1.0.8/tests/tests.py      2016-11-21 13:04:46.000000000 +0100
+++ new/polib-1.1.0/tests/tests.py      2017-11-27 17:19:25.000000000 +0100
@@ -154,7 +154,7 @@
             self.fail("Unescaped quote not detected")
         except IOError:
             exc = sys.exc_info()[1]
-            msg = 'Syntax error in po file None (line 3): unescaped double 
quote found'
+            msg = 'Syntax error in po file (line 3): unescaped double quote 
found'
             self.assertEqual(str(exc), msg)
 
     def test_unescaped_double_quote2(self):
@@ -171,7 +171,7 @@
             self.fail("Unescaped quote not detected")
         except IOError:
             exc = sys.exc_info()[1]
-            msg = 'Syntax error in po file None (line 4): unescaped double 
quote found'
+            msg = 'Syntax error in po file (line 4): unescaped double quote 
found'
             self.assertEqual(str(exc), msg)
 
     def test_unescaped_double_quote3(self):
@@ -187,7 +187,7 @@
             self.fail("Unescaped quote not detected")
         except IOError:
             exc = sys.exc_info()[1]
-            msg = 'Syntax error in po file None (line 3): unescaped double 
quote found'
+            msg = 'Syntax error in po file (line 3): unescaped double quote 
found'
             self.assertEqual(str(exc), msg)
 
     def test_unescaped_double_quote4(self):
@@ -204,7 +204,7 @@
             self.fail("Unescaped quote not detected")
         except IOError:
             exc = sys.exc_info()[1]
-            msg = 'Syntax error in po file None (line 4): unescaped double 
quote found'
+            msg = 'Syntax error in po file (line 4): unescaped double quote 
found'
             self.assertEqual(str(exc), msg)
     
     def test_detect_encoding1(self):
@@ -304,15 +304,15 @@
 
     def test_linenum_1(self):
         po = polib.pofile('tests/test_utf8.po')
-        self.assertEqual(po[0].linenum, 18)
+        self.assertEqual(po[0].linenum, 17)
 
     def test_linenum_2(self):
         po = polib.pofile('tests/test_utf8.po')
-        self.assertEqual(po.find('XML text').linenum, 1799)
+        self.assertEqual(po.find('XML text').linenum, 1798)
 
     def test_linenum_3(self):
         po = polib.pofile('tests/test_utf8.po')
-        self.assertEqual(po[-1].linenum, 3478)
+        self.assertEqual(po[-1].linenum, 3477)
 
     def test_windows_path_occurrences(self):
         po = polib.pofile('tests/test_weird_occurrences.po')
@@ -389,6 +389,13 @@
         self.assertEqual(entry1.msgstr, u('test context 1'))
         self.assertEqual(entry2.msgstr, u('test context 2'))
 
+    def test_find5(self):
+        pofile = polib.pofile('tests/test_msgctxt.po')
+        entry1 = pofile.find('some string')
+        entry2 = pofile.find('some string', msgctxt='Some message context')
+        self.assertEqual(entry1.msgstr, u('une cha\u00eene sans contexte'))
+        self.assertEqual(entry2.msgstr, u('une cha\u00eene avec contexte'))
+
     def test_save1(self):
         pofile = polib.POFile()
         self.assertRaises(IOError, pofile.save)
@@ -661,18 +668,22 @@
 
 msgctxt "Some message context"
 msgid "some string"
-msgstr "une cha\u00eene"
+msgstr "une cha\u00eene avec contexte"
 
 msgctxt "Some other message context"
 msgid "singular"
 msgid_plural "plural"
 msgstr[0] "singulier"
 msgstr[1] "pluriel"
+
+msgid "some string"
+msgstr "une cha\u00eene sans contexte"
 ''')
         self.assertEqual(mo.__unicode__(), expected)
 
     def test_invalid_version(self):
         self.assertRaises(IOError, polib.mofile, 
'tests/test_invalid_version.mo')
+        polib.mofile('tests/test_version_1.1.mo')
 
     def test_no_header(self):
         mo = polib.mofile('tests/test_no_header.mo')


Reply via email to