diff --git a/0001-Switch-to-pycodestyle.patch b/0001-Switch-to-pycodestyle.patch new file mode 100644 index 0000000..322bbb6 --- /dev/null +++ b/0001-Switch-to-pycodestyle.patch @@ -0,0 +1,60 @@ +From 9df7ce8cd33c66fad2370df1a52835169ece4b4f Mon Sep 17 00:00:00 2001 +From: Orion Poplawski +Date: Thu, 9 May 2019 21:29:30 -0600 +Subject: [PATCH 1/3] Switch to pycodestyle + +--- + setup.cfg | 4 ++-- + setup.py | 2 +- + tox.ini | 6 +++--- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/setup.cfg b/setup.cfg +index 8b173f4..9e95b73 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -18,6 +18,6 @@ replace = version='{new_version}' + universal = 1 + + [tool:pytest] +-pep8ignore = E501 W602 +-addopts = -v --pep8 test mwclient --cov mwclient ++codestyle_ignore = E501 W602 ++addopts = -v --codestyle test mwclient --cov mwclient + +diff --git a/setup.py b/setup.py +index ec526b9..a3fc96f 100644 +--- a/setup.py ++++ b/setup.py +@@ -31,7 +31,7 @@ setup(name='mwclient', + packages=['mwclient'], + install_requires=['requests_oauthlib', 'six'], + setup_requires=pytest_runner, +- tests_require=['pytest', 'pytest-pep8', 'pytest-cache', 'pytest-cov', ++ tests_require=['pytest', 'pytest-codestyle', 'pytest-cache', 'pytest-cov', + 'responses>=0.3.0', 'responses!=0.6.0', 'mock'], + zip_safe=True + ) +diff --git a/tox.ini b/tox.ini +index b0acd46..06766cf 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -2,12 +2,12 @@ + envlist = py27,py34,py35,py36 + [testenv] + deps=pytest +- pytest-pep8 ++ pytest-codestyle + responses + mock +-commands=py.test -v --pep8 mwclient test ++commands=py.test -v --codestyle mwclient test + + [flake8] + max-line-length=90 +-[pep8] ++[codestyle] + max-line-length=90 +-- +2.22.0 + diff --git a/0001-setup.py-tests-don-t-require-flake8.patch b/0001-setup.py-tests-don-t-require-flake8.patch new file mode 100644 index 0000000..e25fb41 --- /dev/null +++ b/0001-setup.py-tests-don-t-require-flake8.patch @@ -0,0 +1,31 @@ +From f9715ec357db8e21ddb6bd124d4948459f144895 Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Wed, 26 Jun 2019 10:09:42 -0700 +Subject: [PATCH] setup.py: tests don't require flake8 + +`tests_require` should be the things required by `setup.py test`. +Our `test` invocation no longer runs the linter - it's set up +to be run by `tox`, `setup.py flake8` or just `flake8` - so it +should not be required here. + +Signed-off-by: Adam Williamson +--- + setup.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index de333b5..fb9d07f 100644 +--- a/setup.py ++++ b/setup.py +@@ -31,7 +31,7 @@ setup(name='mwclient', + packages=['mwclient'], + install_requires=['requests_oauthlib', 'six'], + setup_requires=pytest_runner, +- tests_require=['pytest', 'pytest-cov', 'flake8', ++ tests_require=['pytest', 'pytest-cov', + 'responses>=0.3.0', 'responses!=0.6.0', 'mock'], + zip_safe=True + ) +-- +2.22.0 + diff --git a/0002-pytest-cache-is-now-built-into-pytest.patch b/0002-pytest-cache-is-now-built-into-pytest.patch new file mode 100644 index 0000000..993e549 --- /dev/null +++ b/0002-pytest-cache-is-now-built-into-pytest.patch @@ -0,0 +1,25 @@ +From 540b0f90e70b23c25c2ed672472ac43a2a7d2ad9 Mon Sep 17 00:00:00 2001 +From: Orion Poplawski +Date: Thu, 9 May 2019 21:29:58 -0600 +Subject: [PATCH 2/3] pytest-cache is now built into pytest + +--- + setup.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index a3fc96f..4c80187 100644 +--- a/setup.py ++++ b/setup.py +@@ -31,7 +31,7 @@ setup(name='mwclient', + packages=['mwclient'], + install_requires=['requests_oauthlib', 'six'], + setup_requires=pytest_runner, +- tests_require=['pytest', 'pytest-codestyle', 'pytest-cache', 'pytest-cov', ++ tests_require=['pytest', 'pytest-codestyle', 'pytest-cov', + 'responses>=0.3.0', 'responses!=0.6.0', 'mock'], + zip_safe=True + ) +-- +2.22.0 + diff --git a/0003-Switch-to-flake8-for-linting.patch b/0003-Switch-to-flake8-for-linting.patch new file mode 100644 index 0000000..bf35cad --- /dev/null +++ b/0003-Switch-to-flake8-for-linting.patch @@ -0,0 +1,88 @@ +From 953370a44cc6d548bfece8a2bb3e4c97a64d8702 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Dan=20Michael=20O=2E=20Hegg=C3=B8?= +Date: Mon, 10 Jun 2019 14:41:18 +0200 +Subject: [PATCH 3/3] Switch to flake8 for linting + +--- + .travis.yml | 2 ++ + setup.cfg | 7 +++++-- + setup.py | 2 +- + tox.ini | 18 ++++++++++-------- + 4 files changed, 18 insertions(+), 11 deletions(-) + +diff --git a/.travis.yml b/.travis.yml +index f59f943..9504787 100644 +--- a/.travis.yml ++++ b/.travis.yml +@@ -17,9 +17,11 @@ matrix: + install: + - python setup.py install + - pip install coveralls ++ - pip install flake8 + + script: + - python setup.py test ++ - flake8 mwclient + + after_success: + - coveralls +diff --git a/setup.cfg b/setup.cfg +index 9e95b73..1095f38 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -18,6 +18,9 @@ replace = version='{new_version}' + universal = 1 + + [tool:pytest] +-codestyle_ignore = E501 W602 +-addopts = -v --codestyle test mwclient --cov mwclient ++addopts = --cov mwclient test + ++[flake8] ++ignore = ++ E501 # Line too long ++ W503 # Line break before binary operator +diff --git a/setup.py b/setup.py +index 4c80187..e108213 100644 +--- a/setup.py ++++ b/setup.py +@@ -31,7 +31,7 @@ setup(name='mwclient', + packages=['mwclient'], + install_requires=['requests_oauthlib', 'six'], + setup_requires=pytest_runner, +- tests_require=['pytest', 'pytest-codestyle', 'pytest-cov', ++ tests_require=['pytest', 'pytest-cov', 'flake8', + 'responses>=0.3.0', 'responses!=0.6.0', 'mock'], + zip_safe=True + ) +diff --git a/tox.ini b/tox.ini +index 06766cf..4554c67 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -1,13 +1,15 @@ + [tox] +-envlist = py27,py34,py35,py36 ++envlist = py27,py34,py35,py36,flake ++ + [testenv] +-deps=pytest +- pytest-codestyle ++deps = ++ pytest ++ pytest-cov + responses + mock +-commands=py.test -v --codestyle mwclient test + +-[flake8] +-max-line-length=90 +-[codestyle] +-max-line-length=90 ++[testenv:flake] ++deps = ++ flake8 ++commands = ++ flake8 mwclient +-- +2.22.0 + diff --git a/python-mwclient.spec b/python-mwclient.spec index 73932d6..37155b2 100644 --- a/python-mwclient.spec +++ b/python-mwclient.spec @@ -30,13 +30,21 @@ Name: python-mwclient Version: 0.9.3 -Release: 1%{?dist} +Release: 2%{?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/v%{version}.tar.gz +# Backports from master: migrate from pep8 to flake8 +Patch0: 0001-Switch-to-pycodestyle.patch +Patch1: 0002-pytest-cache-is-now-built-into-pytest.patch +Patch2: 0003-Switch-to-flake8-for-linting.patch +# Not yet upstreamed as I'm not sure of upstream's preferred solution +# yet: don't tests_require flake8 as setup.py test does not run it +# https://github.com/mwclient/mwclient/issues/226 +Patch3: 0001-setup.py-tests-don-t-require-flake8.patch BuildArch: noarch %description @@ -52,12 +60,14 @@ BuildRequires: python2-devel # For EPEL BuildRequires: python2-setuptools BuildRequires: python2-pytest -# Provides: python2-pytest-pep8 missing on < F26 -BuildRequires: python2-pytest-pep8 +# cache has been built into pytest since 2.8.0. Unfortunately, el7 +# has 2.7.0... +%if 0%{?rhel} < 8 # python2-pytest-cache provide doesn't exist on EPEL 7 and making it # happen is kind of a nightmare due to tricky arch issues with # eventlet/greenlet -BuildRequires: %{py2_prefix}-pytest-cache +BuildRequires: python-pytest-cache +%endif BuildRequires: python2-pytest-cov BuildRequires: python2-pytest-runner BuildRequires: python2-mock @@ -84,8 +94,11 @@ Obsoletes: python2-%{github_name} < %{version}-%{release} BuildRequires: python3-devel BuildRequires: python3-pytest -BuildRequires: python3-pytest-pep8 +# cache has been built into pytest since 2.8.0. Unfortunately, el7 +# has 2.7.0... +%if 0%{?rhel} < 8 BuildRequires: python3-pytest-cache +%endif BuildRequires: python3-pytest-cov BuildRequires: python3-pytest-runner BuildRequires: python3-mock @@ -148,6 +161,10 @@ provides access to most API functionality. This is the Python 3 build of %changelog +* Wed Jun 26 2019 Adam Williamson - 0.9.3-2 +- Backport a few patches to remove use of pep8 (being retired) +- Only BuildRequire pytest-cache on EL7, it is part of pytest since + * Fri Nov 23 2018 Adam Williamson - 0.9.3-1 - New release 0.9.3 - Disable Python 2 build on F30+ / RHEL 8+