Name: python3-virtualenv
Version: 20.15.1
Release: 1%{?dist}
Summary: Tool to create isolated Python environments
License: MIT
URL: http://pypi.python.org/pypi/virtualenv
Source0: %{pypi_source virtualenv}
# Add /usr/share/python-wheels to extra_search_dir
Patch1: rpm-wheels.patch
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: python3-distlib
BuildRequires: python3-filelock
BuildRequires: python3-platformdirs
BuildRequires: python3-setuptools
BuildRequires: python3-setuptools_scm
BuildRequires: python3-six
# docs need sphinx >= 3
# docs need towncrier and that is not yet available when bootstrapping Python
%bcond_with docs
%if %{with docs}
BuildRequires: python3-sphinx
BuildRequires: python3-sphinx_rtd_theme
BuildRequires: python3-towncrier
%endif
# tests don't have all dependencies in EPEL 9 (yet?)
%bcond_with tests
%if %{with tests}
BuildRequires: fish
BuildRequires: tcsh
BuildRequires: gcc
BuildRequires: python3-flaky
BuildRequires: python3-packaging
BuildRequires: python3-pytest
BuildRequires: python3-pytest-mock
BuildRequires: python3-pytest-randomly
BuildRequires: python3-pytest-timeout
%endif
# RPM installed wheels
BuildRequires: python3-pip-wheel
BuildRequires: python3-setuptools-wheel
BuildRequires: python3-wheel-wheel
# Provide "virtualenv" for convenience
Provides: virtualenv = %{version}-%{release}
# RPM installed wheels
Requires: python3-pip-wheel
Requires: python3-setuptools-wheel
Requires: python3-wheel-wheel
%description
virtualenv is a tool to create isolated Python environments. virtualenv
is a successor to workingenv, and an extension of virtual-python. It is
written by Ian Bicking, and sponsored by the Open Planning Project. It is
licensed under an MIT-style permissive license.
%if %{with docs}
%package -n python-virtualenv-doc
Summary: Documentation for python virtualenv
%description -n python-virtualenv-doc
Documentation for python virtualenv.
%endif
%prep
%autosetup -p1 -n virtualenv-%{version}
sed -i -e "1s|#!/usr/bin/env python||" tasks/update_embedded.py
# Remove the wheels provided by RPM packages
rm src/virtualenv/seed/wheels/embed/pip-*
rm src/virtualenv/seed/wheels/embed/setuptools-*
rm src/virtualenv/seed/wheels/embed/wheel-*
test ! -f src/virtualenv/seed/embed/wheels/*.whl
# Replace hardcoded path from rpm-wheels.patch by %%{python_wheel_dir}
# On Fedora, this should change nothing, but when building for RHEL9+, it will
sed -i "s|/usr/share/python-wheels|%{python_wheel_dir}|" src/virtualenv/util/path/_system_wheels.py
%build
# Build code
%{py3_build}
# Build docs
%if %{with docs}
PYTHONPATH=src %{python3} setup.py build_sphinx
rm -f build/sphinx/html/.buildinfo
%endif
%install
%{py3_install}
%if %{with tests}
%check
mkdir tmp_path
ln -s $(realpath %{__python3}) tmp_path/python
export PATH="$(pwd)/tmp_path:$PATH"
unset SOURCE_DATE_EPOCH
# Skip tests which requires internet or some extra dependencies
# Requires internet:
# - test_download_*
# Uses disabled functionalities around bundled wheels:
# - test_wheel_*
# - test_seed_link_via_app_data
# - test_base_bootstrap_via_pip_invoke
# - test_acquire.py (whole file)
# - test_bundle.py (whole file)
# Uses disabled functionalities around automatic updates:
# - test_periodic_update.py (whole file)
PIP_CERT=/etc/pki/tls/certs/ca-bundle.crt \
%pytest -vv -k "not test_bundle and not test_acquire and not test_periodic_update and not test_wheel_ and not test_download_ and not test_base_bootstrap_via_pip_invoke and not test_seed_link_via_app_data"
rm -r tmp_path
%endif
%files -n python3-virtualenv
%license LICENSE
%doc docs/*rst README.md
%{_bindir}/virtualenv
%{python3_sitelib}/virtualenv/
%{python3_sitelib}/virtualenv-*.egg-info/
%if %{with docs}
%files -n python-virtualenv-doc
%doc build/sphinx/*
%endif
%changelog