[arch-commits] Commit in python-tox/trunk (2 files)
Eli Schwartz
eschwartz at archlinux.org
Sun Nov 15 22:16:15 UTC 2020
Date: Sunday, November 15, 2020 @ 22:16:14
Author: eschwartz
Revision: 754850
upgpkg: python-tox 3.20.1-4: remove python-pathlib2 checkdep
projects should never use it on python3, let's patch them
Patch is merged upstream in https://github.com/tox-dev/tox/pull/1739 but I
cannot download it because it doesn't apply.
For reasons defying logic the PyPI tarball has both trailing whitespace and
spaces converted to tabs in the distributed setup.cfg and thus differs from the
github patch.
Added:
python-tox/trunk/0001-tests-do-not-depend-on-pathlib2-for-modern-python-17.patch
Modified:
python-tox/trunk/PKGBUILD
-----------------------------------------------------------------+
0001-tests-do-not-depend-on-pathlib2-for-modern-python-17.patch | 172 ++++++++++
PKGBUILD | 18 -
2 files changed, 183 insertions(+), 7 deletions(-)
Added: 0001-tests-do-not-depend-on-pathlib2-for-modern-python-17.patch
===================================================================
--- 0001-tests-do-not-depend-on-pathlib2-for-modern-python-17.patch (rev 0)
+++ 0001-tests-do-not-depend-on-pathlib2-for-modern-python-17.patch 2020-11-15 22:16:14 UTC (rev 754850)
@@ -0,0 +1,172 @@
+From 05230749a23ea0396b22bbcfedb6e7e0526173fe Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <eschwartz93 at gmail.com>
+Date: Fri, 13 Nov 2020 05:02:18 -0500
+Subject: [PATCH] tests: do not depend on pathlib2 for modern python (#1739)
+
+Try pathlib and fall back to pathlib2.
+
+The latter is technically installable on python 3.4+, but does nothing
+the stdlib doesn't do better. And in tightly constrained build
+environments, e.g. distro packaging, any dependency or test dependency
+must be a system package, but old, python2-specific backports of the
+stdlib might not actually be packaged...
+
+Make the job of distro packagers easier by not requiring patches to use
+pathlib while testing python3.
+
+Fixes #1549
+
+re-apply patch onto the PyPI tarball, because for reasons defying logic
+the PyPI tarball has both trailing whitespace and spaces converted to
+tabs in the distributed setup.cfg
+---
+ setup.cfg | 2 +-
+ tests/integration/test_package_int.py | 6 +++++-
+ tests/integration/test_parallel_interrupt.py | 6 +++++-
+ tests/integration/test_provision_int.py | 6 +++++-
+ tests/unit/package/test_package.py | 11 ++++++++---
+ tests/unit/session/test_provision.py | 7 ++++++-
+ tests/unit/test_z_cmdline.py | 7 +++++--
+ 7 files changed, 35 insertions(+), 10 deletions(-)
+
+diff --git a/setup.cfg b/setup.cfg
+index 1b98a99..9885f6f 100644
+--- a/setup.cfg
++++ b/setup.cfg
+@@ -61,13 +61,13 @@ docs =
+ testing =
+ flaky>=3.4.0
+ freezegun>=0.3.11
+- pathlib2>=2.3.3
+ psutil>=5.6.1
+ pytest>=4.0.0
+ pytest-cov>=2.5.1
+ pytest-mock>=1.10.0
+ pytest-randomly>=1.0.0
+ pytest-xdist>=1.22.2
++ pathlib2>=2.3.3;python_version<"3.4"
+
+ [options.packages.find]
+ where = src
+diff --git a/tests/integration/test_package_int.py b/tests/integration/test_package_int.py
+index b4d221a..01c59f6 100644
+--- a/tests/integration/test_package_int.py
++++ b/tests/integration/test_package_int.py
+@@ -4,7 +4,11 @@ import subprocess
+ import sys
+
+ import pytest
+-from pathlib2 import Path
++
++if sys.version_info[:2] >= (3, 4):
++ from pathlib import Path
++else:
++ from pathlib2 import Path
+
+ from tests.lib import need_git
+
+diff --git a/tests/integration/test_parallel_interrupt.py b/tests/integration/test_parallel_interrupt.py
+index b21bfac..b89072a 100644
+--- a/tests/integration/test_parallel_interrupt.py
++++ b/tests/integration/test_parallel_interrupt.py
+@@ -7,7 +7,11 @@ from datetime import datetime
+
+ import pytest
+ from flaky import flaky
+-from pathlib2 import Path
++
++if sys.version_info[:2] >= (3, 4):
++ from pathlib import Path
++else:
++ from pathlib2 import Path
+
+ from tox.constants import INFO
+ from tox.util.main import MAIN_FILE
+diff --git a/tests/integration/test_provision_int.py b/tests/integration/test_provision_int.py
+index a7683b0..0ae411b 100644
+--- a/tests/integration/test_provision_int.py
++++ b/tests/integration/test_provision_int.py
+@@ -4,7 +4,11 @@ import sys
+ import time
+
+ import pytest
+-from pathlib2 import Path
++
++if sys.version_info[:2] >= (3, 4):
++ from pathlib import Path
++else:
++ from pathlib2 import Path
+
+ from tox.constants import INFO
+ from tox.util.main import MAIN_FILE
+diff --git a/tests/unit/package/test_package.py b/tests/unit/package/test_package.py
+index d546ecc..5a196d5 100644
+--- a/tests/unit/package/test_package.py
++++ b/tests/unit/package/test_package.py
+@@ -132,12 +132,17 @@ def test_build_backend_without_submodule(initproj, cmd):
+ # To trigger original bug, must be package with __init__.py
+ "inline_backend": {
+ "__init__.py": """\
++ import sys
+ def get_requires_for_build_sdist(*args, **kwargs):
+- return ["pathlib2"]
++ return ["pathlib2;python_version<'3.4'"]
+
+ def build_sdist(sdist_directory, config_settings=None):
+- import pathlib2
+- (pathlib2.Path(sdist_directory) / "magic-0.1.0.tar.gz").touch()
++ if sys.version_info[:2] >= (3, 4):
++ import pathlib
++ else:
++ import pathlib2 as pathlib
++
++ (pathlib.Path(sdist_directory) / "magic-0.1.0.tar.gz").touch()
+ return "magic-0.1.0.tar.gz"
+ """,
+ },
+diff --git a/tests/unit/session/test_provision.py b/tests/unit/session/test_provision.py
+index ffc2c20..3065932 100644
+--- a/tests/unit/session/test_provision.py
++++ b/tests/unit/session/test_provision.py
+@@ -7,7 +7,12 @@ import sys
+
+ import py
+ import pytest
+-from pathlib2 import Path
++
++if sys.version_info[:2] >= (3, 4):
++ from pathlib import Path
++else:
++ from pathlib2 import Path
++
+ from six.moves.urllib.parse import urljoin
+ from six.moves.urllib.request import pathname2url
+
+diff --git a/tests/unit/test_z_cmdline.py b/tests/unit/test_z_cmdline.py
+index 8a641f8..ec50b55 100644
+--- a/tests/unit/test_z_cmdline.py
++++ b/tests/unit/test_z_cmdline.py
+@@ -6,7 +6,10 @@ import subprocess
+ import sys
+ import tempfile
+
+-import pathlib2
++if sys.version_info[:2] >= (3, 4):
++ import pathlib
++else:
++ import pathlib2 as pathlib
+ import py
+ import pytest
+
+@@ -462,7 +465,7 @@ def test_no_setup_py_exits_but_pyproject_toml_does(cmd, initproj):
+ },
+ )
+ os.remove("setup.py")
+- pathlib2.Path("pyproject.toml").touch()
++ pathlib.Path("pyproject.toml").touch()
+ result = cmd()
+ result.assert_fail()
+ assert any(
+--
+2.29.2
+
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2020-11-15 22:14:49 UTC (rev 754849)
+++ PKGBUILD 2020-11-15 22:16:14 UTC (rev 754850)
@@ -6,7 +6,7 @@
pkgbase=python-tox
pkgname=(python-tox python2-tox)
pkgver=3.20.1
-pkgrel=3
+pkgrel=4
pkgdesc='Python virtualenv management and testing tool'
arch=('any')
url='https://tox.readthedocs.io'
@@ -15,17 +15,21 @@
'python2-virtualenv' 'python-pluggy' 'python2-pluggy' 'python-toml' 'python2-toml'
'python-filelock' 'python2-filelock' 'python-freezegun' 'python2-freezegun')
checkdepends=('python-pytest-runner' 'python2-pytest-runner' 'python-pytest-mock'
- 'python2-pytest-mock' 'python2-pathlib2' 'python-flaky' 'python2-flaky'
- 'python-pathlib2' 'python2-pathlib2')
-source=("https://pypi.io/packages/source/t/tox/tox-$pkgver.tar.gz")
-sha512sums=('73d6b6ca98cc9de628038360fe0af50ecfac1e7949735fde49fd38d85c9fcc517d897eeb287da0388265e689941ef3b63956349b4be409197a164039cb1ba1ae')
+ 'python2-pytest-mock' 'python-flaky' 'python2-flaky' 'python2-pathlib2')
+source=("https://pypi.io/packages/source/t/tox/tox-$pkgver.tar.gz"
+ "0001-tests-do-not-depend-on-pathlib2-for-modern-python-17.patch")
+sha512sums=('73d6b6ca98cc9de628038360fe0af50ecfac1e7949735fde49fd38d85c9fcc517d897eeb287da0388265e689941ef3b63956349b4be409197a164039cb1ba1ae'
+ '602fff6eea913455e9b8ce7196d154960a4916bc395a99ed2660491134fbb3b48d6bbd30cbaf62b693ad0efdd50d78ca79ea72aa6162801c8d78543da5e36393')
prepare() {
find tox-$pkgver -name "*.pyc" -delete
+ # do not depend on pathlib2 on python3: https://github.com/tox-dev/tox/pull/1739
+ cd "$srcdir"/tox-$pkgver
+ patch -p1 -i ../0001-tests-do-not-depend-on-pathlib2-for-modern-python-17.patch
+ cd ..
+
cp -a tox-$pkgver{,-py2}
-
- sed -i 's|pathlib2|pathlib|' tox-$pkgver/tests/integration/*.py
}
build() {
More information about the arch-commits
mailing list