Hello community,

here is the log from the commit of package python-polib for openSUSE:Factory 
checked in at 2012-06-14 22:26:32
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-polib (Old)
 and      /work/SRC/openSUSE:Factory/.python-polib.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-polib", Maintainer is ""

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-polib/python-polib.changes        
2012-02-17 12:08:58.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.python-polib.new/python-polib.changes   
2012-06-14 22:26:34.000000000 +0200
@@ -1,0 +2,13 @@
+Wed Jun 13 00:41:24 UTC 2012 - [email protected]
+
+- Update to 1.0.0:
+  * polib.pofile and polib.mofile functions can now return a custom class
+    (thanks Craig Blaszczyk)
+  * polib now can find the metadata entry no matter where it is located (thanks
+    François Poirotte)
+  * fixed issue #28 (IOError on reading obsolete "previous msgid" entries)
+    (thanks James Ni)
+  * Dropped python 2.4 support
+- Add %check section to run unit tests
+
+-------------------------------------------------------------------

Old:
----
  polib-0.7.0.tar.bz2

New:
----
  polib-1.0.0.tar.bz2

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

Other differences:
------------------
++++++ python-polib.spec ++++++
--- /var/tmp/diff_new_pack.tTkbb9/_old  2012-06-14 22:26:36.000000000 +0200
+++ /var/tmp/diff_new_pack.tTkbb9/_new  2012-06-14 22:26:36.000000000 +0200
@@ -16,8 +16,9 @@
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
+
 Name:           python-polib
-Version:        0.7.0
+Version:        1.0.0
 Release:        0
 Url:            http://bitbucket.org/izi/polib/
 Summary:        A library to manipulate gettext files
@@ -73,6 +74,9 @@
 python setup.py install --prefix=%{_prefix} --root=%{buildroot}
 %fdupes -s %{buildroot}/%{_prefix}
 
+%check
+./runtests.sh
+
 %files
 %defattr(-,root,root)
 %doc LICENSE CHANGELOG README.rst

++++++ polib-0.7.0.tar.bz2 -> polib-1.0.0.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-0.7.0/CHANGELOG new/polib-1.0.0/CHANGELOG
--- old/polib-0.7.0/CHANGELOG   2011-07-14 14:32:11.000000000 +0200
+++ new/polib-1.0.0/CHANGELOG   2012-06-07 22:10:37.000000000 +0200
@@ -2,6 +2,15 @@
 Changelog
 =========
 
+Version 1.0.0 (2012/06/08)
+--------------------------
+Yeah... after nearly 6 years, polib reaches the stable state :)
+Changes and fixes in this release:
+- polib.pofile and polib.mofile functions can now return a custom class 
(thanks Craig Blaszczyk)
+- polib now can find the metadata entry no matter where it is located (thanks 
François Poirotte)
+- fixed issue #28 (IOError on reading obsolete "previous msgid" entries) 
(thanks James Ni)
+- Dropped python 2.4 support
+
 Version 0.7.0 (2011/07/14)
 --------------------------
 This version adds support for python 3 (thanks to Vinay Sajip).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-0.7.0/PKG-INFO new/polib-1.0.0/PKG-INFO
--- old/polib-0.7.0/PKG-INFO    2011-07-14 14:34:33.000000000 +0200
+++ new/polib-1.0.0/PKG-INFO    2012-06-08 19:02:28.000000000 +0200
@@ -1,12 +1,12 @@
 Metadata-Version: 1.0
 Name: polib
-Version: 0.7.0
+Version: 1.0.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: http://bitbucket.org/izi/polib/downloads/polib-0.7.0.tar.gz
+Download-URL: http://bitbucket.org/izi/polib/downloads/polib-1.0.0.tar.gz
 Description: 
         .. contents:: Table of Contents
         
@@ -38,6 +38,15 @@
         Changelog
         =========
         
+        Version 1.0.0 (2012/06/08)
+        --------------------------
+        Yeah... after nearly 6 years, polib reaches the stable state :)
+        Changes and fixes in this release:
+        - polib.pofile and polib.mofile functions can now return a custom 
class (thanks Craig Blaszczyk)
+        - polib now can find the metadata entry no matter where it is located 
(thanks François Poirotte)
+        - fixed issue #28 (IOError on reading obsolete "previous msgid" 
entries) (thanks James Ni)
+        - Dropped python 2.4 support
+        
         Version 0.7.0 (2011/07/14)
         --------------------------
         This version adds support for python 3 (thanks to Vinay Sajip).
Files old/polib-0.7.0/docs/.index.rst.un~ and 
new/polib-1.0.0/docs/.index.rst.un~ differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-0.7.0/docs/conf.py new/polib-1.0.0/docs/conf.py
--- old/polib-0.7.0/docs/conf.py        2011-07-13 14:18:07.000000000 +0200
+++ new/polib-1.0.0/docs/conf.py        2011-08-01 18:45:10.000000000 +0200
@@ -18,6 +18,8 @@
 # documentation root, use os.path.abspath to make it absolute, like shown here.
 sys.path.insert(0, os.path.abspath('..'))
 
+import polib
+
 # -- General configuration 
-----------------------------------------------------
 
 # If your documentation needs a minimal Sphinx version, state it here.
@@ -48,9 +50,9 @@
 # built documents.
 #
 # The short X.Y version.
-version = '0.6.0'
+version = polib.__version__
 # The full version, including alpha/beta/rc tags.
-release = '0.6.0'
+release = polib.__version__
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-0.7.0/polib.py new/polib-1.0.0/polib.py
--- old/polib-0.7.0/polib.py    2011-07-14 14:33:15.000000000 +0200
+++ new/polib-1.0.0/polib.py    2012-06-08 18:54:34.000000000 +0200
@@ -13,7 +13,7 @@
 """
 
 __author__    = 'David Jean Louis <[email protected]>'
-__version__   = '0.7.0'
+__version__   = '1.0.0'
 __all__       = ['pofile', 'POFile', 'POEntry', 'mofile', 'MOFile', 'MOEntry',
                  'detect_encoding', 'escape', 'unescape', 'detect_encoding',]
 
@@ -68,7 +68,8 @@
     parser = kls(
         f,
         encoding=enc,
-        check_for_duplicates=kwargs.get('check_for_duplicates', False)
+        check_for_duplicates=kwargs.get('check_for_duplicates', False),
+        klass = kwargs.get('klass')
     )
     instance = parser.parse()
     instance.wrapwidth = kwargs.get('wrapwidth', 78)
@@ -98,6 +99,11 @@
     ``check_for_duplicates``
         whether to check for duplicate entries when adding entries to the
         file (optional, default: ``False``).
+        
+    ``klass``
+        class which is used to instantiate the return value (optional,
+        default: ``None``, the return value with be a :class:`~polib.POFile`
+        instance).
     """
     return _pofile_or_mofile(pofile, 'pofile', **kwargs)
 
@@ -126,6 +132,11 @@
     ``check_for_duplicates``
         whether to check for duplicate entries when adding entries to the
         file (optional, default: ``False``).
+        
+    ``klass``
+        class which is used to instantiate the return value (optional,
+        default: ``None``, the return value with be a :class:`~polib.POFile`
+        instance).
     """
     return _pofile_or_mofile(mofile, 'mofile', **kwargs)
 
@@ -1096,7 +1107,10 @@
         else:
             self.fhandle = pofile.splitlines()
 
-        self.instance = POFile(
+        klass = kwargs.get('klass')
+        if klass is None:
+            klass = POFile
+        self.instance = klass(
             pofile=pofile,
             encoding=enc,
             check_for_duplicates=kwargs.get('check_for_duplicates', False)
@@ -1174,6 +1188,9 @@
             tokens = line.split(None, 2)
             nb_tokens = len(tokens)
 
+            if tokens[0] == '#~|':
+                continue
+
             if tokens[0] == '#~' and nb_tokens > 1:
                 line = line[3:].strip()
                 tokens = tokens[1:]
@@ -1186,6 +1203,10 @@
             # msgid, msgid_plural, msgctxt & msgstr.
             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): '\
+                                  'unescaped double quote found' % \
+                                  (self.instance.fpath, i))
                 self.current_token = line
                 self.process(keywords[tokens[0]], i)
                 continue
@@ -1198,13 +1219,17 @@
 
             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): '\
+                                  'unescaped double quote found' % \
+                                  (self.instance.fpath, i))
                 self.process('MC', i)
 
             elif line[:7] == 'msgstr[':
                 # we are on a msgstr plural
                 self.process('MX', i)
 
-            elif tokens[0] == '#,' and nb_tokens > 1:
+            elif tokens[0] == '#,' and nb_tokens >= 1:
                 # we are on a flags line
                 self.process('FL', i)
 
@@ -1213,14 +1238,14 @@
                 # we are on a translator comment line
                 self.process('TC', i)
 
-            elif tokens[0] == '#.' and nb_tokens > 1:
+            elif tokens[0] == '#.' and nb_tokens >= 1:
                 # we are on a generated comment line
                 self.process('GC', i)
 
             elif tokens[0] == '#|':
                 if nb_tokens < 2:
-                    self.process('??', i)
-                    continue
+                    raise IOError('Syntax error in po file %s (line %s)' % \
+                                  (self.instance.fpath, i))
 
                 # Remove the marker and any whitespace right after that.
                 line = line[2:].lstrip()
@@ -1233,12 +1258,16 @@
 
                 if nb_tokens == 2:
                     # Invalid continuation line.
-                    self.process('??', i)
+                    raise IOError('Syntax error in po file %s (line %s): '\
+                                  'invalid continuation line' % \
+                                  (self.instance.fpath, i))
 
                 # we are on a "previous translation" comment line,
                 if tokens[1] not in prev_keywords:
                     # Unknown keyword in previous translation comment.
-                    self.process('??', i)
+                    raise IOError('Syntax error in po file %s (line %s): '\
+                                  'unknown keyword %s' % \
+                                  (self.instance.fpath, i, tokens[1]))
 
                 # Remove the keyword and any whitespace
                 # between it and the starting quote.
@@ -1247,7 +1276,8 @@
                 self.process(prev_keywords[tokens[1]], i)
 
             else:
-                self.process('??', i)
+                raise IOError('Syntax error in po file %s (line %s)' % \
+                              (self.instance.fpath, i))
 
         if self.current_entry:
             # since entries are added when another entry is found, we must add
@@ -1255,13 +1285,13 @@
             self.instance.append(self.current_entry)
         # before returning the instance, check if there's metadata and if 
         # so extract it in a dict
-        firstentry = self.instance[0]
-        if firstentry.msgid == '': # metadata found
+        metadataentry = self.instance.find('')
+        if metadataentry: # metadata found
             # remove the entry
-            firstentry = self.instance.pop(0)
-            self.instance.metadata_is_fuzzy = firstentry.flags
+            self.instance.remove(metadataentry)
+            self.instance.metadata_is_fuzzy = metadataentry.flags
             key = None
-            for msg in firstentry.msgstr.splitlines():
+            for msg in metadataentry.msgstr.splitlines():
                 try:
                     key, val = msg.split(':', 1)
                     self.instance.metadata[key] = val.strip()
@@ -1487,7 +1517,11 @@
             file (optional, default: ``False``).
         """
         self.fhandle = open(mofile, 'rb')
-        self.instance = MOFile(
+
+        klass = kwargs.get('klass')
+        if klass is None:
+            klass = MOFile
+        self.instance = klass(
             fpath=mofile,
             encoding=kwargs.get('encoding', default_encoding),
             check_for_duplicates=kwargs.get('check_for_duplicates', False)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-0.7.0/tests/test_obsolete_previousmsgid.po 
new/polib-1.0.0/tests/test_obsolete_previousmsgid.po
--- old/polib-0.7.0/tests/test_obsolete_previousmsgid.po        1970-01-01 
01:00:00.000000000 +0100
+++ new/polib-1.0.0/tests/test_obsolete_previousmsgid.po        2012-06-08 
18:56:29.000000000 +0200
@@ -0,0 +1,44 @@
+# Evolution translation to Catalan.
+# Copyright © 2000, 2004, 2005, 2006 Free Software Foundation, Inc.
+# Softcatalà <[email protected]>, 2000, 2004-2006
+#
+# Víctor Nieto <[email protected]>
+# Aleix Badia i Bosch <[email protected]>, 2004
+# Xavier Conde Rueda <[email protected]>, 2004-2007
+# Francesc Dorca <[email protected]>, 2004
+# Jordi Mas <[email protected]>, 2004-2007
+# Enric Balletbò i Serra <[email protected]>, 2004
+# Gil Forcada <[email protected]>, 2006, 2011.
+# David Planella Molas <[email protected]>, 2007, 2008, 2009, 2010, 
2011, 2012.
+# Jordi Serratosa <[email protected]>, 2012.
+#
+#: ../shell/main.c:573
+msgid ""
+msgstr ""
+"Project-Id-Version: evolution\n"
+"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?";
+"product=evolution&keywords=I18N+L10N&component=Miscellaneous\n"
+"POT-Creation-Date: 2012-06-04 00:00+0000\n"
+"PO-Revision-Date: 2012-03-18 13:14+0100\n"
+"Last-Translator: David Planella <[email protected]>\n"
+"Language-Team: Catalan <[email protected]>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bits\n"
+"Language: ca\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+
+#: ../addressbook/addressbook.error.xml.h:1
+msgid "This address book could not be opened."
+msgstr "No s'ha pogut obrir aquesta llibreta d'adreces."
+
+#, fuzzy
+#~| msgid ""
+#~| "Error on %s\n"
+#~| "%s"
+#~ msgid ""
+#~ "Error on %s: %s\n"
+#~ "%s"
+#~ msgstr ""
+#~ "S'ha produït un error en %s:\n"
+#~ "%s"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-0.7.0/tests/test_unusual_metadata_location.po 
new/polib-1.0.0/tests/test_unusual_metadata_location.po
--- old/polib-0.7.0/tests/test_unusual_metadata_location.po     1970-01-01 
01:00:00.000000000 +0100
+++ new/polib-1.0.0/tests/test_unusual_metadata_location.po     2012-06-07 
21:35:01.000000000 +0200
@@ -0,0 +1,17 @@
+# Po file where metadata is not located
+# in the first entry.
+# 
+msgid "foo"
+msgstr "foo"
+# 
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-02-08 16:57+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <[email protected]>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-0.7.0/tests/test_weird_occurrences.po 
new/polib-1.0.0/tests/test_weird_occurrences.po
--- old/polib-0.7.0/tests/test_weird_occurrences.po     2011-07-13 
14:18:07.000000000 +0200
+++ new/polib-1.0.0/tests/test_weird_occurrences.po     2011-10-31 
08:42:06.000000000 +0100
@@ -14,6 +14,13 @@
 "X-Etoys-Domain: etoys\n"
 "X-Etoys-SystemVersion: etoys3.0 of 24 February 2008 update 2029\n"
 
+#. Test for empty comment lines
+#. 
+#,
+#: main.c:117
+msgid "Override the default prgname"
+msgstr "Override the default prgname"
+
 #: Balloon-Fills,BitmapFillStyle>>addFillStyleMenuItems:hand:from:
 msgid "choose new graphic"
 msgstr "escolher novo gráfico"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/polib-0.7.0/tests/tests.py 
new/polib-1.0.0/tests/tests.py
--- old/polib-0.7.0/tests/tests.py      2011-07-14 13:09:10.000000000 +0200
+++ new/polib-1.0.0/tests/tests.py      2012-06-08 18:54:34.000000000 +0200
@@ -83,6 +83,86 @@
         po = polib.pofile('tests/test_iso-8859-15.po', encoding='iso-8859-15')
         self.assertTrue(po.encoding == 'iso-8859-15')
 
+    def test_pofile_and_mofile8(self):
+        """
+        Test that weird occurrences are correctly parsed.
+        """
+        po = polib.pofile('tests/test_weird_occurrences.po')
+        self.assertEqual(len(po), 46)
+
+    def test_pofile_and_mofile9(self):
+        """
+        Test that obsolete previous msgid are ignored
+        """
+        po = polib.pofile('tests/test_obsolete_previousmsgid.po')
+        self.assertTrue(isinstance(po, polib.POFile))
+
+    def test_unescaped_double_quote1(self):
+        """
+        Test that polib reports an error when unescaped double quote is found.
+        """
+        data = r'''
+msgid "Some msgid with \"double\" quotes"
+msgid "Some msgstr with "double\" quotes"
+'''
+        try:
+            po = polib.pofile(data)
+            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'
+            self.assertEqual(str(exc), msg)
+
+    def test_unescaped_double_quote2(self):
+        """
+        Test that polib reports an error when unescaped double quote is found.
+        """
+        data = r'''
+msgid "Some msgid with \"double\" quotes"
+msgstr ""
+"Some msgstr with "double\" quotes"
+'''
+        try:
+            po = polib.pofile(data)
+            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'
+            self.assertEqual(str(exc), msg)
+
+    def test_unescaped_double_quote3(self):
+        """
+        Test that polib reports an error when unescaped double quote is found 
at the beginning of the string.
+        """
+        data = r'''
+msgid "Some msgid with \"double\" quotes"
+msgid ""Some msgstr with double\" quotes"
+'''
+        try:
+            po = polib.pofile(data)
+            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'
+            self.assertEqual(str(exc), msg)
+
+    def test_unescaped_double_quote4(self):
+        """
+        Test that polib reports an error when unescaped double quote is found 
at the beginning of the string.
+        """
+        data = r'''
+msgid "Some msgid with \"double\" quotes"
+msgstr ""
+""Some msgstr with double\" quotes"
+'''
+        try:
+            po = polib.pofile(data)
+            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'
+            self.assertEqual(str(exc), msg)
+    
     def test_detect_encoding1(self):
         """
         Test that given enconding is returned when file has no encoding 
defined.
@@ -146,6 +226,28 @@
             polib.unescape('\\\\t and \\\\n and \\\\r and \\\\" and \\\\\\\\'),
             '\\t and \\n and \\r and \\" and \\\\'
         )
+        
+    def test_pofile_with_subclass(self):
+        """
+        Test that the pofile function correctly returns an instance of the 
+        passed in class
+        """
+        class CustomPOFile(polib.POFile):
+            pass
+        
+        pofile = polib.pofile('tests/test_indented.po', klass=CustomPOFile)
+        self.assertEqual(pofile.__class__, CustomPOFile)
+        
+    def test_mofile_with_subclass(self):
+        """
+        Test that the mofile function correctly returns an instance of the 
+        passed in class
+        """
+        class CustomMOFile(polib.MOFile):
+            pass
+        
+        mofile = polib.mofile('tests/test_utf8.mo', klass=CustomMOFile)
+        self.assertEqual(mofile.__class__, CustomMOFile)     
 
 
 class TestBaseFile(unittest.TestCase):
@@ -336,7 +438,7 @@
 
 class TestPoFile(unittest.TestCase):
     """
-    Tests for MoFile class.
+    Tests for PoFile class.
     """
 
     def test_save_as_mofile(self):
@@ -394,6 +496,10 @@
         po = polib.pofile('tests/test_pofile_helpers.po')
         self.assertEqual(len(po.obsolete_entries()), 4)
 
+    def test_unusual_metadata_location(self):
+        po = polib.pofile('tests/test_unusual_metadata_location.po')
+        self.assertNotEqual(po.metadata, {})
+        self.assertEqual(po.metadata['Content-Type'], 'text/plain; 
charset=UTF-8')
 
 class TestMoFile(unittest.TestCase):
     """

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to