Showing with 216 additions and 51 deletions.
  1. +1 −0 .gitignore
  2. +120 −0 0001-Remove-Python-version-management-on-Fedora.patch
  3. +0 −23 0001-tests-connection-marker-fix.patch
  4. +19 −1 README.md
  5. +75 −26 pew.spec
  6. +1 −1 sources
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/pew-1.1.2.tar.gz
/pew-1.2.0.tar.gz
120 changes: 120 additions & 0 deletions 0001-Remove-Python-version-management-on-Fedora.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
From e43b1f4a04e3b5ce841a0dbb125bc87fc330bc13 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tadej=20Jane=C5=BE?= <tadej.j@nez.si>
Date: Wed, 12 Jun 2019 23:28:13 +0200
Subject: [PATCH] Remove Python version management on Fedora

This removes the pythonz-bd dependency which is not available in Fedora
anymore.
Furthermore, there is strong support upstream to either remove Pew's
Python version management or replace it with pyenv:
https://github.com/berdario/pew/issues/195.
---
pew/pew.py | 22 +++-------------------
pew/shell_config/complete.fish | 9 ---------
pew/shell_config/complete.zsh | 3 ---
tests/test_install.py | 29 -----------------------------
4 files changed, 3 insertions(+), 60 deletions(-)
delete mode 100644 tests/test_install.py

diff --git a/pew/pew.py b/pew/pew.py
index c588a2e..2ffea2f 100644
--- a/pew/pew.py
+++ b/pew/pew.py
@@ -19,25 +19,9 @@ windows = sys.platform == 'win32'

from clonevirtualenv import clone_virtualenv
if not windows:
- try:
- # Try importing these packages if avaiable
- from pythonz.commands.install import InstallCommand
- from pythonz.commands.uninstall import UninstallCommand
- from pythonz.installer.pythoninstaller import PythonInstaller, AlreadyInstalledError
- from pythonz.commands.list import ListCommand
- from pythonz.define import PATH_PYTHONS
- from pythonz.commands.locate import LocateCommand as LocatePython
-
- def ListPythons():
- try:
- Path(PATH_PYTHONS).mkdir(parents=True)
- except OSError:
- pass
- return ListCommand()
- except:
- # create mock commands
- InstallCommand = ListPythons = LocatePython = UninstallCommand = \
- lambda : sys.exit('You need to install the pythonz extra. pip install pew[pythonz]')
+ # Mock Pythonz commands
+ InstallCommand = ListPythons = LocatePython = UninstallCommand = \
+ lambda : sys.exit('Python version management is not supported on Fedora.')
else:
# Pythonz does not support windows
InstallCommand = ListPythons = LocatePython = UninstallCommand = \
diff --git a/pew/shell_config/complete.fish b/pew/shell_config/complete.fish
index af9f6d2..5dd0195 100644
--- a/pew/shell_config/complete.fish
+++ b/pew/shell_config/complete.fish
@@ -105,12 +105,3 @@ complete -f -c $pew -n '__pew_using_command workon' -a '(__pew_list_envs)' -d 'V

#### rename
complete -f -c $pew -n '__pew_needs_command' -a rename -d 'Rename a virtualenv'
-
-#### install
-complete -f -c $pew -n '__pew_needs_command' -a install -d 'Use Pythonz to download and build a Python vm'
-
-#### list_pythons
-complete -f -c $pew -n '__pew_needs_command' -a list_pythons -d 'List the pythons installed by Pythonz'
-
-#### locate_python
-complete -f -c $pew -n '__pew_needs_command' -a locate_python -d 'Locate the path for the python version installed by Pythonz'
diff --git a/pew/shell_config/complete.zsh b/pew/shell_config/complete.zsh
index 623fbff..e3a9aa5 100644
--- a/pew/shell_config/complete.zsh
+++ b/pew/shell_config/complete.zsh
@@ -23,9 +23,6 @@ case $state in
'add:Add directories to python path of active virtualenv'
'cp:Duplicate the named virtualenv to make a new one'
'inall:Run a command in each virtualenv:command'
- 'install:Use Pythonz to download and build the specified Python version'
- 'list_pythons:List the pythons installed by Pythonz (or all the installable ones)'
- 'locate_python:Locate the path for the python version installed by Pythonz'
'ls:List all existing virtual environments'
'lssitepackages:List currently active site-packages'
'mkproject:Create environment with an associated project directory'
diff --git a/tests/test_install.py b/tests/test_install.py
deleted file mode 100644
index 478ccbb..0000000
--- a/tests/test_install.py
+++ /dev/null
@@ -1,29 +0,0 @@
-import sys
-import os
-from subprocess import check_call
-from pew._utils import invoke_pew as invoke
-from utils import skip_windows, connection_required
-import pytest
-
-def skip_marker(f):
- return skip_windows(reason='Pythonz unavailable in Windows')(
- pytest.mark.skipif(
- sys.platform == 'cygwin',
- reason='Pythonz unavailable in Cygwin')(
- pytest.mark.skipif(os.environ.get('NIX'),
- reason='Pythonz unavailable in Nix')(
- connection_required(f))))
-
-@skip_marker
-def test_install():
- py_version = ['2.6.1', '--type', 'pypy']
- assert invoke('install', *py_version).returncode == 0
- py = invoke('locate_python', *py_version).out
- check_call([py, '-V'])
-
-@skip_marker
-def test_uninstall():
- py_version = ['2.6.1', '--type', 'pypy']
- invoke('install', *py_version)
- assert invoke('uninstall', *py_version).returncode == 0
- assert invoke('locate_python', *py_version).returncode != 0
--
2.21.0

23 changes: 0 additions & 23 deletions 0001-tests-connection-marker-fix.patch

This file was deleted.

20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
# pew
# Pew

Python Env Wrapper is a set of commands to manage multiple virtual
environments. 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.

## Python version management functionality is removed in Fedora 30+

Fedora provides excellent native means for using multiple different Python
versions. One can install a non-default Python version, e.g. Python 3.6, by
using:

```
sudo dnf install python36
```

For more information, refer to:
https://developer.fedoraproject.org/tech/languages/python/multiple-pythons.html.

Hence, removing the Python versions management from Pew itself should really
be a non-issue.
In addition, there is strong support upstream to either remove Pew's Python
version management or replace it with pyenv:
https://github.com/berdario/pew/issues/195.
101 changes: 75 additions & 26 deletions pew.spec
Original file line number Diff line number Diff line change
@@ -1,68 +1,117 @@
%bcond_without check

Name: pew
Version: 1.1.2
Release: 4%{?dist}
Summary: Tool to manage multiple virtualenvs written in pure Python
%bcond_without check

%if 0%{?fedora} >= 30
# NOTE: Since pythonz-bd dependency is not available in Fedora 30+, the Python
# version management functionality must be removed.
%bcond_with py_ver_management
%else
%bcond_without py_ver_management
%endif

License: MIT
URL: https://github.com/berdario/pew
Source0: https://github.com/berdario/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
Name: pew
Version: 1.2.0
Release: 1%{?dist}
Summary: Tool to manage multiple virtualenvs written in pure Python

License: MIT
URL: https://github.com/berdario/pew
Source0: https://github.com/berdario/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
Source1: README.md

# This patch removes Python version management on Fedora.
#
# NOTE: This removes the pythonz-bd dependency which is not available in Fedora
# anymore.
# Furthermore, there is strong support upstream to either remove Pew's
# Python version management or replace it with pyenv:
# https://github.com/berdario/pew/issues/195.
Patch0: 0001-Remove-Python-version-management-on-Fedora.patch

BuildArch: noarch

BuildRequires: python3-devel
BuildRequires: python3dist(setuptools)
BuildRequires: python3dist(virtualenv) >= 1.11
BuildRequires: python3dist(virtualenv-clone) >= 0.2.5
%if %{with py_ver_management}
BuildRequires: python3dist(pythonz-bd) >= 1.10.2
%endif
# Required for %%autosetup.
BuildRequires: git-core

# Add pytest marker to test requiring connection
Patch0: 0001-tests-connection-marker-fix.patch
%if %{with check}
BuildRequires: python3dist(pytest)
BuildRequires: python3dist(pip)
%endif

BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: python3dist(setuptools)
BuildRequires: python3dist(virtualenv) >= 1.11
BuildRequires: python3dist(virtualenv-clone) >= 0.2.5
BuildRequires: python3dist(pythonz-bd) >= 1.10.2
# NOTE: The automatic Python dependency generator is enabled by default in
# Fedora 30+.
%if 0%{?fedora} == 29
%{?python_enable_dependency_generator}
%endif

%if %{with check}
BuildRequires: python3dist(pytest)
BuildRequires: python3dist(pip)
%if %{with py_ver_management}
# NOTE: The pythonz-bd dependency is not included by automatic dependency
# generator because it is defined as the pythonz extra requirement in setup.py.
Requires: python3dist(pythonz-bd) >= 1.10.2
%endif

%{?python_provide:%python_provide python3-%{name}}
Requires: python3dist(setuptools) >= 17.1
Requires: python3dist(virtualenv) >= 1.11
Requires: python3dist(virtualenv-clone) >= 0.2.5
Requires: python3dist(pythonz-bd) >= 1.10.2

%description
Python Env Wrapper is a set of commands to manage multiple virtual
environments. 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.


%prep
%autosetup -p1 -n %{name}-%{version}
%autosetup -n %{name}-%{version} -N -S git
%if %{without py_ver_management}
%autopatch
%endif

# Rename the Fedora-specific README.md to avoid conflict with the upstream
# README.md.
# NOTE: The source file should stay named README.md so that Pagure renders it
# when one visits https://src.fedoraproject.org/rpms/pew.
mv %{SOURCE1} README.Fedora.md

# This script for shell completion can't be used for Fedora package
rm -rf %{name}/shell_config/complete_deploy


%build
%py3_build


%install
%py3_install


%if %{with check}
%check
export PATH=$PATH:%{buildroot}%{_bindir}
export PYTHONPATH=$PYTHONPATH:%{buildroot}%{python3_sitelib}
py.test-3 -vv tests
%endif


%files
%license LICENSE
%doc README.md
%doc README.md README.Fedora.md
%{_bindir}/pew
%{python3_sitelib}/%{name}
%{python3_sitelib}/%{name}-%{version}-py?.?.egg-info


%changelog
* Wed Jun 12 2019 Tadej Janež <tadej.j@nez.si> 1.2.0-1
- Update to 1.2.0 release
- Drop the tests-connection-marker-fix patch since it has been upstreamed
- Remove Python version management functionality in Fedora 30+
- Use automatic Python dependency generator

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

Expand Down
2 changes: 1 addition & 1 deletion sources
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SHA512 (pew-1.1.2.tar.gz) = 7bf479356f1142853be2c3b00759733c2d734b5389b74d7c28e4538742c5d64ae425361f88caf84eff6f6118045dc7a9f2b9987db8c4e870b204b7e18ff90dc7
SHA512 (pew-1.2.0.tar.gz) = c96698fd6f85bf8e6669a380e6497c1036ca5ef7a581ea6ccee1718baef289baa1052f2543e447d65f73567c277365e4b1ef1a6af4efc7a7e9dec6a454251971