From 12556cd8227feafad2ef89ab3bdaca5aaf2a67ba Mon Sep 17 00:00:00 2001 From: Ding-Yi Chen Date: Jul 16 2013 03:57:22 +0000 Subject: Upstream update python-polib-1.0.3 --- diff --git a/.gitignore b/.gitignore index ad516c1..96ce5c0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ polib-0.5.1.tar.gz /polib-0.7.0.tar.gz /polib-1.0.0.tar.gz +/polib-1.0.3.tar.gz diff --git a/polib-0.7.0_dbafdc621bf4.patch b/polib-0.7.0_dbafdc621bf4.patch deleted file mode 100644 index 3917fb6..0000000 --- a/polib-0.7.0_dbafdc621bf4.patch +++ /dev/null @@ -1,261 +0,0 @@ -diff -r f3b365199366 docs/conf.py ---- a/docs/conf.py Thu Jul 14 14:34:23 2011 +0200 -+++ b/docs/conf.py Tue Nov 01 13:31:57 2011 +1000 -@@ -13,16 +13,18 @@ - - import sys, os - - # If extensions (or modules to document with autodoc) are in another directory, - # add these directories to sys.path here. If the directory is relative to the - # 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. - #needs_sphinx = '1.0' - - # Add any Sphinx extension module names here, as strings. They can be extensions - # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. - extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.viewcode'] -@@ -43,19 +45,19 @@ master_doc = 'index' - project = u'polib' - copyright = u'2011, David Jean Louis ' - - # The version info for the project you're documenting, acts as replacement for - # |version| and |release|, also used in various other places throughout the - # 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. - #language = None - - # There are two options for replacing |today|: either, you set today to some - # non-false value, then it is used: - #today = '' -diff -r f3b365199366 polib.py ---- a/polib.py Thu Jul 14 14:34:23 2011 +0200 -+++ b/polib.py Tue Nov 01 13:31:57 2011 +1000 -@@ -1181,78 +1181,91 @@ class _POFileParser(object): - self.entry_obsolete = 1 - else: - self.entry_obsolete = 0 - - # Take care of keywords like - # 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 - - self.current_token = line - - if tokens[0] == '#:' and nb_tokens > 1: - # we are on a occurrences line - self.process('OC', i) - - 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) - - elif tokens[0] == '#': - if line == '#': line += ' ' - # 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() - self.current_token = line - - if tokens[1].startswith('"'): - # Continuation of previous metadata. - self.process('MC', i) - continue - - 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. - line = line[len(tokens[1]):].lstrip() - self.current_token = line - 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 - # the last entry here (only if there are lines) - 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] -diff -r f3b365199366 tests/test_weird_occurrences.po ---- a/tests/test_weird_occurrences.po Thu Jul 14 14:34:23 2011 +0200 -+++ b/tests/test_weird_occurrences.po Tue Nov 01 13:31:57 2011 +1000 -@@ -9,16 +9,23 @@ msgstr "" - "MIME-Version: 1.0\n" - "Content-Type: text/plain; charset=UTF-8\n" - "Content-Transfer-Encoding: 8bit\n" - "X-Generator: Pootle 1.1.0rc2\n" - "X-Launchpad-Export-Date: 2007-12-03 23:40+0000\n" - "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" - - #: Balloon-Fills,BitmapFillStyle>>addFillStyleMenuItems:hand:from: - msgid "grab new graphic" - msgstr "agarrar novo gráfico" - -diff -r f3b365199366 tests/tests.py ---- a/tests/tests.py Thu Jul 14 14:34:23 2011 +0200 -+++ b/tests/tests.py Tue Nov 01 13:31:57 2011 +1000 -@@ -78,16 +78,84 @@ msgstr "bar" - - def test_pofile_and_mofile7(self): - """ - Test that encoding is ok when encoding is explicitely given. - """ - 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_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: -+ 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: -+ 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: -+ msg = 'Syntax error in po file None (line 3): unescaped double quote found' -+ -+ 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: -+ 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. - """ - self.assertEqual(polib.detect_encoding('tests/test_noencoding.po'), 'utf-8') - - def test_detect_encoding2(self): - """ diff --git a/python-polib.spec b/python-polib.spec index 9706493..177e920 100644 --- a/python-polib.spec +++ b/python-polib.spec @@ -3,8 +3,8 @@ #%define alphatag r60 Name: python-polib -Version: 1.0.0 -Release: 2%{?dist} +Version: 1.0.3 +Release: 1%{?dist} Summary: A library to parse and manage gettext catalogs Group: Development/Languages @@ -47,6 +47,22 @@ rm -rf $RPM_BUILD_ROOT %{python_sitelib}/* %changelog +* Tue Jul 16 2013 Ding-Yi Chen - 1.0.3-1 +- Upstream update to 1.0.3 +- Version 1.0.3 (2013/02/09) + Fixed issue #38: POFile.append() raised a duplicate exception when you tried to add a new entry with the same msgid and a different msgctxt (only when check_for_duplicates option is set to True) + 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 + +- Version 1.0.2 (2012/10/23) + allow empty comments, flags or occurences lines + +- Version 1.0.1 (2012/09/11) + speed up POFile.merge method (thanks @encukou) + allow comments starting with two '#' characters (thanks @goibhniu) + * Thu Feb 14 2013 Fedora Release Engineering - 1.0.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild diff --git a/sources b/sources index ffc4e88..ce1b95b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -62a7662c3fd3eddcabba61107b6baae3 polib-1.0.0.tar.gz +dc9dc39d4053cfe030155891f3043cb1 polib-1.0.3.tar.gz