99a46d
%bcond bootstrap 1
ecb620
%bcond tests %{without bootstrap}
ecb620
0c63f5
Name:           python-virtualenv
550ee8
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
550ee8
Source:         %{pypi_source virtualenv}
5dfcf4
ecb620
# Add /usr/share/python-wheels to extra_search_dir
550ee8
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
550ee8
# from the [test] extra, but manually filtered, version bounds removed
ecb620
BuildRequires:  python3-flaky
ecb620
BuildRequires:  python3-packaging
ecb620
BuildRequires:  python3-pytest
550ee8
BuildRequires:  python3-pytest-env
550ee8
#BuildRequires: python3-pytest-freezer -- not available, tests skipped
ecb620
BuildRequires:  python3-pytest-mock
ecb620
BuildRequires:  python3-pytest-randomly
ecb620
BuildRequires:  python3-pytest-timeout
550ee8
BuildRequires:  python3-setuptools
550ee8
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
550ee8
%global _description %{expand:
550ee8
virtualenv is a tool to create isolated Python environments.
550ee8
A subset of it has been integrated into the Python standard library under
550ee8
the venv module. The venv module does not offer all features of this library,
550ee8
to name just a few more prominent:
b23d18
550ee8
- is slower (by not having the app-data seed method),
550ee8
- is not as extendable,
550ee8
- cannot create virtual environments for arbitrarily installed Python versions
550ee8
  (and automatically discover these),
550ee8
- does not have as rich programmatic API (describe virtual environments
550ee8
  without creating them).}
0c63f5
550ee8
%description %_description
5dfcf4
99a46d
550ee8
%package -n     python3-virtualenv
550ee8
Summary:        Tool to create isolated Python environments
99a46d
ecb620
# Provide "virtualenv" for convenience
ecb620
Provides:       virtualenv = %{version}-%{release}
0c63f5
ecb620
# RPM installed wheels
ecb620
Requires:       %{python_wheel_pkg_prefix}-pip-wheel
550ee8
# Python 3.12 virtualenvs are created without setuptools/wheel,
550ee8
# 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
550ee8
# This was a requirement for Python 3.6+2.7 virtual environments
550ee8
Obsoletes:      %{python_wheel_pkg_prefix}-wheel0.37-wheel < 0.37.1-20
0c63f5
550ee8
%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
550ee8
%pyproject_save_files -l virtualenv
ecb620
99a46d
%check
550ee8
%pyproject_check_import -e '*activate_this' -e '*windows*'
550ee8
%if %{with tests}
ecb620
# Skip tests which requires internet or some extra dependencies
ecb620
# Requires internet:
ecb620
# - test_download_*
550ee8
# - 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 \
550ee8
                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