diff --git a/.gitignore b/.gitignore index e86a6fe..1a39388 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ mwclient-0.6.5.zip /v0.7.1.tar.gz /v0.7.2.tar.gz /mwclient-0.8.0.tar.gz +/mwclient-0.8.1.tar.gz diff --git a/0001-106-fix-GeneratorList-with-Python-3-add-__next__.patch b/0001-106-fix-GeneratorList-with-Python-3-add-__next__.patch deleted file mode 100644 index b6bd915..0000000 --- a/0001-106-fix-GeneratorList-with-Python-3-add-__next__.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 7522c02b6e893fc49309a5d550d68733477af83c Mon Sep 17 00:00:00 2001 -From: Adam Williamson -Date: Wed, 3 Feb 2016 05:48:53 +0100 -Subject: [PATCH] [#106] fix GeneratorList with Python 3 (add __next__) - -Credit for this fix goes to @tosher: -https://github.com/mwclient/mwclient/issues#issuecomment-154751657 -I just figured out exactly what changes his comment suggested, -and poked around a bit to figure out what was going on and why -they're needed. - -`GeneratorList` (and things deriving from it, e.g. `Category`) -was broken for iteration purposes in Python 3. In Python 3 -the iterator protocol requires a `__next__` method, not a `next` -method as in Python 2. 8d0650c renamed `List`'s `next` method -to `__next__` and added a small wrapper `next` method to account -for this, but did not make the same change for `GeneratorList`. -So when you iterate over a `GeneratorList` with Python 3, it -winds up calling `List.__next__` (since `GeneratorList` inherits -from `List`), not `GeneratorList.next`. So we don't hit the bit -that turns the results into mwclient page objects, and just get -the raw dicts from the `List` method. - -We also have to change a couple of direct calls to `List.next` -to call `List.__next__` instead. If we don't do this, then when -the call originates from a child class, things get messed up, -because `List.next` calls `self.__next__` - and that will wind -up calling the child class' `__next__`, not `List`'s `__next__`. - -Confused yet? :) ---- - mwclient/listing.py | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/mwclient/listing.py b/mwclient/listing.py -index 656df70..07ffd17 100644 ---- a/mwclient/listing.py -+++ b/mwclient/listing.py -@@ -57,7 +57,7 @@ class List(object): - if self.last: - raise StopIteration - self.load_chunk() -- return List.next(self, full=full) -+ return List.__next__(self, full=full) - - def next(self, full=False): - """ For Python 2.x support """ -@@ -139,14 +139,18 @@ class GeneratorList(List): - - self.page_class = mwclient.page.Page - -- def next(self): -- info = List.next(self, full=True) -+ def __next__(self): -+ info = List.__next__(self, full=True) - if info['ns'] == 14: - return Category(self.site, u'', info) - if info['ns'] == 6: - return mwclient.image.Image(self.site, u'', info) - return mwclient.page.Page(self.site, u'', info) - -+ def next(self): -+ """ For Python 2.x support """ -+ return self.__next__() -+ - def load_chunk(self): - # Put this here so that the constructor does not fail - # on uninitialized sites --- -2.5.0 - diff --git a/0001-use-exec-in-py3-compatible-manner.patch b/0001-use-exec-in-py3-compatible-manner.patch deleted file mode 100644 index 08df20c..0000000 --- a/0001-use-exec-in-py3-compatible-manner.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 5de1bb82465d39962e26175c62f644a3e423d030 Mon Sep 17 00:00:00 2001 -From: Adam Williamson -Date: Thu, 21 Jan 2016 17:21:52 -0800 -Subject: [PATCH] use 'exec' in py3-compatible manner - -per https://docs.python.org/2/reference/simple_stmts.html , -as exec is a function not a statement in py3, the py2 version -has been set to allow the subsequent statement to be a tuple, -so we can invoke it like this to make it both py2 and py3 -compatible. Without this, byte-compiling the file fails under -py3. ---- - mwclient/ex.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/mwclient/ex.py b/mwclient/ex.py -index db4006c..c0b1eae 100644 ---- a/mwclient/ex.py -+++ b/mwclient/ex.py -@@ -12,7 +12,7 @@ def read_config(config_files, **predata): - - def _read_config_file(_config_file, predata): - _file = open(_config_file) -- exec _file in globals(), predata -+ exec(_file, globals(), predata) - _file.close() - - for _k, _v in predata.iteritems(): --- -2.7.0 - diff --git a/python-mwclient.spec b/python-mwclient.spec index aa1eaeb..a752d32 100644 --- a/python-mwclient.spec +++ b/python-mwclient.spec @@ -11,30 +11,24 @@ %global github_owner mwclient %global github_name mwclient -%global github_commit 5fa50d4df1324ef678d58c625314e53bb229c594 +%global github_commit 3f5898345059985e9f331ae16bf9f5d6d86edf80 Name: python-mwclient -Version: 0.8.0 -Release: 3%{?dist} +Version: 0.8.1 +Release: 1%{?dist} Summary: Mwclient is a client to the MediaWiki API Group: System Environment/Libraries License: MIT URL: https://github.com/%{github_owner}/%{github_name} Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{github_name}-%{version}.tar.gz -# https://github.com/mwclient/mwclient/pull/107 -# Fixes a py3-incompatible invocation of exec -Patch0: 0001-use-exec-in-py3-compatible-manner.patch -# Fix iteration of categories (and a few other things) with Python 3 -# https://github.com/mwclient/mwclient/pull/108 -Patch1: 0001-106-fix-GeneratorList-with-Python-3-add-__next__.patch BuildArch: noarch BuildRequires: python2-devel # For EPEL BuildRequires: python-setuptools # For tests, python-responses only available for Fedora >= 23 -# python-funcsigs update pending for F23, switch to >= 22 when it's there +# python-funcsigs update pending for F23, switch to >= 23 when it's there %if 0%{?fedora} > 23 BuildRequires: python2-pytest # Provides: python2-pytest-pep8 missing @@ -101,8 +95,6 @@ provides access to most API functionality. This is the Python 3 build of %prep # autosetup isn't available on epel6 yet %setup -q -n %{github_name}-%{github_commit} -%patch0 -p1 -b .execpy3 -%patch1 -p1 -b .iteratepy3 %build @@ -142,6 +134,10 @@ provides access to most API functionality. This is the Python 3 build of %changelog +* Mon Feb 29 2016 Adam Williamson - 0.8.1-1 +- new release 0.8.1 +- drop patches merged upstream + * Tue Feb 16 2016 Adam Williamson - 0.8.0-3 - enable tests on Fedora > 23 (deps now available) diff --git a/sources b/sources index bd36e5b..b893e7f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -39ada07fd0dbc62a8fc061fa1efb71b1 mwclient-0.8.0.tar.gz +fba2c75f9f38d1a3ffeb76f34d7d8dcb mwclient-0.8.1.tar.gz