diff --git a/0001-Remove-Python-version-management-on-Fedora.patch b/0001-Remove-Python-version-management-on-Fedora.patch index bdf24ee..67bdac7 100644 --- a/0001-Remove-Python-version-management-on-Fedora.patch +++ b/0001-Remove-Python-version-management-on-Fedora.patch @@ -1,7 +1,7 @@ -From e43b1f4a04e3b5ce841a0dbb125bc87fc330bc13 Mon Sep 17 00:00:00 2001 +From 0b5444bf7e59868e2dd79cffa113197870776ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tadej=20Jane=C5=BE?= Date: Wed, 12 Jun 2019 23:28:13 +0200 -Subject: [PATCH] Remove Python version management on Fedora +Subject: [PATCH 01/15] Remove Python version management on Fedora This removes the pythonz-bd dependency which is not available in Fedora anymore. @@ -116,5 +116,5 @@ index 478ccbb..0000000 - assert invoke('uninstall', *py_version).returncode == 0 - assert invoke('locate_python', *py_version).returncode != 0 -- -2.21.0 +2.31.1 diff --git a/0002-Remove-remaining-references-to-Python-2.6-3.2-and-3..patch b/0002-Remove-remaining-references-to-Python-2.6-3.2-and-3..patch new file mode 100644 index 0000000..7333fb6 --- /dev/null +++ b/0002-Remove-remaining-references-to-Python-2.6-3.2-and-3..patch @@ -0,0 +1,64 @@ +From 4a8766adc16d682d9659c26500c5c027de8646d1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tadej=20Jane=C5=BE?= +Date: Wed, 31 Jul 2019 12:36:12 +0200 +Subject: [PATCH 02/15] Remove remaining references to Python 2.6, 3.2 and 3.3 + +--- + setup.py | 9 --------- + tox.ini | 7 +------ + 2 files changed, 1 insertion(+), 15 deletions(-) + +diff --git a/setup.py b/setup.py +index 9ecf8d2..b91a9c7 100644 +--- a/setup.py ++++ b/setup.py +@@ -65,18 +65,9 @@ setup( + 'virtualenv>=1.11', 'virtualenv-clone>=0.2.5', 'setuptools>=17.1' + ], + extras_require={ +- ':python_version=="2.6"': [ +- 'argparse', 'pathlib', 'backports.shutil_get_terminal_size', 'shutilwhich' +- ], + ':python_version=="2.7"': [ + 'pathlib', 'backports.shutil_get_terminal_size', 'shutilwhich' + ], +- ':python_version=="3.2"': [ +- 'pathlib', 'backports.shutil_get_terminal_size', 'shutilwhich' +- ], +- ':python_version=="3.3"': [ +- 'pathlib' +- ], + ':sys_platform=="win32"': [ + 'shellingham' + ], +diff --git a/tox.ini b/tox.ini +index 6de3330..5cac4f3 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -1,6 +1,6 @@ + [tox] + skip_missing_interpreters=True +-envlist = py26, py27, py33, py34, py35, py36, py37, pypy ++envlist = py27, py34, py35, py36, py37, pypy + + [testenv] + passenv = CI HOME +@@ -8,15 +8,10 @@ passenv = CI HOME + commands = py.test -rw [] + deps = + -r{toxinidir}/requirements.txt +- py26: pathlib>=1.0.1 +- py26: mock +- py26: backports.shutil_get_terminal_size +- py26: shutilwhich + py27: pathlib>=1.0.1 + py27: mock + py27: backports.shutil_get_terminal_size + py27: shutilwhich +- py33: pathlib>=1.0.1 + pypy: shutilwhich + pypy: pathlib>=1.0.1 + pypy: mock +-- +2.31.1 + diff --git a/0003-Add-support-for-Python-3.8-and-3.9.patch b/0003-Add-support-for-Python-3.8-and-3.9.patch new file mode 100644 index 0000000..d57d54f --- /dev/null +++ b/0003-Add-support-for-Python-3.8-and-3.9.patch @@ -0,0 +1,52 @@ +From fc020f124406ccb306006e46e40ccb5f2dadee07 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tadej=20Jane=C5=BE?= +Date: Wed, 31 Jul 2019 12:39:44 +0200 +Subject: [PATCH 03/15] Add support for Python 3.8 and 3.9 + +--- + .travis.yml | 16 ++++++++++++++++ + tox.ini | 2 +- + 2 files changed, 17 insertions(+), 1 deletion(-) + +diff --git a/.travis.yml b/.travis.yml +index 0281fe5..98dbcf9 100644 +--- a/.travis.yml ++++ b/.travis.yml +@@ -37,6 +37,22 @@ matrix: + - pip install -e . --upgrade + - pip install pytest + script: py.test -rws tests/ --ignore=tests/test_install.py ++ - language: python ++ dist: xenial ++ sudo: required ++ python: "3.8" ++ install: ++ - pip install -e . --upgrade ++ - pip install pytest ++ script: py.test -rws tests/ --ignore=tests/test_install.py ++ - language: python ++ dist: xenial ++ sudo: required ++ python: "3.9" ++ install: ++ - pip install -e . --upgrade ++ - pip install pytest ++ script: py.test -rws tests/ --ignore=tests/test_install.p + - language: python + sudo: false + python: "pypy" +diff --git a/tox.ini b/tox.ini +index 5cac4f3..192215a 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -1,6 +1,6 @@ + [tox] + skip_missing_interpreters=True +-envlist = py27, py34, py35, py36, py37, pypy ++envlist = py27, py34, py35, py36, py37, py38, py39, pypy + + [testenv] + passenv = CI HOME +-- +2.31.1 + diff --git a/0004-Unify-Pipfile-and-requirements.txt-with-dependencies.patch b/0004-Unify-Pipfile-and-requirements.txt-with-dependencies.patch new file mode 100644 index 0000000..5ed7ded --- /dev/null +++ b/0004-Unify-Pipfile-and-requirements.txt-with-dependencies.patch @@ -0,0 +1,49 @@ +From 75b71c027cbbd7559a197ed958d0ae3c6f140f31 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tadej=20Jane=C5=BE?= +Date: Tue, 14 Sep 2021 14:00:04 +0200 +Subject: [PATCH 04/15] Unify Pipfile and requirements.txt with dependencies in + setup.py + +--- + Pipfile | 8 ++++---- + requirements.txt | 6 +++--- + 2 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/Pipfile b/Pipfile +index 45cfe2a..a4240d4 100644 +--- a/Pipfile ++++ b/Pipfile +@@ -5,11 +5,11 @@ name = "pypi" + + [packages] + +-virtualenv = "==1.11.6" +-"virtualenv-clone" = "==0.2.5" +-"pythonz-bd" = {"version" = "*", "sys_platform" = "!='win32'" } ++virtualenv = ">=1.11" ++"virtualenv-clone" = ">=0.2.5" ++"pythonz-bd" = {"version" = ">1.10.2", "sys_platform" = "!='win32'" } + "shellingham" = {"version" = "*", "sys_platform" = "=='win32'" } + + [dev-packages] + +-pytest = "==2.6.2" ++pytest = "*" +diff --git a/requirements.txt b/requirements.txt +index 6ca3096..1cded1c 100644 +--- a/requirements.txt ++++ b/requirements.txt +@@ -1,7 +1,7 @@ + setuptools>=17.1 +-virtualenv +-virtualenv-clone==0.2.5 ++virtualenv>=1.11 ++virtualenv-clone>=0.2.5 + pytest +-pythonz-bd==1.11.2 ; sys_platform != 'win32' ++pythonz-bd>=1.10.2 ; sys_platform != 'win32' + shellingham ; sys_platform == 'win32' + stdeb ; sys_platform == 'linux' +-- +2.31.1 + diff --git a/0005-Replace-Travis-CI-and-AppVeyor-with-GitHub-Actions.patch b/0005-Replace-Travis-CI-and-AppVeyor-with-GitHub-Actions.patch new file mode 100644 index 0000000..49bafc7 --- /dev/null +++ b/0005-Replace-Travis-CI-and-AppVeyor-with-GitHub-Actions.patch @@ -0,0 +1,208 @@ +From 487970614a469895da3ec3c67663e7c69fe1de2d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tadej=20Jane=C5=BE?= +Date: Thu, 26 Aug 2021 11:11:09 +0200 +Subject: [PATCH 05/15] Replace Travis CI and AppVeyor with GitHub Actions + +--- + .github/workflows/ci-tests.yml | 39 +++++++++++++++++++ + .travis.yml | 70 ---------------------------------- + README.md | 8 ++-- + appveyor.yml | 7 ---- + tox.ini | 17 ++++++++- + 5 files changed, 60 insertions(+), 81 deletions(-) + create mode 100644 .github/workflows/ci-tests.yml + delete mode 100644 .travis.yml + delete mode 100644 appveyor.yml + +diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml +new file mode 100644 +index 0000000..51b5623 +--- /dev/null ++++ b/.github/workflows/ci-tests.yml +@@ -0,0 +1,39 @@ ++# NOTE: This name appears in GitHub's Checks API and in workflow's status badge. ++name: ci-tests ++ ++# Trigger the workflow when: ++on: ++ # A push occurs to one of the matched branches. ++ push: ++ branches: ++ - master ++ # Or when a pull request event occurs for a pull request against one of the ++ # matched branches. ++ pull_request: ++ branches: ++ - master ++ ++jobs: ++ tests: ++ # NOTE: This name appears in GitHub's Checks API. ++ name: tests ++ runs-on: ${{ matrix.platform }} ++ strategy: ++ matrix: ++ platform: [ubuntu-latest, windows-latest] ++ python-version: [2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9] ++ steps: ++ - name: Checkout code ++ uses: actions/checkout@v2 ++ - name: Set up Python ${{ matrix.python-version }} ++ uses: actions/setup-python@v2 ++ with: ++ python-version: ${{ matrix.python-version }} ++ - name: Install dependencies ++ run: | ++ python -m pip install --upgrade pip ++ pip install tox tox-gh-actions ++ - name: Test with Tox ++ run: tox ++ env: ++ PLATFORM: ${{ matrix.platform }} +diff --git a/.travis.yml b/.travis.yml +deleted file mode 100644 +index 98dbcf9..0000000 +--- a/.travis.yml ++++ /dev/null +@@ -1,70 +0,0 @@ +-matrix: +- fast_finish: true +- include: +- - language: python +- sudo: false +- python: "2.7" +- install: +- - pip install -e .[pythonz] --upgrade +- - pip install pytest +- script: py.test -rws tests/ +- - language: python +- sudo: false +- python: "3.4" +- install: +- - pip install -e . --upgrade +- - pip install pytest +- script: py.test -rws tests/ --ignore=tests/test_install.py +- - language: python +- sudo: false +- python: "3.5" +- install: +- - pip install -e . --upgrade +- - pip install pytest +- script: py.test -rws tests/ --ignore=tests/test_install.py +- - language: python +- sudo: false +- python: "3.6" +- install: +- - pip install -e .[pythonz] --upgrade +- - pip install pytest +- script: py.test -rws tests/ +- - language: python +- dist: xenial +- sudo: required +- python: "3.7" +- install: +- - pip install -e . --upgrade +- - pip install pytest +- script: py.test -rws tests/ --ignore=tests/test_install.py +- - language: python +- dist: xenial +- sudo: required +- python: "3.8" +- install: +- - pip install -e . --upgrade +- - pip install pytest +- script: py.test -rws tests/ --ignore=tests/test_install.py +- - language: python +- dist: xenial +- sudo: required +- python: "3.9" +- install: +- - pip install -e . --upgrade +- - pip install pytest +- script: py.test -rws tests/ --ignore=tests/test_install.p +- - language: python +- sudo: false +- python: "pypy" +- install: +- - pip install -e .[pythonz] --upgrade +- - pip install pytest +- script: py.test -rws tests/ +- - language: nix +- script: nix build -v --arg nixpkgs "import (fetchTarball ''https://github.com/NixOS/nixpkgs-channels/archive/$CHANNEL_HASH.tar.gz'') {}" +- env: CHANNEL_HASH=07b42ccf2de451342982b550657636d891c4ba35 +- - language: nix +- script: nix build -v --arg nixpkgs "import (fetchTarball ''https://github.com/NixOS/nixpkgs-channels/archive/$CHANNEL_HASH.tar.gz'') {}" +- env: CHANNEL_HASH=nixos-unstable +- allow_failures: +- - env: CHANNEL_HASH=nixos-unstable +diff --git a/README.md b/README.md +index 35368f6..cce7064 100644 +--- a/README.md ++++ b/README.md +@@ -2,10 +2,12 @@ Pew - Python Env Wrapper + ======================== + + [![PyPi version](http://img.shields.io/pypi/v/pew.svg)](https://pypi.python.org/pypi/pew) +-[![Build Status](https://travis-ci.org/berdario/pew.svg)](https://travis-ci.org/berdario/pew) +-[![Build status](https://ci.appveyor.com/api/projects/status/xxe096txh1fuqfag/branch/master?svg=true)](https://ci.appveyor.com/project/berdario/pew/branch/master) ++[![CI test status][github-ci-tests-badge]][github-ci-tests-link] + [![PyPi](https://img.shields.io/pypi/format/pew.svg)](https://pypi.python.org/pypi/pew/) + ++[github-ci-tests-badge]: https://github.com/berdario/pew/workflows/ci-tests/badge.svg ++[github-ci-tests-link]: https://github.com/berdario/pew/actions?query=workflow:ci-tests+branch:master ++ + Python Env Wrapper is a set of commands to manage multiple [virtual environments](http://pypi.python.org/pypi/virtualenv). Pew can create, delete and copy your environments, using a single command to switch to them wherever you are, while keeping them in a single (configurable) location. + + Virtualenvs makes it easier to work on more than one project at a time without introducing conflicts in their dependencies. +@@ -370,7 +372,7 @@ Running Tests + + The test suite for `pew` uses [tox](http://codespeak.net/tox). Most tests are actually integration tests that will fork shells, create virtualenvs and in some cases even download python packages from Pypi. The whole test suite takes around 1 minute to run on a single interpreter. + +-With every commit and pull request, the test suite is run over all supported interpreters on travis-ci (for unix-like) and appveyor (for windows). ++With every commit and pull request, the test suite is run over all supported interpreters on GitHub Actions (which runs tests on Linux and Windows). + + To run individual test scripts, run from the top level directory of the repository a command like: + +diff --git a/appveyor.yml b/appveyor.yml +deleted file mode 100644 +index 95f0f63..0000000 +--- a/appveyor.yml ++++ /dev/null +@@ -1,7 +0,0 @@ +-install: +- - SET PATH=C:\\Python34;C:\\Python34\\Scripts;%PATH% +- - pip install tox +- +-build: false +- +-test_script: tox -e "py27,py37" +diff --git a/tox.ini b/tox.ini +index 192215a..7420f08 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -1,6 +1,21 @@ + [tox] + skip_missing_interpreters=True +-envlist = py27, py34, py35, py36, py37, py38, py39, pypy ++envlist = py{27,34,35,36,37,38,39}-{linux,windows}, pypy ++ ++[gh-actions] ++python = ++ 2.7: py27 ++ 3.4: py34 ++ 3.5: py35 ++ 3.6: py36 ++ 3.7: py37 ++ 3.8: py38 ++ 3.9: py39 ++ ++[gh-actions:env] ++PLATFORM = ++ ubuntu-latest: linux ++ windows-latest: windows + + [testenv] + passenv = CI HOME +-- +2.31.1 + diff --git a/0006-Drop-support-for-Python-2-Python-3.4-and-3.5.patch b/0006-Drop-support-for-Python-2-Python-3.4-and-3.5.patch new file mode 100644 index 0000000..f4a16a4 --- /dev/null +++ b/0006-Drop-support-for-Python-2-Python-3.4-and-3.5.patch @@ -0,0 +1,288 @@ +From 075bedcadb16411a8549642844a925592c46972c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tadej=20Jane=C5=BE?= +Date: Thu, 26 Aug 2021 11:44:56 +0200 +Subject: [PATCH 06/15] Drop support for Python 2, Python 3.4 and 3.5 + +Python 2 has been EOL for since Jan 1, 2020, Python 3.4 has been EOL +since Mar 18, 2019 and Python 3.5 has been EOL since Sep 13, 2020. + +Drop obsolete 'from __future__' imports, drop obsolete conditionals due +to Python 2 vs. 3 differences. +--- + .github/workflows/ci-tests.yml | 2 +- + README.md | 10 +++++----- + pew/__init__.py | 2 -- + pew/_print_utils.py | 12 ++---------- + pew/_utils.py | 21 +++------------------ + pew/pew.py | 14 +++----------- + setup.py | 4 ---- + tests/test_print_utils.py | 5 +---- + tests/utils.py | 23 ++++------------------- + tox.ini | 9 +-------- + 10 files changed, 20 insertions(+), 82 deletions(-) + +diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml +index 51b5623..9725e39 100644 +--- a/.github/workflows/ci-tests.yml ++++ b/.github/workflows/ci-tests.yml +@@ -21,7 +21,7 @@ jobs: + strategy: + matrix: + platform: [ubuntu-latest, windows-latest] +- python-version: [2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9] ++ python-version: [3.6, 3.7, 3.8, 3.9] + steps: + - name: Checkout code + uses: actions/checkout@v2 +diff --git a/README.md b/README.md +index cce7064..b976741 100644 +--- a/README.md ++++ b/README.md +@@ -216,9 +216,9 @@ Use Pythonz to download and build a Python vm + + `usage: pew install [options] version` + +-To install Python3.5.0 ++To install Python3.8.0 + +-`pew install 3.5.0` ++`pew install 3.8.0` + + To install Pypy: + +@@ -380,15 +380,15 @@ To run individual test scripts, run from the top level directory of the reposito + + To run tests under a single version of Python, specify the appropriate environment when running `tox`: + +-`tox -e py27` ++`tox -e py38` + + Combine the two modes to run specific tests with a single version of Python: + +-`tox -e py27 tests/test_setproject.py` ++`tox -e py38 tests/test_setproject.py` + + You can also filter them: + +-`tox -e py34 -- -k workon` ++`tox -e py38 -- -k workon` + + Add new tests by modifying an existing file or creating new script in the tests directory. + +diff --git a/pew/__init__.py b/pew/__init__.py +index 90fe7cf..de3be3b 100644 +--- a/pew/__init__.py ++++ b/pew/__init__.py +@@ -1,4 +1,2 @@ +-from __future__ import absolute_import +- + from . import pew + __all__ = ['pew'] +diff --git a/pew/_print_utils.py b/pew/_print_utils.py +index 0b18c1d..9073b00 100644 +--- a/pew/_print_utils.py ++++ b/pew/_print_utils.py +@@ -1,16 +1,8 @@ +-from __future__ import division, print_function +- + import os + from functools import partial + from math import ceil +-try: +- from itertools import zip_longest +-except ImportError: +- from itertools import izip_longest as zip_longest +-try: +- from shutil import get_terminal_size +-except ImportError: +- from backports.shutil_get_terminal_size import get_terminal_size ++from itertools import zip_longest ++from shutil import get_terminal_size + + SEP = ' ' + L = len(SEP) +diff --git a/pew/_utils.py b/pew/_utils.py +index d1d8e0a..cd51b1b 100644 +--- a/pew/_utils.py ++++ b/pew/_utils.py +@@ -7,31 +7,16 @@ from subprocess import check_call, Popen, PIPE + from collections import namedtuple + from functools import partial, wraps + from pathlib import Path +-from tempfile import NamedTemporaryFile as _ntf +-try: +- from shutil import which +-except ImportError: +- from shutilwhich import which ++from tempfile import NamedTemporaryFile ++from shutil import which + +-py2 = sys.version_info[0] == 2 + windows = sys.platform == 'win32' + +-if py2 or windows: ++if windows: + locale.setlocale(locale.LC_CTYPE, '') + + encoding = locale.getlocale()[1] or 'ascii' + +-if py2: +- @wraps(_ntf) +- def NamedTemporaryFile(mode): +- return getwriter(encoding)(_ntf(mode)) +- +- def to_unicode(x): +- return x.decode(encoding) +-else: +- NamedTemporaryFile = _ntf +- to_unicode = str +- + def check_path(): + parent = os.path.dirname + return parent(parent(which('python'))) == os.environ['VIRTUAL_ENV'] +diff --git a/pew/pew.py b/pew/pew.py +index 2ffea2f..42e7a79 100644 +--- a/pew/pew.py ++++ b/pew/pew.py +@@ -1,5 +1,3 @@ +-from __future__ import print_function, absolute_import, unicode_literals +- + import os + import sys + import argparse +@@ -10,10 +8,7 @@ from functools import partial + from subprocess import CalledProcessError + from pathlib import Path + +-try: +- from shutil import get_terminal_size +-except ImportError: +- from backports.shutil_get_terminal_size import get_terminal_size ++from shutil import get_terminal_size + + windows = sys.platform == 'win32' + +@@ -30,12 +25,9 @@ else: + import shellingham + + from pew._utils import (check_call, invoke, expandpath, own, env_bin_dir, +- check_path, temp_environ, NamedTemporaryFile, to_unicode) ++ check_path, temp_environ, NamedTemporaryFile) + from pew._print_utils import print_virtualenvs + +-if sys.version_info[0] == 2: +- input = raw_input +- + err = partial(print, file=sys.stderr) + + if windows: +@@ -154,7 +146,7 @@ def fork_bash(env, cwd): + with NamedTemporaryFile('w+') as rcfile: + with bashrcpath.open() as bashrc: + rcfile.write(bashrc.read()) +- rcfile.write('\nexport PATH="' + to_unicode(compute_path(env)) + '"') ++ rcfile.write('\nexport PATH="' + compute_path(env) + '"') + rcfile.flush() + return fork_shell(env, ['bash', '--rcfile', rcfile.name], cwd) + else: +diff --git a/setup.py b/setup.py +index b91a9c7..db57b9b 100644 +--- a/setup.py ++++ b/setup.py +@@ -65,9 +65,6 @@ setup( + 'virtualenv>=1.11', 'virtualenv-clone>=0.2.5', 'setuptools>=17.1' + ], + extras_require={ +- ':python_version=="2.7"': [ +- 'pathlib', 'backports.shutil_get_terminal_size', 'shutilwhich' +- ], + ':sys_platform=="win32"': [ + 'shellingham' + ], +@@ -83,7 +80,6 @@ setup( + entry_points={ + 'console_scripts': ['pew = pew.pew:pew']}, + classifiers=[ +- 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 3', + 'Intended Audience :: Developers', + 'Environment :: Console'] +diff --git a/tests/test_print_utils.py b/tests/test_print_utils.py +index df4cdf7..1fc5cf5 100644 +--- a/tests/test_print_utils.py ++++ b/tests/test_print_utils.py +@@ -3,10 +3,7 @@ from pew._print_utils import ( + get_best_columns_number, + columnize, + ) +-try: +- from unittest.mock import patch +-except ImportError: +- from mock import patch ++from unittest.mock import patch + + + def test_get_rows(): +diff --git a/tests/utils.py b/tests/utils.py +index 01550db..952832a 100644 +--- a/tests/utils.py ++++ b/tests/utils.py +@@ -1,22 +1,7 @@ +-try: +- from tempfile import TemporaryDirectory +-except ImportError: +- from shutil import rmtree +- from contextlib import contextmanager +- from tempfile import mkdtemp +- +- @contextmanager +- def TemporaryDirectory(): +- tmpdir = mkdtemp() +- yield tmpdir +- rmtree(tmpdir) +- +-try: +- from urllib.request import urlopen +- from urllib.error import URLError +-except ImportError: +- from urllib import urlopen +- URLError = IOError ++from tempfile import TemporaryDirectory ++ ++from urllib.request import urlopen ++from urllib.error import URLError + + + import functools +diff --git a/tox.ini b/tox.ini +index 7420f08..c0e5599 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -1,12 +1,9 @@ + [tox] + skip_missing_interpreters=True +-envlist = py{27,34,35,36,37,38,39}-{linux,windows}, pypy ++envlist = py{36,37,38,39}-{linux,windows}, pypy + + [gh-actions] + python = +- 2.7: py27 +- 3.4: py34 +- 3.5: py35 + 3.6: py36 + 3.7: py37 + 3.8: py38 +@@ -23,10 +20,6 @@ passenv = CI HOME + commands = py.test -rw [] + deps = + -r{toxinidir}/requirements.txt +- py27: pathlib>=1.0.1 +- py27: mock +- py27: backports.shutil_get_terminal_size +- py27: shutilwhich + pypy: shutilwhich + pypy: pathlib>=1.0.1 + pypy: mock +-- +2.31.1 + diff --git a/0007-Replace-PyPy-with-PyPy-3.patch b/0007-Replace-PyPy-with-PyPy-3.patch new file mode 100644 index 0000000..19e4219 --- /dev/null +++ b/0007-Replace-PyPy-with-PyPy-3.patch @@ -0,0 +1,207 @@ +From c17659d13b36e7f3b2c78415d0c2ce48ddc52f2d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tadej=20Jane=C5=BE?= +Date: Wed, 29 Sep 2021 23:47:30 +0200 +Subject: [PATCH 07/15] Replace PyPy with PyPy 3 + +--- + README.md | 153 +++++++++++++++++++++++++++++++++++++++++------------- + tox.ini | 9 +--- + 2 files changed, 120 insertions(+), 42 deletions(-) + +diff --git a/README.md b/README.md +index b976741..2539304 100644 +--- a/README.md ++++ b/README.md +@@ -67,48 +67,131 @@ Common workflow + + You can create a new virtualenv, with a non-default python and specifying some packages to be installed in it, like this: + +- ~> pew new --python=pypy -i django myproject +- Running virtualenv with interpreter /home/dario/Applications/bin/pypy +- New pypy executable in myproject/bin/pypy +- Installing distribute.................................................................. +- ....................................................................................... +- ..................................................................done. +- Installing pip................done. +- Downloading/unpacking django +- Downloading Django-1.5.1.tar.gz (8.0MB): +- 8.0MB downloaded +- Running setup.py egg_info for package django +- +- warning: no previously-included files matching '__pycache__' found under directory '*' +- warning: no previously-included files matching '*.py[co]' found under directory '*' +- Installing collected packages: django +- [SNIP] +- Successfully installed django Cleaning up... ++ ~> pew new --python=pypy3 -i django myproject ++ created virtual environment PyPy3.6.9.final.0-64 in 817ms ++ creator PyPy3Posix(dest=/home/tadej/.local/share/virtualenvs/myproject, clear=False, global=False) ++ seeder FromAppData(extra_search_dir=/usr/share/python-wheels,download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/tadej/.local/share/virtualenv) ++ added seed packages: pip==21.2.1, setuptools==57.4.0, wheel==0.36.2 ++ activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator ++ Collecting django ++ Downloading Django-3.2.7-py3-none-any.whl (7.9 MB) ++ |████████████████████████████████| 7.9 MB 1.8 MB/s ++ Collecting asgiref<4,>=3.3.2 ++ Downloading asgiref-3.4.1-py3-none-any.whl (25 kB) ++ Collecting pytz ++ Downloading pytz-2021.1-py2.py3-none-any.whl (510 kB) ++ |████████████████████████████████| 510 kB 10.6 MB/s ++ Collecting sqlparse>=0.2.2 ++ Downloading sqlparse-0.4.2-py3-none-any.whl (42 kB) ++ |████████████████████████████████| 42 kB 833 kB/s ++ Collecting typing-extensions ++ Downloading typing_extensions-3.10.0.2-py3-none-any.whl (26 kB) ++ Installing collected packages: typing-extensions, sqlparse, pytz, asgiref, django ++ Successfully installed asgiref-3.4.1 django-3.2.7 pytz-2021.1 sqlparse-0.4.2 typing-extensions-3.10.0.2 ++ WARNING: You are using pip version 21.2.1; however, version 21.2.4 is available. ++ You should consider upgrading via the '/home/tadej/.local/share/virtualenvs/myproject/bin/pypy3 -m pip install --upgrade pip' command. + Launching subshell in virtual environment. Type 'exit' or 'Ctrl+D' to return. + +-Once inside, you can check the current python version, list the packages present in its python's site-packages directory, and install additional packages like this: ++Once inside, you can check the current Python version, list the packages present in its python's site-packages directory, and install additional packages like this: + + myproject ~> python -V +- Python 2.7.3 (b9c3566aa017, May 09 2013, 09:09:14) +- [PyPy 2.0.0 with GCC 4.6.3] ++ Python 3.6.9 (831ff17f8cd1, May 26 2021, 11:41:48) ++ [PyPy 7.3.1 with GCC 10.3.1 20210422 (Red Hat 10.3.1-1)] + myproject ~> pew lssitepackages +- distribute-0.6.34-py2.7.egg Django-1.5.1-py2.7.egg-info setuptools.pth pip-1.3.1-py2.7.egg +- easy-install.pth django ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/Django-3.2.7.dist-info ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/__pycache__ ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/_distutils_hack ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/_virtualenv.pth ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/_virtualenv.py ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/asgiref ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/asgiref-3.4.1.dist-info ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/backports ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/backports.entry_points_selectable-1.1.0.dist-info ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/clonevirtualenv.py ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/distlib ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/distlib-0.3.3.dist-info ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/distutils-precedence.pth ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/django ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/easy-install.pth ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/filelock ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/filelock-3.1.0.dist-info ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/importlib_metadata ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/importlib_metadata-4.8.1.dist-info ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/importlib_resources ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/importlib_resources-5.2.2.dist-info ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/pew.egg-link ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/pip ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/pip-21.2.1.dist-info ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/pip-21.2.1.virtualenv ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/pkg_resources ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/platformdirs ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/platformdirs-2.4.0.dist-info ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/pytz ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/pytz-2021.1.dist-info ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/setuptools ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/setuptools-57.4.0.dist-info ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/setuptools-57.4.0.virtualenv ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/six-1.16.0.dist-info ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/six.py ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/sqlparse ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/sqlparse-0.4.2.dist-info ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/typing_extensions-3.10.0.2.dist-info ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/typing_extensions.py ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/virtualenv ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/virtualenv-20.8.1.dist-info ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/virtualenv_clone-0.5.7.dist-info ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/wheel ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/wheel-0.36.2.dist-info ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/wheel-0.36.2.virtualenv ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/zipp-3.6.0.dist-info ++ /home/tadej/.local/share/virtualenvs/myproject/site-packages/zipp.py + myproject ~> pip install pdbpp +- Downloading/unpacking pdbpp +- [SNIP] +- Successfully installed pdbpp fancycompleter wmctrl pygments pyrepl +- Cleaning up... ++ Collecting pdbpp ++ Downloading pdbpp-0.10.3-py2.py3-none-any.whl (23 kB) ++ Collecting fancycompleter>=0.8 ++ Downloading fancycompleter-0.9.1-py3-none-any.whl (9.7 kB) ++ Collecting wmctrl ++ Downloading wmctrl-0.4.tar.gz (5.4 kB) ++ Collecting pygments ++ Downloading Pygments-2.10.0-py3-none-any.whl (1.0 MB) ++ |████████████████████████████████| 1.0 MB 2.4 MB/s ++ Collecting pyrepl>=0.8.2 ++ Downloading pyrepl-0.9.0.tar.gz (48 kB) ++ |████████████████████████████████| 48 kB 3.0 MB/s ++ Building wheels for collected packages: pyrepl, wmctrl ++ Building wheel for pyrepl (setup.py) ... done ++ Created wheel for pyrepl: filename=pyrepl-0.9.0-py3-none-any.whl size=59906 sha256=de1c4017634f07823025e3cd6db0221c5ec6eafaade32f48c306b4774809c0db ++ Stored in directory: /home/tadej/.cache/pip/wheels/bd/32/c9/a638d4a50ae3bf39e8d6ac32f889746687f858794f2a841f84 ++ Building wheel for wmctrl (setup.py) ... done ++ Created wheel for wmctrl: filename=wmctrl-0.4-py3-none-any.whl size=3858 sha256=e5aee6309b7b919a44423b524b6d0b66a238e6efdcafcefee34757cf2057f408 ++ Stored in directory: /home/tadej/.cache/pip/wheels/1c/8e/da/50ccb9bb858eb7462f6047965be9badfa6f4d36d707ac5c5a2 ++ Successfully built pyrepl wmctrl ++ Installing collected packages: pyrepl, wmctrl, pygments, fancycompleter, pdbpp ++ Successfully installed fancycompleter-0.9.1 pdbpp-0.10.3 pygments-2.10.0 pyrepl-0.9.0 wmctrl-0.4 + myproject ~> pip freeze +- Django==1.5.1 +- Pygments==1.6 +- cffi==0.6 +- distribute==0.6.34 +- fancycompleter==0.4 +- pdbpp==0.7.2 +- pyrepl==0.8.4 +- wmctrl==0.1 +- wsgiref==0.1.2 ++ asgiref==3.4.1 ++ backports.entry-points-selectable==1.1.0 ++ cffi==1.14.0 ++ distlib==0.3.3 ++ Django==3.2.7 ++ fancycompleter==0.9.1 ++ filelock==3.1.0 ++ greenlet==0.4.13 ++ importlib-metadata==4.8.1 ++ importlib-resources==5.2.2 ++ pdbpp==0.10.3 ++ platformdirs==2.4.0 ++ Pygments==2.10.0 ++ pyrepl==0.9.0 ++ pytz==2021.1 ++ readline==6.2.4.1 ++ six==1.16.0 ++ sqlparse==0.4.2 ++ typing-extensions==3.10.0.2 ++ virtualenv==20.8.1 ++ virtualenv-clone==0.5.7 ++ wmctrl==0.4 ++ zipp==3.6.0 + myproject ~> ^D + + You can also specify a requirements file, to be passed on to pip, and activate another virtualenv with workon: +diff --git a/tox.ini b/tox.ini +index c0e5599..4481075 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -1,6 +1,6 @@ + [tox] + skip_missing_interpreters=True +-envlist = py{36,37,38,39}-{linux,windows}, pypy ++envlist = py{36,37,38,39}-{linux,windows}, pypy3 + + [gh-actions] + python = +@@ -18,9 +18,4 @@ PLATFORM = + passenv = CI HOME + # HOME needed until https://github.com/saghul/pythonz/pull/82 will be merged + commands = py.test -rw [] +-deps = +- -r{toxinidir}/requirements.txt +- pypy: shutilwhich +- pypy: pathlib>=1.0.1 +- pypy: mock +- pypy: backports.shutil_get_terminal_size ++deps = -r{toxinidir}/requirements.txt +-- +2.31.1 + diff --git a/0008-Remove-test-for-testing-virtualenv-relocatable.patch b/0008-Remove-test-for-testing-virtualenv-relocatable.patch new file mode 100644 index 0000000..59b7a31 --- /dev/null +++ b/0008-Remove-test-for-testing-virtualenv-relocatable.patch @@ -0,0 +1,34 @@ +From 5b5eb0bf01f80cc0a60c6dd49e99c558cd4e8a99 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tadej=20Jane=C5=BE?= +Date: Thu, 26 Aug 2021 11:55:37 +0200 +Subject: [PATCH 08/15] Remove test for testing 'virtualenv --relocatable' + +Virtualenv 20+ doesn't support --relocatable anymore and nothing in Pew +really depended on that. +--- + tests/test_cp.py | 9 --------- + 1 file changed, 9 deletions(-) + +diff --git a/tests/test_cp.py b/tests/test_cp.py +index f41061a..30517d1 100644 +--- a/tests/test_cp.py ++++ b/tests/test_cp.py +@@ -36,15 +36,6 @@ def test_virtualenv_variable(copied_env): + assert str(copied_env) == envname + + +-def test_source_relocatable(workon_home, testpackageenv): +- check_call([executable, '-m', 'virtualenv', '--relocatable', +- str(workon_home / 'source')]) +- invoke('cp', 'source', 'destination', '-d') +- testscript = Path(invoke('workon', 'destination', inp='which testscript.py').out.strip()) +- assert workon_home / 'destination' / 'bin' / 'testscript.py' == testscript +- invoke('rm', 'destination') +- +- + def test_source_does_not_exists(workon_home): + err = invoke('cp', 'virtualenvthatdoesntexist', 'foo').err.strip() + assert 'Please provide a valid virtualenv to copy' == err +-- +2.31.1 + diff --git a/0009-Replace-obsolete-pytest.yield_fixture-with-pytest.fi.patch b/0009-Replace-obsolete-pytest.yield_fixture-with-pytest.fi.patch new file mode 100644 index 0000000..fc98b02 --- /dev/null +++ b/0009-Replace-obsolete-pytest.yield_fixture-with-pytest.fi.patch @@ -0,0 +1,128 @@ +From bfe84e91cffaf0c001f2108dd547091dd4b01832 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tadej=20Jane=C5=BE?= +Date: Thu, 26 Aug 2021 12:14:19 +0200 +Subject: [PATCH 09/15] Replace obsolete @pytest.yield_fixture with + @pytest.fixture + +See https://docs.pytest.org/en/stable/yieldfixture.html. +--- + tests/conftest.py | 14 +++++++------- + tests/test_cp.py | 2 +- + tests/test_project.py | 4 ++-- + tests/test_rmvirtualenv.py | 2 +- + 4 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/tests/conftest.py b/tests/conftest.py +index 1bdf9d3..6b49f60 100644 +--- a/tests/conftest.py ++++ b/tests/conftest.py +@@ -9,7 +9,7 @@ from pew._utils import invoke_pew as invoke + from utils import TemporaryDirectory + + +-@pytest.yield_fixture(scope='session') ++@pytest.fixture(scope='session') + def workon_home(): + tmpdir = os.environ.get('TMPDIR', gettempdir()) + os.environ['WORKON_HOME'] = str(Path(tmpdir) / 'WORKON_HOME') +@@ -21,7 +21,7 @@ def workon_home(): + rmtree(str(workon)) + + +-@pytest.yield_fixture() ++@pytest.fixture() + def workon_sym_home(): + # workon_home() fixture assumes it is the only one changing the environ + # so save it and restore it after the test +@@ -49,27 +49,27 @@ def workon_sym_home(): + os.environ['WORKON_HOME'] = old_workon + + +-@pytest.yield_fixture() ++@pytest.fixture() + def env1(workon_home): + invoke('new', 'env1', '-d') + yield + invoke('rm', 'env1') + + +-@pytest.yield_fixture() ++@pytest.fixture() + def env2(workon_home): + invoke('new', 'env2', '-d') + yield + invoke('rm', 'env2') + +-@pytest.yield_fixture() ++@pytest.fixture() + def env_with_project(workon_home): # TODO: use for test_setproject/test_mkvirtualenv ? + with TemporaryDirectory() as projectdir: + invoke('new', 'env_with_project', '-d', '-a', projectdir) + yield Path(projectdir) + invoke('rm', 'env_with_project') + +-@pytest.yield_fixture() ++@pytest.fixture() + def testpackageenv(workon_home): + testpackage = str(Path(__file__).parent / 'testpackage') + invoke('new', 'source', '-d') +@@ -78,7 +78,7 @@ def testpackageenv(workon_home): + invoke('rm', 'source') + + +-@pytest.yield_fixture() ++@pytest.fixture() + def testtemplate(workon_home): + sourcetemplate = Path(__file__).parent / 'template_test' + testtemplatefile = workon_home / 'template_test' +diff --git a/tests/test_cp.py b/tests/test_cp.py +index 30517d1..e2f7653 100644 +--- a/tests/test_cp.py ++++ b/tests/test_cp.py +@@ -15,7 +15,7 @@ pytestmark = skip_windows( + ) + + +-@pytest.yield_fixture() ++@pytest.fixture() + def copied_env(workon_home, env1): + invoke('cp', 'env1', 'destination', '-d') + yield workon_home / 'destination' +diff --git a/tests/test_project.py b/tests/test_project.py +index 451eb15..49d8147 100644 +--- a/tests/test_project.py ++++ b/tests/test_project.py +@@ -11,7 +11,7 @@ from pew._utils import temp_environ, invoke_pew as invoke + from utils import skip_windows + + +-@pytest.yield_fixture(scope='session') ++@pytest.fixture(scope='session') + def project_home(): + tmpdir = os.environ.get('TMPDIR', gettempdir()) + project = Path(tmpdir) / 'PROJECT_HOME' +@@ -23,7 +23,7 @@ def project_home(): + rmtree(str(project)) + + +-@pytest.yield_fixture() ++@pytest.fixture() + def project(workon_home, project_home): + projname = 'project1' + invoke('mkproject', projname, '-d') +diff --git a/tests/test_rmvirtualenv.py b/tests/test_rmvirtualenv.py +index 39eb697..abd43b3 100644 +--- a/tests/test_rmvirtualenv.py ++++ b/tests/test_rmvirtualenv.py +@@ -5,7 +5,7 @@ import pytest + from pew._utils import invoke_pew as invoke + + +-@pytest.yield_fixture() ++@pytest.fixture() + def to_be_deleted(workon_home): + envname = 'to_be_deleted' + invoke('new', envname, '-d') +-- +2.31.1 + diff --git a/0010-Explicilty-import-distutils.sysconfig-subpackage-in-.patch b/0010-Explicilty-import-distutils.sysconfig-subpackage-in-.patch new file mode 100644 index 0000000..b741728 --- /dev/null +++ b/0010-Explicilty-import-distutils.sysconfig-subpackage-in-.patch @@ -0,0 +1,34 @@ +From 6893b274b640c4f691d6ed808b303543ba0bc6c3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tadej=20Jane=C5=BE?= +Date: Mon, 13 Sep 2021 14:52:23 +0200 +Subject: [PATCH 10/15] Explicilty import distutils.sysconfig subpackage in + sitepackages_dir() + +In general, submodules and subpackages are not imported when one imports +a package, unless they are explicitly included in the package's +__init__.py. + +To avoid a potential issue, explicitly import get_python_lib() from +distutils.sysconfig subpackage. +--- + pew/pew.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/pew/pew.py b/pew/pew.py +index 42e7a79..693e01a 100644 +--- a/pew/pew.py ++++ b/pew/pew.py +@@ -371,8 +371,8 @@ def sitepackages_dir(env=os.environ.get('VIRTUAL_ENV')): + sys.exit('ERROR: no virtualenv active') + else: + env_python = workon_home / env / env_bin_dir / 'python' +- return Path(invoke(str(env_python), '-c', 'import distutils; \ +-print(distutils.sysconfig.get_python_lib())').out) ++ return Path(invoke(str(env_python), '-c', ++ 'from distutils.sysconfig import get_python_lib; print(get_python_lib())').out) + + + def add_cmd(argv): +-- +2.31.1 + diff --git a/0011-Replace-easy_install-with-setuptools-in-test_lssitep.patch b/0011-Replace-easy_install-with-setuptools-in-test_lssitep.patch new file mode 100644 index 0000000..ebd306e --- /dev/null +++ b/0011-Replace-easy_install-with-setuptools-in-test_lssitep.patch @@ -0,0 +1,38 @@ +From 012a65cd7cbd967fdff76797287ce25fa264b9b3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tadej=20Jane=C5=BE?= +Date: Mon, 13 Sep 2021 15:06:08 +0200 +Subject: [PATCH 11/15] Replace easy_install with setuptools in + test_lssitepackages + +The easy_install top-level model and the easy_install console script +have been removed in setuptools 52+: +https://setuptools.readthedocs.io/en/latest/history.html#v52-0-0 + +Replace them with a setuptools exec that check for presence of a +setuptools dist-info, e.g. setuptools-57.4.0.dist-info. +--- + tests/test_ls.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/tests/test_ls.py b/tests/test_ls.py +index d5cb879..642ff02 100644 +--- a/tests/test_ls.py ++++ b/tests/test_ls.py +@@ -1,4 +1,5 @@ + from pathlib import Path ++import re + + from pew._utils import invoke_pew as invoke + +@@ -17,7 +18,7 @@ def test_get_site_packages_dir(workon_home): + def test_lssitepackages(workon_home): + invoke('new', 'env', '-d') + pkgs = invoke('in', 'env', 'pew', 'lssitepackages').out +- assert 'easy_install' in pkgs ++ assert re.search(r'setuptools-((\d+\.)+)dist-info', pkgs) + invoke('rm', 'env') + + +-- +2.31.1 + diff --git a/0012-Rewrite-test_restore-to-delete-setuptools-to-break-t.patch b/0012-Rewrite-test_restore-to-delete-setuptools-to-break-t.patch new file mode 100644 index 0000000..c3c7523 --- /dev/null +++ b/0012-Rewrite-test_restore-to-delete-setuptools-to-break-t.patch @@ -0,0 +1,66 @@ +From 2ad75887c7f584c52c7aa2e9de2af2eee3139b21 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tadej=20Jane=C5=BE?= +Date: Mon, 13 Sep 2021 22:49:48 +0200 +Subject: [PATCH 12/15] Rewrite test_restore to delete setuptools to break test + virtualenv + +Previoulsy, test_restore test relied on breaking the test virtualenv by +removing the site.py from the test virtualenv. + +Since virtualenv 20+ doesn't inject its own site.py when creating a +Python 3 virtualenv anymore, reling on removing the site.py from the +testing virtualenv no longer works. + +Deleting everything related to setuptools seems like a good way to break +the 'import setuptools' statement. +--- + tests/test_restore.py | 30 +++++++++++++++++++++--------- + 1 file changed, 21 insertions(+), 9 deletions(-) + +diff --git a/tests/test_restore.py b/tests/test_restore.py +index 80304d5..fe28977 100644 +--- a/tests/test_restore.py ++++ b/tests/test_restore.py +@@ -1,18 +1,30 @@ + from itertools import chain ++import os ++import shutil + + from pew._utils import invoke_pew as invoke + + + def test_restore(workon_home, env1): +- patterns = ['lib*/*/site.py*', 'Lib/site.py*'] +- to_be_deleted = set(chain(*((workon_home / 'env1').glob(pat) for pat in patterns))) +- for site in to_be_deleted: ++ # Break the test virtualenv by deleting all setuptools-related files and ++ # directories. ++ setuptools_patterns = ['lib*/**/setuptools*', 'Lib/**/setuptools*'] ++ to_be_deleted = set(chain(*((workon_home / 'env1').glob(pat) for pat in setuptools_patterns))) ++ for file_path in to_be_deleted: + try: +- site.unlink() ++ if os.path.isfile(file_path) or os.path.islink(file_path): ++ os.unlink(file_path) ++ elif os.path.isdir(file_path): ++ shutil.rmtree(file_path) + except FileNotFoundError: +- pass # multiple links to the same file might appear in to_be_deleted +- result = invoke('in', 'env1', 'python', '-vc', '') +- assert 'Error' in result.err or 'fail' in result.err ++ # NOTE: The to_be_deleted list can contain multiple links to the ++ # same file so the file could already be deleted. ++ pass ++ # Importing setuptools in the broken test virtualenv should fail. ++ result = invoke('in', 'env1', 'python', '-c', 'import setuptools') ++ assert 'ModuleNotFoundError' in result.err ++ # Re-create the test virtualenv. + invoke('restore', 'env1') +- result = invoke('in', 'env1', 'python', '-vc', '') +- assert 'Error' not in result.err and 'fail' not in result.err ++ # Importing setuptools in the re-created test virtualenv should not fail. ++ result = invoke('in', 'env1', 'python', '-c', 'import setuptools') ++ assert 'Error' not in result.err +-- +2.31.1 + diff --git a/0013-Register-pytest.marker.shell-custom-marker.patch b/0013-Register-pytest.marker.shell-custom-marker.patch new file mode 100644 index 0000000..6805068 --- /dev/null +++ b/0013-Register-pytest.marker.shell-custom-marker.patch @@ -0,0 +1,24 @@ +From 621331e7bb96d234a4badc02fcd7f13de9e8be1c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tadej=20Jane=C5=BE?= +Date: Thu, 30 Sep 2021 00:02:00 +0200 +Subject: [PATCH 13/15] Register @pytest.marker.shell custom marker + +See https://docs.pytest.org/en/stable/mark.html. +--- + pyproject.toml | 4 ++++ + 1 file changed, 4 insertions(+) + create mode 100644 pyproject.toml + +diff --git a/pyproject.toml b/pyproject.toml +new file mode 100644 +index 0000000..d9fc210 +--- /dev/null ++++ b/pyproject.toml +@@ -0,0 +1,4 @@ ++[tool.pytest.ini_options] ++markers = [ ++ "shell: marks tests that require a shell (deselect with '-m \"not shell\"')", ++] +-- +2.31.1 + diff --git a/0014-Temporarily-disable-test_create_in_symlink-test-in-t.patch b/0014-Temporarily-disable-test_create_in_symlink-test-in-t.patch new file mode 100644 index 0000000..b8a176e --- /dev/null +++ b/0014-Temporarily-disable-test_create_in_symlink-test-in-t.patch @@ -0,0 +1,31 @@ +From f9b5a2cbed0a26f60d175793bf737bbe2ba3c209 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tadej=20Jane=C5=BE?= +Date: Thu, 30 Sep 2021 00:15:52 +0200 +Subject: [PATCH 14/15] Temporarily disable test_create_in_symlink test in + test_mkvirtualenv + +Follow up on why it broke in issue: +https://github.com/berdario/pew/issues/225. +--- + tests/test_mkvirtualenv.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/tests/test_mkvirtualenv.py b/tests/test_mkvirtualenv.py +index bf20086..b63ecf1 100644 +--- a/tests/test_mkvirtualenv.py ++++ b/tests/test_mkvirtualenv.py +@@ -17,7 +17,10 @@ def test_create(workon_home): + assert envs < envs2 + + +-@skip_windows(reason="symlinks on windows are not well supported") ++# TODO: Figure out why this test broke after upgrading to virtualenv 20. ++# See: https://github.com/berdario/pew/issues/225. ++# @skip_windows(reason="symlinks on windows are not well supported") ++@pytest.mark.skip("temporarily disable test_create_in_symlink test") + def test_create_in_symlink(workon_sym_home): + invoke('new', 'env', '-d') + pip_path = Path(invoke('in', 'env', 'which', 'pip').out) +-- +2.31.1 + diff --git a/0015-Add-support-for-Python-3.10.patch b/0015-Add-support-for-Python-3.10.patch new file mode 100644 index 0000000..18cc410 --- /dev/null +++ b/0015-Add-support-for-Python-3.10.patch @@ -0,0 +1,32 @@ +From 1b7da40c0d28a541f8fdf5c710b82a23fe82a8e7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tadej=20Jane=C5=BE?= +Date: Fri, 1 Oct 2021 12:18:08 +0200 +Subject: [PATCH 15/15] Add support for Python 3.10 + +--- + tox.ini | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/tox.ini b/tox.ini +index 4481075..d0a559e 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -1,6 +1,6 @@ + [tox] + skip_missing_interpreters=True +-envlist = py{36,37,38,39}-{linux,windows}, pypy3 ++envlist = py{36,37,38,39,310}-{linux,windows}, pypy3 + + [gh-actions] + python = +@@ -8,6 +8,7 @@ python = + 3.7: py37 + 3.8: py38 + 3.9: py39 ++ 3.10: py310 + + [gh-actions:env] + PLATFORM = +-- +2.31.1 + diff --git a/pew.spec b/pew.spec index 8ac4a74..db6630c 100644 --- a/pew.spec +++ b/pew.spec @@ -2,7 +2,7 @@ Name: pew Version: 1.2.0 -Release: 12%{?dist} +Release: 13%{?dist} Summary: Tool to manage multiple virtualenvs written in pure Python License: MIT @@ -19,6 +19,27 @@ Source1: README.md # https://github.com/berdario/pew/issues/195. Patch0: 0001-Remove-Python-version-management-on-Fedora.patch +# Backport PR #214: +# Support Python 3.8, 3.9 and 3.10, drop EOL Python versions (2.7, 3.4, 3.5), +# use GitHub Actions for CI +# https://github.com/berdario/pew/pull/214 +# +# NOTE: This enables Pew to be used on recent Fedora versions. +Patch1: 0002-Remove-remaining-references-to-Python-2.6-3.2-and-3..patch +Patch2: 0003-Add-support-for-Python-3.8-and-3.9.patch +Patch3: 0004-Unify-Pipfile-and-requirements.txt-with-dependencies.patch +Patch4: 0005-Replace-Travis-CI-and-AppVeyor-with-GitHub-Actions.patch +Patch5: 0006-Drop-support-for-Python-2-Python-3.4-and-3.5.patch +Patch6: 0007-Replace-PyPy-with-PyPy-3.patch +Patch7: 0008-Remove-test-for-testing-virtualenv-relocatable.patch +Patch8: 0009-Replace-obsolete-pytest.yield_fixture-with-pytest.fi.patch +Patch9: 0010-Explicilty-import-distutils.sysconfig-subpackage-in-.patch +Patch10: 0011-Replace-easy_install-with-setuptools-in-test_lssitep.patch +Patch11: 0012-Rewrite-test_restore-to-delete-setuptools-to-break-t.patch +Patch12: 0013-Register-pytest.marker.shell-custom-marker.patch +Patch13: 0014-Temporarily-disable-test_create_in_symlink-test-in-t.patch +Patch14: 0015-Add-support-for-Python-3.10.patch + BuildArch: noarch BuildRequires: python3-devel @@ -83,6 +104,9 @@ py.test-3 -v tests %changelog +* Fri Oct 01 2021 Tadej Janež - 1.2.0-13 +- Backport upstream PR #214 to enable Pew to be used on recent Fedora versions + * Fri Jul 23 2021 Fedora Release Engineering - 1.2.0-12 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild