ecb620
%bcond bootstrap 0
ecb620
%bcond tests %{without bootstrap}
ecb620
0c63f5
Name:           python-virtualenv
ecb620
Version:        20.26.6
ecb620
Release:        %autorelease
0c63f5
Summary:        Tool to create isolated Python environments
0c63f5
0c63f5
License:        MIT
ecb620
URL:            http://pypi.python.org/pypi/virtualenv
ecb620
Source:         %{pypi_source virtualenv}
5dfcf4
ecb620
# Add /usr/share/python-wheels to extra_search_dir
ecb620
Patch:          rpm-wheels.patch
978cfa
ecb620
BuildArch:      noarch
978cfa
ecb620
BuildRequires:  python3-devel
ecb620
ecb620
%if %{with tests}
ecb620
BuildRequires:  fish
ecb620
BuildRequires:  tcsh
ecb620
BuildRequires:  gcc
ecb620
# from the [test] extra, but manually filtered, version bounds removed
ecb620
BuildRequires:  python3-flaky
ecb620
BuildRequires:  python3-packaging
ecb620
BuildRequires:  python3-pytest
ecb620
BuildRequires:  python3-pytest-env
ecb620
#BuildRequires: python3-pytest-freezer -- not available, tests skipped
ecb620
BuildRequires:  python3-pytest-mock
ecb620
BuildRequires:  python3-pytest-randomly
ecb620
BuildRequires:  python3-pytest-timeout
ecb620
BuildRequires:  python3-setuptools
ecb620
BuildRequires:  python3-time-machine
ecb620
%endif
b23d18
ecb620
# RPM installed wheels
ecb620
BuildRequires:  %{python_wheel_pkg_prefix}-pip-wheel
ecb620
BuildRequires:  %{python_wheel_pkg_prefix}-setuptools-wheel
ecb620
BuildRequires:  %{python_wheel_pkg_prefix}-wheel-wheel
b23d18
ecb620
%global _description %{expand:
ecb620
virtualenv is a tool to create isolated Python environments.
ecb620
A subset of it has been integrated into the Python standard library under
ecb620
the venv module. The venv module does not offer all features of this library,
ecb620
to name just a few more prominent:
175766
ecb620
- is slower (by not having the app-data seed method),
ecb620
- is not as extendable,
ecb620
- cannot create virtual environments for arbitrarily installed Python versions
ecb620
  (and automatically discover these),
ecb620
- does not have as rich programmatic API (describe virtual environments
ecb620
  without creating them).}
0c63f5
ecb620
%description %_description
b23d18
0c63f5
ecb620
%package -n     python3-virtualenv
ecb620
Summary:        Tool to create isolated Python environments
5dfcf4
ecb620
# Provide "virtualenv" for convenience
ecb620
Provides:       virtualenv = %{version}-%{release}
0c63f5
ecb620
# RPM installed wheels
ecb620
Requires:       %{python_wheel_pkg_prefix}-pip-wheel
ecb620
# Python 3.12 virtualenvs are created without setuptools/wheel,
ecb620
# but the users can still do --wheel=bundle --setuptools=bundle to force them:
ecb620
Requires:       %{python_wheel_pkg_prefix}-setuptools-wheel
ecb620
Requires:       %{python_wheel_pkg_prefix}-wheel-wheel
ecb620
# This was a requirement for Python 3.6+2.7 virtual environments
ecb620
Obsoletes:      %{python_wheel_pkg_prefix}-wheel0.37-wheel < 0.37.1-20
0c63f5
ecb620
%description -n python3-virtualenv %_description
0c63f5
0c63f5
0c63f5
%prep
ecb620
%autosetup -p1 -n virtualenv-%{version}
0c63f5
ecb620
# Remove the wheels provided by RPM packages
ecb620
rm src/virtualenv/seed/wheels/embed/pip-*
ecb620
rm src/virtualenv/seed/wheels/embed/setuptools-*
ecb620
rm src/virtualenv/seed/wheels/embed/wheel-*
0c63f5
ecb620
test ! -f src/virtualenv/seed/embed/wheels/*.whl
5dfcf4
ecb620
# Replace hardcoded path from rpm-wheels.patch by %%{python_wheel_dir}
ecb620
# On Fedora, this should change nothing, but when building for RHEL9+, it will
ecb620
sed -i "s|/usr/share/python-wheels|%{python_wheel_dir}|" src/virtualenv/util/path/_system_wheels.py
0c63f5
ecb620
%generate_buildrequires
ecb620
%pyproject_buildrequires
0c63f5
ecb620
%build
ecb620
%pyproject_wheel
0c63f5
ecb620
%install
ecb620
%pyproject_install
ecb620
%pyproject_save_files -l virtualenv
ecb620
ecb620
%check
ecb620
%pyproject_check_import -e '*activate_this' -e '*windows*'
ecb620
%if %{with tests}
ecb620
# Skip tests which requires internet or some extra dependencies
ecb620
# Requires internet:
ecb620
# - test_download_*
ecb620
# - test_can_build_c_extensions
ecb620
# Uses disabled functionalities around bundled wheels:
ecb620
# - test_wheel_*
ecb620
# - test_seed_link_via_app_data
ecb620
# - test_base_bootstrap_via_pip_invoke
ecb620
# - test_acquire.py (whole file)
ecb620
# - test_bundle.py (whole file)
ecb620
# Uses disabled functionalities around automatic updates:
ecb620
# - test_periodic_update.py (whole file)
ecb620
PIP_CERT=/etc/pki/tls/certs/ca-bundle.crt \
ecb620
%pytest -vv -k "not test_bundle and \
ecb620
                not test_acquire and \
ecb620
                not test_periodic_update and \
ecb620
                not test_wheel_ and \
ecb620
                not test_download_ and \
ecb620
                not test_can_build_c_extensions and \
ecb620
                not test_base_bootstrap_via_pip_invoke and \
ecb620
                not test_seed_link_via_app_data"
0c63f5
%endif
0c63f5
ecb620
%files -n python3-virtualenv -f %{pyproject_files}
ecb620
%doc README.md
ecb620
%{_bindir}/virtualenv
0c63f5
0c63f5
%changelog
ecb620
%autochangelog