Amend a fix for --download with old Pythons not to break --seeder pip with new Pythons

Fixes: rhbz#2328956

Since the fix for rhbz#2272958 landed in EPEL 9,
it is not possible to use `virtualenv --seeder pip --python=python3.12`
as it fails with:

    $ virtualenv -vvvv --seeder pip --python=python3.12 venv
    ...
    86 add seed packages via PipInvoke(download=False, pip=bundle) [INFO session:55]
    167 pip seed by running: /builddir/venv/bin/python -m pip -q install --only-binary :all: --disable-pip-version-check --no-index pip==23.2.1 --find-links /usr/share/python3.12-wheels env of {'SHELL': '/bin/bash', 'HISTCONTROL': 'ignoredups', 'HISTSIZE': '1000', 'HOSTNAME': '815503ada5e04dfd9391f4c02f5e0aa2', 'container_host_version_id': '41', 'PWD': '/builddir', 'LOGNAME': 'mockbuild', 'container': 'systemd-nspawn', 'HOME': '/builddir', 'LANG': 'C.UTF-8', 'LS_COLORS': 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.m4a=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.oga=01;36:*.opus=01;36:*.spx=01;36:*.xspf=01;36:', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'TERM': 'vt100', 'USER': 'mockbuild', 'NOTIFY_SOCKET': '/run/host/notify', 'SHLVL': '1', 'container_host_id': 'fedora', 'PS1': '<mock-chroot> \\s-\\v\\$ ', 'DEBUGINFOD_URLS': 'https://debuginfod.centos.org/ ', 'which_declare': 'declare -f', 'container_host_variant_id': 'xfce', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin', 'MAIL': '/var/spool/mail/mockbuild', 'container_uuid': 'cb2fba57-8768-4fdc-bda2-55c92f437ac2', 'OLDPWD': '/builddir', 'BASH_FUNC_which%%': '() {  ( alias;\n eval ${which_declare} ) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@\n}', '_': '/usr/bin/virtualenv', 'PLAT': 'linux-x86_64', 'PIP_USE_WHEEL': '1', 'PIP_USER': '0', 'PIP_NO_INPUT': '1', 'PYTHONPATH': '/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl'} [DEBUG pip_invoke:26]
    Traceback (most recent call last):
      File "<frozen runpy>", line 198, in _run_module_as_main
      File "<frozen runpy>", line 88, in _run_code
      File "/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl/pip/__main__.py", line 29, in <module>
      File "/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl/pip/_internal/cli/main.py", line 9, in <module>
      File "/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl/pip/_internal/cli/autocompletion.py", line 10, in <module>
      File "/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl/pip/_internal/cli/main_parser.py", line 8, in <module>
      File "/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl/pip/_internal/cli/cmdoptions.py", line 23, in <module>
      File "/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl/pip/_internal/cli/parser.py", line 12, in <module>
      File "/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl/pip/_internal/configuration.py", line 20, in <module>
      File "/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl/pip/_internal/exceptions.py", line 7, in <module>
      File "/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 2164, in <module>
    AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
    371 RuntimeError: failed seed with code 1 [ERROR __main__:61]

This changes the patch in a way that makes both work.

(cherry picked from commit e63113aa81b4a1e1e8293b1884cba61c7e23e610)
epel9
Miro Hrončok 3 months ago
parent 37281f6553
commit 2ecd9f5d91

@ -1,4 +1,4 @@
From 915453288bf883c912f2b31bc654ed24e0382a0f Mon Sep 17 00:00:00 2001
From 3f22c840a0b26dae8dd09985501eaa33846f063c Mon Sep 17 00:00:00 2001
From: Lumir Balhar <lbalhar@redhat.com>
Date: Thu, 27 Oct 2022 11:50:54 +0200
Subject: [PATCH] RPM wheels
@ -101,25 +101,23 @@ index f31ecf6..d7a0f5a 100644
pip_version = name_to_whl["pip"].version_tuple if "pip" in name_to_whl else None
installer_class = self.installer_class(pip_version)
diff --git a/src/virtualenv/seed/wheels/acquire.py b/src/virtualenv/seed/wheels/acquire.py
index 21fde34..d6ae171 100644
index 21fde34..4370b0d 100644
--- a/src/virtualenv/seed/wheels/acquire.py
+++ b/src/virtualenv/seed/wheels/acquire.py
@@ -97,13 +97,14 @@ def find_compatible_in_house(distribution, version_spec, for_py_version, in_fold
def pip_wheel_env_run(search_dirs, app_data, env):
+ from virtualenv.util.path._system_wheels import get_system_wheels_paths
env = env.copy()
env.update({"PIP_USE_WHEEL": "1", "PIP_USER": "0", "PIP_NO_INPUT": "1"})
wheel = get_wheel(
distribution="pip",
version=None,
for_py_version=f"{sys.version_info.major}.{sys.version_info.minor}",
- search_dirs=search_dirs,
+ search_dirs=get_system_wheels_paths(sys),
download=False,
app_data=app_data,
do_periodic_update=False,
@@ -24,11 +24,12 @@ def get_wheel(distribution, version, for_py_version, search_dirs, download, app_
if download and wheel is None and version != Version.embed:
# 2. download from the internet
+ from virtualenv.util.path._system_wheels import get_system_wheels_paths
wheel = download_wheel(
distribution=distribution,
version_spec=Version.as_version_spec(version),
for_py_version=for_py_version,
- search_dirs=search_dirs,
+ search_dirs=get_system_wheels_paths(sys),
app_data=app_data,
to_folder=app_data.house,
env=env,
diff --git a/src/virtualenv/seed/wheels/embed/__init__.py b/src/virtualenv/seed/wheels/embed/__init__.py
index 782051a..71ec712 100644
--- a/src/virtualenv/seed/wheels/embed/__init__.py
@ -170,5 +168,5 @@ index 0000000..fc7e942
+ if wheels_dir.exists():
+ yield wheels_dir
--
2.44.0
2.47.0

Loading…
Cancel
Save