diff options
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | debian/.git-dpm | 8 | ||||
-rw-r--r-- | debian/changelog | 32 | ||||
-rw-r--r-- | debian/clean | 2 | ||||
-rw-r--r-- | debian/compat | 2 | ||||
-rw-r--r-- | debian/control | 31 | ||||
-rw-r--r-- | debian/copyright | 12 | ||||
-rw-r--r-- | debian/patches/0001-set-message_id-properly-in-expat-parser.patch | 26 | ||||
-rw-r--r-- | debian/patches/0002-enable-use_2to3-in-setup.py.patch | 22 | ||||
-rw-r--r-- | debian/patches/0003-give-lxml-etree-BytesIO-in-Python-3.patch | 42 | ||||
-rw-r--r-- | debian/patches/auto-gitignore | 22 | ||||
-rw-r--r-- | debian/patches/series | 4 | ||||
-rwxr-xr-x | debian/rules | 9 | ||||
-rw-r--r-- | debian/source/options | 1 | ||||
-rw-r--r-- | debian/watch | 4 | ||||
-rw-r--r-- | pynzb/expat_nzb.py | 2 | ||||
-rw-r--r-- | pynzb/lxml_nzb.py | 16 | ||||
-rw-r--r-- | setup.py | 3 |
18 files changed, 214 insertions, 32 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..67e95ff --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +build/ +debian/files +debian/python-pynzb.debhelper.log +debian/python-pynzb.postinst.debhelper +debian/python-pynzb.prerm.debhelper +debian/python-pynzb.substvars +debian/python-pynzb/ +pynzb.egg-info/ diff --git a/debian/.git-dpm b/debian/.git-dpm new file mode 100644 index 0000000..9ae02eb --- /dev/null +++ b/debian/.git-dpm @@ -0,0 +1,8 @@ +# see git-dpm(1) from git-dpm package +bb4f526aa0b6664b45d38c64b546e783407034b6 +bb4f526aa0b6664b45d38c64b546e783407034b6 +124074ce42e5d83c71e028a8757afb392cc96548 +124074ce42e5d83c71e028a8757afb392cc96548 +python-pynzb_0.1.0.orig.tar.gz +cf39d7f32c15f281ab81b0043b4068d101a2cd1f +5598 diff --git a/debian/changelog b/debian/changelog index 3524f78..c10e6b0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,35 @@ +python-pynzb (0.1.0-3) unstable; urgency=medium + + * Add myself to uploaders. + * Switch to pybuild and dh-python. + * Bump d/compat to 10 and update version of B-D on debhelper. + * Bump standards-version to 3.9.8 (no changes). + * d/copyright: add myself and fix license short names: + - "public domain" -> public-domain, + - BSD -> BSD-3-clause. + * Change Vcs to DPMT git repository and use https. + * Change Homepage to Github. + * Build the Python 3 module. + - replace B-D: python{,3}-setuptools and python{,3}-all + * Drop the Python 2 module (no rdeps): + * Run the test suite with pytest: + - cleanup the produced .cache/ in d/clean, + - add B-D on python3-pytest. + * 0001-set-message_id-properly-in-expat-parser.patch: fix an upstream code + typo. This change allows the tests to pass for Python 2. + * 0002-enable-use_2to3-in-setup.py.patch: enable 2to3 invocation in setup.py. + * Move lxml to Suggests rather than Depends since there are fallbacks using + standard library XML parsers. + * Build-Depend on lxml in order to run the test for the implementation of the + NZB parser using lxml (LXMLNZBParser). + * 0003-give-lxml-etree-BytesIO-in-Python-3.patch: make the code Python 3 + compatible by decoding strings -> bytes as UTF-8 and substituting BytesIO + for StringIO. This only affects the LXMLNZPParser. + * Fix watch file and declare version 4 format. + * Cleanup .egg-info files in d/clean and d/source/options. + + -- Carl Suster <carl@contraflo.ws> Thu, 12 Jan 2017 12:30:23 +1100 + python-pynzb (0.1.0-2) unstable; urgency=low * use https:// URL for pypi in debian/watch diff --git a/debian/clean b/debian/clean new file mode 100644 index 0000000..739fbc2 --- /dev/null +++ b/debian/clean @@ -0,0 +1,2 @@ +*.egg-info/* +.cache/ diff --git a/debian/compat b/debian/compat index 7f8f011..f599e28 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -7 +10 diff --git a/debian/control b/debian/control index 09440ee..f5307e0 100644 --- a/debian/control +++ b/debian/control @@ -1,21 +1,26 @@ Source: python-pynzb Maintainer: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org> -Uploaders: Hans-Christoph Steiner <hans@eds.org> +Uploaders: + Hans-Christoph Steiner <hans@eds.org>, + Carl Suster <carl@contraflo.ws> Section: python Priority: optional -Build-Depends: python-setuptools (>= 0.6b3), - python-all (>= 2.6.6-3), - debhelper (>= 7) -Standards-Version: 3.9.4 -Homepage: https://pypi.python.org/pypi/pynzb/ -Vcs-Git: git://anonscm.debian.org/collab-maint/python-pynzb.git -Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/python-pynzb.git +Build-Depends: + debhelper (>= 10), + dh-python, + python3-all, + python3-lxml, + python3-pytest, + python3-setuptools, +Standards-Version: 3.9.8 +Homepage: https://github.com/ericflo/pynzb +Vcs-Git: https://anonscm.debian.org/git/python-modules/packages/python-pynzb.git +Vcs-Browser: https://anonscm.debian.org/git/python-modules/packages/python-pynzb.git -Package: python-pynzb +Package: python3-pynzb Architecture: all -Depends: ${misc:Depends}, - ${python:Depends}, - python-lxml +Depends: ${misc:Depends}, ${python3:Depends} +Suggests: python3-lxml Description: unified API for parsing NZB files from NNTP (Usenet) servers pynzb is a unified API for parsing NZB files, with several concrete implementations included. @@ -33,3 +38,5 @@ Description: unified API for parsing NZB files from NNTP (Usenet) servers . Simply import nzb_parser from the pynzb package. It's an instantiated version of the fastest available parser that your system can support. + . + This package provides the Python 3 module. diff --git a/debian/copyright b/debian/copyright index 1a95484..563a0bf 100644 --- a/debian/copyright +++ b/debian/copyright @@ -4,14 +4,15 @@ Upstream-Contact: Eric Florenzano <floguy@gmail.com> Source: https://github.com/ericflo/pynzb Files: * -Copyright: 2009, Eric Florenzano -License: BSD +Copyright: 2009, Eric Florenzano <floguy@gmail.com> +License: BSD-3-clause Files: ./debian/* Copyright: 2012 Hans-Christoph Steiner <hans@eds.org> -License: public domain + 2017 Carl Suster <carl@contraflo.ws> +License: public-domain -License: BSD +License: BSD-3-clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -25,6 +26,5 @@ License: BSD may be used to endorse or promote products derived from this software without specific prior written permission. -License: public domain +License: public-domain I hereby release these files into the public domain. - diff --git a/debian/patches/0001-set-message_id-properly-in-expat-parser.patch b/debian/patches/0001-set-message_id-properly-in-expat-parser.patch new file mode 100644 index 0000000..90441ec --- /dev/null +++ b/debian/patches/0001-set-message_id-properly-in-expat-parser.patch @@ -0,0 +1,26 @@ +From 14d1c8d4ff4bbf5b942d553fa8638decef9f41c9 Mon Sep 17 00:00:00 2001 +From: Carl Suster <carl@contraflo.ws> +Date: Mon, 9 Jan 2017 11:57:13 +1100 +Subject: set message_id properly in expat parser + +Upstream had a typo in the expat parser wrapper which called the +non-existent message_id() when set_message_id() was intended. + +Forwarded: https://github.com/ericflo/pynzb/pull/4 +--- + pynzb/expat_nzb.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pynzb/expat_nzb.py b/pynzb/expat_nzb.py +index 5c1b096..313dee6 100644 +--- a/pynzb/expat_nzb.py ++++ b/pynzb/expat_nzb.py +@@ -22,7 +22,7 @@ class ExpatNZBParser(BaseNZBParser): + elif name == 'group': + self.current_file.add_group(self.current_data) + elif name == 'segment': +- self.current_segment.message_id(self.current_data) ++ self.current_segment.set_message_id(self.current_data) + self.current_file.add_segment(self.current_segment) + + def char_data(self, data): diff --git a/debian/patches/0002-enable-use_2to3-in-setup.py.patch b/debian/patches/0002-enable-use_2to3-in-setup.py.patch new file mode 100644 index 0000000..83e6bf7 --- /dev/null +++ b/debian/patches/0002-enable-use_2to3-in-setup.py.patch @@ -0,0 +1,22 @@ +From db99bb2f8b4bc56c6ba91d5dab84ec042bb777ec Mon Sep 17 00:00:00 2001 +From: Carl Suster <carl@contraflo.ws> +Date: Wed, 11 Jan 2017 22:23:32 +1100 +Subject: enable use_2to3 in setup.py + +Forwarded: https://github.com/ericflo/pynzb/pull/5 +--- + setup.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 0fd9d51..62f1ff3 100644 +--- a/setup.py ++++ b/setup.py +@@ -168,4 +168,5 @@ setup( + include_package_data=True, + zip_safe=False, + install_requires=['setuptools'], +-) +\ No newline at end of file ++ use_2to3=True, ++) diff --git a/debian/patches/0003-give-lxml-etree-BytesIO-in-Python-3.patch b/debian/patches/0003-give-lxml-etree-BytesIO-in-Python-3.patch new file mode 100644 index 0000000..7289d6a --- /dev/null +++ b/debian/patches/0003-give-lxml-etree-BytesIO-in-Python-3.patch @@ -0,0 +1,42 @@ +From bb4f526aa0b6664b45d38c64b546e783407034b6 Mon Sep 17 00:00:00 2001 +From: Carl Suster <carl@contraflo.ws> +Date: Wed, 11 Jan 2017 22:34:34 +1100 +Subject: give lxml etree BytesIO in Python 3 + +The lxml etree API changed in Python 3 to take BytesIO instead of +StringIO. This patch maintains the original behaviour in Python 2 but +switches to BytesIO in Python 3, decoding the XML data as UTF-8. + +Forwarded: https://github.com/ericflo/pynzb/pull/6 +--- + pynzb/lxml_nzb.py | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +diff --git a/pynzb/lxml_nzb.py b/pynzb/lxml_nzb.py +index 790671d..e74ba34 100644 +--- a/pynzb/lxml_nzb.py ++++ b/pynzb/lxml_nzb.py +@@ -6,11 +6,17 @@ except ImportError: + raise ImportError("You must have lxml installed before you can use the " + + "lxml NZB parser.") + +-try: +- from cStringIO import StringIO +-except ImportError: +- from StringIO import StringIO ++import sys ++if sys.version_info.major < 3: ++ try: ++ from cStringIO import StringIO ++ except ImportError: ++ from StringIO import StringIO ++ def as_io(xml): return StringIO(xml) ++else: ++ from io import BytesIO ++ def as_io(xml): return BytesIO(bytes(xml, 'utf-8')) + + class LXMLNZBParser(BaseETreeNZBParser): + def get_etree_iter(self, xml, et=etree): +- return iter(et.iterparse(StringIO(xml), events=("start", "end"))) +\ No newline at end of file ++ return iter(et.iterparse(as_io(xml), events=("start", "end"))) diff --git a/debian/patches/auto-gitignore b/debian/patches/auto-gitignore new file mode 100644 index 0000000..b5901bc --- /dev/null +++ b/debian/patches/auto-gitignore @@ -0,0 +1,22 @@ +Subject: Update .gitignore from Debian packaging branch + +The Debian packaging git branch contains these updates to the upstream +.gitignore file(s). This patch is autogenerated, to provide these +updates to users of the official Debian archive view of the package. + +[dgit (3.1) update-gitignore] +--- +diff --git a/.gitignore b/.gitignore +new file mode 100644 +index 0000000..67e95ff +--- /dev/null ++++ b/.gitignore +@@ -0,0 +1,8 @@ ++build/ ++debian/files ++debian/python-pynzb.debhelper.log ++debian/python-pynzb.postinst.debhelper ++debian/python-pynzb.prerm.debhelper ++debian/python-pynzb.substvars ++debian/python-pynzb/ ++pynzb.egg-info/ diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..dbaa22f --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,4 @@ +0001-set-message_id-properly-in-expat-parser.patch +0002-enable-use_2to3-in-setup.py.patch +0003-give-lxml-etree-BytesIO-in-Python-3.patch +auto-gitignore diff --git a/debian/rules b/debian/rules index d25abae..dee803d 100755 --- a/debian/rules +++ b/debian/rules @@ -1,9 +1,10 @@ #!/usr/bin/make -f +# export DH_VERBOSE=1 -# This file was automatically generated by stdeb 0.6.0+git at -# Mon, 16 Sep 2013 19:42:13 -0400 +export PYBUILD_NAME=pynzb -%: - dh $@ --with python2 --buildsystem=python_distutils +export PYBUILD_TEST_ARGS=pynzb/tests.py +%: + dh $@ --with python3 --buildsystem=pybuild diff --git a/debian/source/options b/debian/source/options new file mode 100644 index 0000000..b2b7b88 --- /dev/null +++ b/debian/source/options @@ -0,0 +1 @@ +extend-diff-ignore="^[^/]+\.egg-info/" diff --git a/debian/watch b/debian/watch index 6386c8a..62f8d47 100644 --- a/debian/watch +++ b/debian/watch @@ -1,2 +1,2 @@ -version=3 -https://pypi.python.org/packages/source/p/pynzb/pynzb-(.*).tar.gz +version=4 +https://pypi.python.org/packages/source/p/pynzb/pynzb-(.+)\.tar\.gz debian uupdate diff --git a/pynzb/expat_nzb.py b/pynzb/expat_nzb.py index 5c1b096..313dee6 100644 --- a/pynzb/expat_nzb.py +++ b/pynzb/expat_nzb.py @@ -22,7 +22,7 @@ class ExpatNZBParser(BaseNZBParser): elif name == 'group': self.current_file.add_group(self.current_data) elif name == 'segment': - self.current_segment.message_id(self.current_data) + self.current_segment.set_message_id(self.current_data) self.current_file.add_segment(self.current_segment) def char_data(self, data): diff --git a/pynzb/lxml_nzb.py b/pynzb/lxml_nzb.py index 790671d..e74ba34 100644 --- a/pynzb/lxml_nzb.py +++ b/pynzb/lxml_nzb.py @@ -6,11 +6,17 @@ except ImportError: raise ImportError("You must have lxml installed before you can use the " + "lxml NZB parser.") -try: - from cStringIO import StringIO -except ImportError: - from StringIO import StringIO +import sys +if sys.version_info.major < 3: + try: + from cStringIO import StringIO + except ImportError: + from StringIO import StringIO + def as_io(xml): return StringIO(xml) +else: + from io import BytesIO + def as_io(xml): return BytesIO(bytes(xml, 'utf-8')) class LXMLNZBParser(BaseETreeNZBParser): def get_etree_iter(self, xml, et=etree): - return iter(et.iterparse(StringIO(xml), events=("start", "end")))
\ No newline at end of file + return iter(et.iterparse(as_io(xml), events=("start", "end"))) @@ -168,4 +168,5 @@ setup( include_package_data=True, zip_safe=False, install_requires=['setuptools'], -)
\ No newline at end of file + use_2to3=True, +) |