From 1d39571daddfe8312248cb3cd107fb8cd9d90568 Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Wed, 3 Apr 2024 16:58:07 +0300 Subject: [PATCH] import python-virtualenv-15.1.0-22.module+el8.9.0+19487+7dc18407 --- .gitignore | 1 + .python-virtualenv.metadata | 1 + SOURCES/check-exec_dir.patch | 16 + .../dont-fail-on-missing-certifi-cert.patch | 102 ++++ SOURCES/python3.10.patch | 230 ++++++++ SOURCES/python3.11-error.patch | 20 + SOURCES/rpm-wheels.patch | 125 +++++ SPECS/python-virtualenv.spec | 519 ++++++++++++++++++ 8 files changed, 1014 insertions(+) create mode 100644 .gitignore create mode 100644 .python-virtualenv.metadata create mode 100644 SOURCES/check-exec_dir.patch create mode 100644 SOURCES/dont-fail-on-missing-certifi-cert.patch create mode 100644 SOURCES/python3.10.patch create mode 100644 SOURCES/python3.11-error.patch create mode 100644 SOURCES/rpm-wheels.patch create mode 100644 SPECS/python-virtualenv.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3674286 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/virtualenv-15.1.0.tar.gz diff --git a/.python-virtualenv.metadata b/.python-virtualenv.metadata new file mode 100644 index 0000000..dbe103b --- /dev/null +++ b/.python-virtualenv.metadata @@ -0,0 +1 @@ +995ce0fa007210ac2f10258999d06813ecdd6eeb SOURCES/virtualenv-15.1.0.tar.gz diff --git a/SOURCES/check-exec_dir.patch b/SOURCES/check-exec_dir.patch new file mode 100644 index 0000000..3173786 --- /dev/null +++ b/SOURCES/check-exec_dir.patch @@ -0,0 +1,16 @@ +diff --git a/virtualenv.py b/virtualenv.py +index c4e3bd5..89b8863 100755 +--- a/virtualenv.py ++++ b/virtualenv.py +@@ -1181,8 +1181,9 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, sy + exec_dir = join(sys.exec_prefix, 'Lib') + else: + exec_dir = join(sys.exec_prefix, 'lib', py_version) +- for fn in os.listdir(exec_dir): +- copyfile(join(exec_dir, fn), join(lib_dir, fn), symlink) ++ if os.path.isdir(exec_dir): ++ for fn in os.listdir(exec_dir): ++ copyfile(join(exec_dir, fn), join(lib_dir, fn), symlink) + + if is_jython: + # Jython has either jython-dev.jar and javalib/ dir, or just diff --git a/SOURCES/dont-fail-on-missing-certifi-cert.patch b/SOURCES/dont-fail-on-missing-certifi-cert.patch new file mode 100644 index 0000000..73478a3 --- /dev/null +++ b/SOURCES/dont-fail-on-missing-certifi-cert.patch @@ -0,0 +1,102 @@ +diff --git a/tests/test_virtualenv.py b/tests/test_virtualenv.py +index ce45ede..7946a16 100644 +--- a/tests/test_virtualenv.py ++++ b/tests/test_virtualenv.py +@@ -4,11 +4,16 @@ import os + import shutil + import sys + import tempfile ++import zipfile + import pytest + import platform # noqa + + from mock import patch, Mock + ++try: ++ from pathlib import Path ++except ImportError: ++ from pathlib2 import Path + + def test_version(): + """Should have a version string""" +@@ -139,3 +144,44 @@ def test_always_copy_option(): + " symlink (to %s)" % (full_name, os.readlink(full_name)) + finally: + shutil.rmtree(tmp_virtualenv) ++ ++ ++def test_missing_certifi_pem(tmp_path): ++ """Make sure that we can still create virtual environment if pip is ++ patched to not use certifi's cacert.pem and the file is removed. ++ This can happen if pip is packaged by Linux distributions.""" ++ proj_dir = Path(__file__).parent.parent ++ support_original = proj_dir / "virtualenv_support" ++ pip_wheel = sorted(support_original.glob("pip*whl"))[0] ++ whl_name = pip_wheel.name ++ ++ wheeldir = tmp_path / "wheels" ++ wheeldir.mkdir() ++ tmpcert = tmp_path / "tmpcert.pem" ++ cacert = "pip/_vendor/requests/cacert.pem" ++ certifi = "pip/_vendor/requests/certs.py" ++ oldpath = b"os.path.join(os.path.dirname(__file__), 'cacert.pem')" ++ newpath = "r'{}'".format(tmpcert).encode() ++ removed = False ++ replaced = False ++ ++ with zipfile.ZipFile(str(pip_wheel), "r") as whlin: ++ with zipfile.ZipFile(str(wheeldir / whl_name), "w") as whlout: ++ for item in whlin.infolist(): ++ buff = whlin.read(item.filename) ++ if item.filename == cacert: ++ tmpcert.write_bytes(buff) ++ removed = True ++ continue ++ if item.filename == certifi: ++ nbuff = buff.replace(oldpath, newpath) ++ assert nbuff != buff ++ buff = nbuff ++ replaced = True ++ whlout.writestr(item, buff) ++ ++ assert removed and replaced ++ ++ venvdir = tmp_path / "venv" ++ search_dirs = [str(wheeldir), str(support_original)] ++ virtualenv.create_environment(str(venvdir), search_dirs=search_dirs) +diff --git a/virtualenv.egg-info/PKG-INFO b/virtualenv.egg-info/PKG-INFO +index 11f5c75..501e81a 100644 +--- a/virtualenv.egg-info/PKG-INFO ++++ b/virtualenv.egg-info/PKG-INFO +@@ -1,10 +1,12 @@ +-Metadata-Version: 1.1 ++Metadata-Version: 1.2 + Name: virtualenv + Version: 15.1.0 + Summary: Virtual Python Environment builder + Home-page: https://virtualenv.pypa.io/ +-Author: Jannis Leidel, Carl Meyer and Brian Rosner +-Author-email: python-virtualenv@groups.google.com ++Author: Ian Bicking ++Author-email: ianb@colorstudy.com ++Maintainer: Jannis Leidel, Carl Meyer and Brian Rosner ++Maintainer-email: python-virtualenv@groups.google.com + License: MIT + Description: Virtualenv + ========== +diff --git a/virtualenv.py b/virtualenv.py +index a174b8a..5699998 100755 +--- a/virtualenv.py ++++ b/virtualenv.py +@@ -861,7 +861,10 @@ def install_wheel(project_names, py_executable, search_dirs=None, + + import pip + +- cert_data = pkgutil.get_data("pip._vendor.requests", "cacert.pem") ++ try: ++ cert_data = pkgutil.get_data("pip._vendor.requests", "cacert.pem") ++ except IOError: ++ cert_data = None + if cert_data is not None: + cert_file = tempfile.NamedTemporaryFile(delete=False) + cert_file.write(cert_data) diff --git a/SOURCES/python3.10.patch b/SOURCES/python3.10.patch new file mode 100644 index 0000000..b0c54b0 --- /dev/null +++ b/SOURCES/python3.10.patch @@ -0,0 +1,230 @@ +diff --git a/virtualenv.py b/virtualenv.py +index 9854324..e5d0883 100755 +--- a/virtualenv.py ++++ b/virtualenv.py +@@ -49,7 +49,8 @@ try: + except NameError: + basestring = str + +-py_version = 'python%s.%s' % (sys.version_info[0], sys.version_info[1]) ++version = '%s.%s' % (sys.version_info[0], sys.version_info[1]) ++py_version = 'python%s' % version + + is_jython = sys.platform.startswith('java') + is_pypy = hasattr(sys, 'pypy_version_info') +@@ -1012,13 +1013,13 @@ def change_prefix(filename, dst_prefix): + + if is_darwin: + prefixes.extend(( +- os.path.join("/Library/Python", sys.version[:3], "site-packages"), ++ os.path.join("/Library/Python", version, "site-packages"), + os.path.join(sys.prefix, "Extras", "lib", "python"), +- os.path.join("~", "Library", "Python", sys.version[:3], "site-packages"), ++ os.path.join("~", "Library", "Python", version, "site-packages"), + # Python 2.6 no-frameworks +- os.path.join("~", ".local", "lib","python", sys.version[:3], "site-packages"), ++ os.path.join("~", ".local", "lib","python", version, "site-packages"), + # System Python 2.7 on OSX Mountain Lion +- os.path.join("~", "Library", "Python", sys.version[:3], "lib", "python", "site-packages"))) ++ os.path.join("~", "Library", "Python", version, "lib", "python", "site-packages"))) + + if hasattr(sys, 'real_prefix'): + prefixes.append(sys.real_prefix) +@@ -1099,7 +1100,7 @@ def copy_required_modules(dst_prefix, symlink): + # special-case custom readline.so on OS X, but not for pypy: + if modname == 'readline' and sys.platform == 'darwin' and not ( + is_pypy or filename.endswith(join('lib-dynload', 'readline.so'))): +- dst_filename = join(dst_prefix, 'lib', 'python%s' % sys.version[:3], 'readline.so') ++ dst_filename = join(dst_prefix, 'lib', py_version, 'readline.so') + elif modname == 'readline' and sys.platform == 'win32': + # special-case for Windows, where readline is not a + # standard module, though it may have been installed in +@@ -1398,8 +1399,7 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, sy + if not is_win: + # Ensure that 'python', 'pythonX' and 'pythonX.Y' all exist + py_exe_version_major = 'python%s' % sys.version_info[0] +- py_exe_version_major_minor = 'python%s.%s' % ( +- sys.version_info[0], sys.version_info[1]) ++ py_exe_version_major_minor = py_version + py_exe_no_version = 'python' + required_symlinks = [ py_exe_no_version, py_exe_version_major, + py_exe_version_major_minor ] +@@ -1547,7 +1547,8 @@ def fix_local_scheme(home_dir, symlink=True): + except ImportError: + pass + else: +- if sysconfig._get_default_scheme() == 'posix_local': ++ get_scheme = getattr(sysconfig, 'get_default_scheme', None) or sysconfig._get_default_scheme ++ if get_scheme() == 'posix_local': + local_path = os.path.join(home_dir, 'local') + if not os.path.exists(local_path): + os.mkdir(local_path) +@@ -1575,7 +1576,7 @@ def fix_lib64(lib_dir, symlink=True): + + logger.debug('This system uses lib64; symlinking lib64 to lib') + +- assert os.path.basename(lib_dir) == 'python%s' % sys.version[:3], ( ++ assert os.path.basename(lib_dir) == py_version, ( + "Unexpected python lib dir: %r" % lib_dir) + lib_parent = os.path.dirname(lib_dir) + top_level = os.path.dirname(lib_parent) +@@ -1637,7 +1638,7 @@ def make_environment_relocatable(home_dir): + fixup_pth_and_egg_link(home_dir) + ## FIXME: need to fix up distutils.cfg + +-OK_ABS_SCRIPTS = ['python', 'python%s' % sys.version[:3], ++OK_ABS_SCRIPTS = ['python', py_version, + 'activate', 'activate.bat', 'activate_this.py', + 'activate.fish', 'activate.csh'] + +@@ -1647,7 +1648,7 @@ def fixup_scripts(home_dir, bin_dir): + '%s /c' % os.path.normcase(os.environ.get('COMSPEC', 'cmd.exe')), + '', '.exe') + else: +- new_shebang_args = ('/usr/bin/env', sys.version[:3], '') ++ new_shebang_args = ('/usr/bin/env', version, '') + + # This is what we expect at the top of scripts: + shebang = '#!%s' % os.path.normcase(os.path.join( +diff --git a/virtualenv_embedded/activate_this.py b/virtualenv_embedded/activate_this.py +index f18193b..8272888 100644 +--- a/virtualenv_embedded/activate_this.py ++++ b/virtualenv_embedded/activate_this.py +@@ -19,7 +19,7 @@ base = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + if sys.platform == 'win32': + site_packages = os.path.join(base, 'Lib', 'site-packages') + else: +- site_packages = os.path.join(base, 'lib', 'python%s' % sys.version[:3], 'site-packages') ++ site_packages = os.path.join(base, 'lib', 'python%s.%s' % (sys.version_info[0], sys.version_info[1]), 'site-packages') + prev_sys_path = list(sys.path) + import site + site.addsitedir(site_packages) +diff --git a/virtualenv_embedded/site.py b/virtualenv_embedded/site.py +index 7969769..b3603ff 100644 +--- a/virtualenv_embedded/site.py ++++ b/virtualenv_embedded/site.py +@@ -134,7 +134,7 @@ def addbuilddir(): + """Append ./build/lib. in case we're running in the build dir + (especially for Guido :-)""" + from distutils.util import get_platform +- s = "build/lib.%s-%.3s" % (get_platform(), sys.version) ++ s = "build/lib.%s-%s.%s" % (get_platform(), sys.version_info[0], sys.version_info[1]) + if hasattr(sys, 'gettotalrefcount'): + s += '-pydebug' + s = os.path.join(os.path.dirname(sys.path[-1]), s) +@@ -162,7 +162,7 @@ def addpackage(sitedir, name, known_paths): + reset = 0 + fullname = os.path.join(sitedir, name) + try: +- f = open(fullname, "rU") ++ f = open(fullname, "r") + except IOError: + return + try: +@@ -222,21 +222,21 @@ def addsitepackages(known_paths, sys_prefix=sys.prefix, exec_prefix=sys.exec_pre + + if prefix.startswith("/System/Library/Frameworks/"): # Apple's Python + +- sitedirs = [os.path.join("/Library/Python", sys.version[:3], "site-packages"), ++ sitedirs = [os.path.join("/Library/Python", "%s.%s" % (sys.version_info[0], sys.version_info[1]), "site-packages"), + os.path.join(prefix, "Extras", "lib", "python")] + + else: # any other Python distros on OSX work this way + sitedirs = [os.path.join(prefix, "lib", +- "python" + sys.version[:3], "site-packages")] ++ "python" + "%s.%s" % (sys.version_info[0], sys.version_info[1]), "site-packages")] + + elif os.sep == '/': + sitedirs = [os.path.join(prefix, + "lib", +- "python" + sys.version[:3], ++ "python%s.%s" % (sys.version_info[0], sys.version_info[1]), + "site-packages"), + os.path.join(prefix, "lib", "site-python"), +- os.path.join(prefix, "python" + sys.version[:3], "lib-dynload")] +- lib64_dir = os.path.join(prefix, "lib64", "python" + sys.version[:3], "site-packages") ++ os.path.join(prefix, "python%s.%s" % (sys.version_info[0], sys.version_info[1]), "lib-dynload")] ++ lib64_dir = os.path.join(prefix, "lib64", "python%s.%s" % (sys.version_info[0], sys.version_info[1]), "site-packages") + if (os.path.exists(lib64_dir) and + os.path.realpath(lib64_dir) not in [os.path.realpath(p) for p in sitedirs]): + if _is_64bit: +@@ -251,11 +251,11 @@ def addsitepackages(known_paths, sys_prefix=sys.prefix, exec_prefix=sys.exec_pre + pass + # Debian-specific dist-packages directories: + sitedirs.append(os.path.join(prefix, "local/lib", +- "python" + sys.version[:3], ++ "python%s.%s" % (sys.version_info[0], sys.version_info[1]), + "dist-packages")) + if sys.version[0] == '2': + sitedirs.append(os.path.join(prefix, "lib", +- "python" + sys.version[:3], ++ "python%s.%s" % (sys.version_info[0], sys.version_info[1]), + "dist-packages")) + else: + sitedirs.append(os.path.join(prefix, "lib", +@@ -275,7 +275,7 @@ def addsitepackages(known_paths, sys_prefix=sys.prefix, exec_prefix=sys.exec_pre + os.path.join(home, + 'Library', + 'Python', +- sys.version[:3], ++ '%s.%s' % (sys.version_info[0], sys.version_info[1]), + 'site-packages')) + for sitedir in sitedirs: + if os.path.isdir(sitedir): +@@ -335,7 +335,7 @@ def addusersitepackages(known_paths): + else: + USER_BASE = joinuser(base, "Python") + USER_SITE = os.path.join(USER_BASE, +- "Python" + sys.version[0] + sys.version[2], ++ "Python%s%s" % (sys.version_info[0], sys.version_info[1]), + "site-packages") + else: + if env_base: +@@ -343,7 +343,7 @@ def addusersitepackages(known_paths): + else: + USER_BASE = joinuser("~", ".local") + USER_SITE = os.path.join(USER_BASE, "lib", +- "python" + sys.version[:3], ++ "python%s.%s" % (sys.version_info[0], sys.version_info[1]), + "site-packages") + + if ENABLE_USER_SITE and os.path.isdir(USER_SITE): +@@ -351,7 +351,7 @@ def addusersitepackages(known_paths): + if ENABLE_USER_SITE: + for dist_libdir in ("lib", "local/lib"): + user_site = os.path.join(USER_BASE, dist_libdir, +- "python" + sys.version[:3], ++ "python%s.%s" % (sys.version_info[0], sys.version_info[1]), + "dist-packages") + if os.path.isdir(user_site): + addsitedir(user_site, known_paths) +@@ -426,7 +426,7 @@ class _Printer(object): + for filename in self.__files: + filename = os.path.join(dir, filename) + try: +- fp = open(filename, "rU") ++ fp = open(filename, "r") + data = fp.read() + fp.close() + break +@@ -581,9 +581,9 @@ def virtual_install_main_packages(): + elif sys.platform == 'win32': + paths = [os.path.join(sys.real_prefix, 'Lib'), os.path.join(sys.real_prefix, 'DLLs')] + else: +- paths = [os.path.join(sys.real_prefix, 'lib', 'python'+sys.version[:3])] ++ paths = [os.path.join(sys.real_prefix, 'lib', 'python%s.%s' % (sys.version_info[0], sys.version_info[1]))] + hardcoded_relative_dirs = paths[:] # for the special 'darwin' case below +- lib64_path = os.path.join(sys.real_prefix, 'lib64', 'python'+sys.version[:3]) ++ lib64_path = os.path.join(sys.real_prefix, 'lib64', 'python%s.%s' % (sys.version_info[0], sys.version_info[1])) + if os.path.exists(lib64_path): + if _is_64bit: + paths.insert(0, lib64_path) +@@ -600,7 +600,7 @@ def virtual_install_main_packages(): + # This is a non-multiarch aware Python. Fallback to the old way. + arch = sys.platform + plat_path = os.path.join(sys.real_prefix, 'lib', +- 'python'+sys.version[:3], ++ 'python%s.%s' % (sys.version_info[0], sys.version_info[1]), + 'plat-%s' % arch) + if os.path.exists(plat_path): + paths.append(plat_path) diff --git a/SOURCES/python3.11-error.patch b/SOURCES/python3.11-error.patch new file mode 100644 index 0000000..46182db --- /dev/null +++ b/SOURCES/python3.11-error.patch @@ -0,0 +1,20 @@ +diff --git a/virtualenv.py b/virtualenv.py +index e5d0883..34d2160 100755 +--- a/virtualenv.py ++++ b/virtualenv.py +@@ -4,6 +4,15 @@ + import os + import sys + ++# The way virtualenv < 20 creates virtual environments ++# is not compatible with Python 3.11+ "frozen standard library modules" ++# https://docs.python.org/3.11/whatsnew/3.11.html#frozen-imports-static-code-objects ++if sys.version_info >= (3, 11): ++ venv_cmd = 'python{0.major}.{0.minor} -m venv'.format(sys.version_info) ++ sys.exit('ERROR: Virtual environments created by virtualenv < 20 ' ++ 'are not compatible with Python 3.11.\n' ++ 'ERROR: Use `{}` instead.'.format(venv_cmd)) ++ + # If we are running in a new interpreter to create a virtualenv, + # we do NOT want paths from our existing location interfering with anything, + # So we remove this file's directory from sys.path - most likely to be diff --git a/SOURCES/rpm-wheels.patch b/SOURCES/rpm-wheels.patch new file mode 100644 index 0000000..f17c00b --- /dev/null +++ b/SOURCES/rpm-wheels.patch @@ -0,0 +1,125 @@ +From b7b8a713d9f1ebac6430fd0fc10175ed37b834ee Mon Sep 17 00:00:00 2001 +From: Lumir Balhar +Date: Thu, 18 Mar 2021 13:08:52 +0100 +Subject: [PATCH] rpm + +--- + virtualenv.py | 66 ++++++++++++++++++++++++++++++++++++++++++--------- + 1 file changed, 55 insertions(+), 11 deletions(-) + +diff --git a/virtualenv.py b/virtualenv.py +index 5699998..9854324 100755 +--- a/virtualenv.py ++++ b/virtualenv.py +@@ -39,9 +39,9 @@ except ImportError: + __version__ = "15.1.0" + virtualenv_version = __version__ # legacy + +-if sys.version_info < (2, 6): ++if sys.version_info < (2, 7): + print('ERROR: %s' % sys.exc_info()[1]) +- print('ERROR: this script requires Python 2.6 or greater.') ++ print('ERROR: this script requires Python 2.7 or greater.') + sys.exit(101) + + try: +@@ -399,6 +399,8 @@ def _find_file(filename, dirs): + def file_search_dirs(): + here = os.path.dirname(os.path.abspath(__file__)) + dirs = [here, join(here, 'virtualenv_support')] ++ dirs.insert(1, '/usr/share/python{}-wheels'.format(sys.version_info[0])) ++ dirs.insert(1, '/usr/share/python{}{}-wheels'.format(*sys.version_info[:2])) + if os.path.splitext(os.path.dirname(__file__))[0] != 'virtualenv': + # Probably some boot script; just in case virtualenv is installed... + try: +@@ -859,7 +861,12 @@ def install_wheel(project_names, py_executable, search_dirs=None, + import tempfile + import os + +- import pip ++ try: ++ from pip._internal import main as _main ++ if type(_main) is type(sys): # ++ _main = _main.main # nested starting in Pip 19.3 ++ except ImportError: ++ from pip import main as _main + + try: + cert_data = pkgutil.get_data("pip._vendor.requests", "cacert.pem") +@@ -878,7 +885,7 @@ def install_wheel(project_names, py_executable, search_dirs=None, + args += ["--cert", cert_file.name] + args += sys.argv[1:] + +- sys.exit(pip.main(args)) ++ sys.exit(_main(args)) + finally: + if cert_file is not None: + os.remove(cert_file.name) +@@ -1038,20 +1045,57 @@ def change_prefix(filename, dst_prefix): + assert False, "Filename %s does not start with any of these prefixes: %s" % \ + (filename, prefixes) + +-def copy_required_modules(dst_prefix, symlink): +- import imp ++def find_module_filename(modname): ++ if sys.version_info < (3, 4): ++ # noinspection PyDeprecation ++ import imp ++ ++ try: ++ file_handler, filepath, _ = imp.find_module(modname) ++ except ImportError: ++ return None ++ else: ++ if file_handler is not None: ++ file_handler.close() ++ return filepath ++ else: ++ import importlib.util + ++ if sys.version_info < (3, 5): ++ ++ def find_spec(modname): ++ # noinspection PyDeprecation ++ loader = importlib.find_loader(modname) ++ if loader is None: ++ return None ++ else: ++ return importlib.util.spec_from_loader(modname, loader) ++ ++ else: ++ find_spec = importlib.util.find_spec ++ ++ spec = find_spec(modname) ++ if spec is None: ++ return None ++ if not os.path.exists(spec.origin): ++ # https://bitbucket.org/pypy/pypy/issues/2944/origin-for-several-builtin-modules ++ # on pypy3, some builtin modules have a bogus build-time file path, ignore them ++ return None ++ filepath = spec.origin ++ # https://www.python.org/dev/peps/pep-3147/#file guarantee to be non-cached ++ if os.path.basename(filepath) == "__init__.py": ++ filepath = os.path.dirname(filepath) ++ return filepath ++ ++def copy_required_modules(dst_prefix, symlink): + for modname in REQUIRED_MODULES: + if modname in sys.builtin_module_names: + logger.info("Ignoring built-in bootstrap module: %s" % modname) + continue +- try: +- f, filename, _ = imp.find_module(modname) +- except ImportError: ++ filename = find_module_filename(modname) ++ if filename is None: + logger.info("Cannot import bootstrap module: %s" % modname) + else: +- if f is not None: +- f.close() + # special-case custom readline.so on OS X, but not for pypy: + if modname == 'readline' and sys.platform == 'darwin' and not ( + is_pypy or filename.endswith(join('lib-dynload', 'readline.so'))): +-- +2.30.2 + diff --git a/SPECS/python-virtualenv.spec b/SPECS/python-virtualenv.spec new file mode 100644 index 0000000..36cf5ce --- /dev/null +++ b/SPECS/python-virtualenv.spec @@ -0,0 +1,519 @@ +# python2X and python3X are built form the same module, so we need a conditional +# for python[23] bits the state of the conditional is not important in the spec, +# it is set in modulemd +%bcond_without python2 +%bcond_without python3 +%bcond_with python36_module + +Name: python-virtualenv +Version: 15.1.0 +Release: 22%{?dist} +Summary: Tool to create isolated Python environments + +Group: Development/Languages +License: MIT +URL: http://pypi.python.org/pypi/virtualenv +Source0: http://pypi.python.org/packages/source/v/virtualenv/virtualenv-%{version}.tar.gz + +# virtualenv -p "/usr/bin/python3" venv fails if there are not packages installed +# under /usr/local/lib/pythonX.Y/site-packages. Check if exec_dir exists before +# listing it's content. +Patch0: check-exec_dir.patch + +# Don't fail on missing certifi's cert +# https://github.com/pypa/virtualenv/pull/1252 +Patch1: dont-fail-on-missing-certifi-cert.patch + +# Changes related to RPM wheels: +# 1. Drop support for Python 2.6 because we don't have it in RHEL 8 and we don't want to +# bundle prehistoric wheels +# 2. Use wheels from /usr/share/python{2,3,38,39,...}-wheels +# 3. Add support for pip 19.3-ish by importing pip.main() from different locations +# 4. Use the importlib module rather than deprecated imp on Python 3 +Patch2: rpm-wheels.patch + +# Fixes for Python 3.10+ +# Backports from upstream virtualenv 16.7: +# +# Adjusts the code to accept Python minor versions with two (or more) digits +# https://github.com/pypa/virtualenv/commit/311a909c10 +# +# Use sysconfig.get_default_scheme() where available (added in Python 3.10) +# https://github.com/pypa/virtualenv/commit/b4aef0a53b +# +# Remove universal newline flag (removed in Python 3.11) +# https://github.com/pypa/virtualenv/commit/8b23c8296f +# +# Backports re-created from scratch, due to changes in formatting. +# +# Run bin/rebuild-script.py in %%build to regenerate the base64 embedded files! +Patch3: python3.10.patch + +# The way virtualenv < 20 creates virtual environments +# is not compatible with Python 3.11+ "frozen standard library modules" +# https://docs.python.org/3.11/whatsnew/3.11.html#frozen-imports-static-code-objects +# +# This patch makes virtualenv explicitly error and suggest venv instead. +# See https://bugzilla.redhat.com/show_bug.cgi?id=2165702 +Patch4: python3.11-error.patch + +BuildArch: noarch + +%if %{with python2} +BuildRequires: python2-devel +BuildRequires: python2-setuptools + +# RPM installed wheels +BuildRequires: python2-pip-wheel +BuildRequires: python2-setuptools-wheel +BuildRequires: python2-wheel-wheel +%endif # with python2 + +%if %{with python3} +BuildRequires: python3-sphinx +BuildRequires: python3-setuptools + +# RPM installed wheels +BuildRequires: python3-pip-wheel +BuildRequires: python3-setuptools-wheel +BuildRequires: python3-wheel-wheel + +%if %{with python36_module} +BuildRequires: python36-devel +BuildRequires: python36-rpm-macros +%else +BuildRequires: python3-devel +%endif +%endif # with python3 + +%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 python2} +%package -n python2-virtualenv +Summary: Tool to create isolated Python environments + +Requires: python2-setuptools +Requires: python2-devel + +# RPM installed wheels +Requires: python2-pip-wheel +Requires: python2-setuptools-wheel +Requires: python2-wheel-wheel +Requires: (python3-wheel-wheel if python36) +Requires: (python38-wheel-wheel if python38) +Requires: (python39-wheel-wheel if python39) + +%{?python_provide:%python_provide python2-virtualenv} + +%description -n python2-virtualenv +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 +%endif + + +%if %{with python3} +%package -n python-virtualenv-doc +Summary: Documentation for python virtualenv + +%description -n python-virtualenv-doc +Documentation for python virtualenv. + +%package -n python3-virtualenv +Summary: Tool to create isolated Python environments + +Requires: python3-setuptools + +# RPM installed wheels +Requires: python3-pip-wheel +Requires: python3-setuptools-wheel +Requires: python3-wheel-wheel +Requires: (python2-wheel-wheel if python2) +Requires: (python38-wheel-wheel if python38) +Requires: (python39-wheel-wheel if python39) + +# Require alternatives version that implements the --keep-foreign flag +Requires(postun): alternatives >= 1.19.1-1 +# For alternatives +Requires: python36 +Requires(post): python36 +Requires(postun): python36 + +%if %{with python36_module} +Requires: python36-devel +%else +Requires: python3-devel +%endif +%{?python_provide:%python_provide python3-virtualenv} +Provides: virtualenv = %{version}-%{release} + +%description -n python3-virtualenv +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 +%endif # with python3 + + +%prep +%setup -q -n virtualenv-%{version} +%{__sed} -i -e "1s|#!/usr/bin/env python||" virtualenv.py + +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 + +# Remove the wheels provided by RPM packages and argparse as it's only required for python 2.6 +rm virtualenv_support/pip-* +rm virtualenv_support/setuptools-* +rm virtualenv_support/wheel-* +rm virtualenv_support/argparse-* + +%build +# Regenerate base64 embedded files +%{?with_python2:%{__python2} bin/rebuild-script.py} +%{?with_python3:%{__python3} bin/rebuild-script.py} + +# Build code +%{?with_python2:%{py2_build}} + +# Build docs on Fedora +%if %{with python3} +%{__python3} setup.py build_sphinx +rm -f build/sphinx/html/.buildinfo + +%{py3_build} + +# Build docs on Fedora +%{__python3} setup.py build_sphinx +rm -f build/sphinx/html/.buildinfo +%endif # with python3 + +%install +%if %{with python3} +%{py3_install} +# rename binaries to use python3 +mv %{buildroot}/%{_bindir}/virtualenv %{buildroot}/%{_bindir}/py3-virtualenv +# The versioned 3.x script was removed from upstream. Add it back. +cp %{buildroot}/%{_bindir}/py3-virtualenv %{buildroot}/%{_bindir}/virtualenv-%{python3_version} +# For alternatives +touch %{buildroot}/%{_bindir}/virtualenv-3 +touch %{buildroot}/%{_bindir}/virtualenv +%endif # with python3 + +%if %{with python2} +%{py2_install} +# The versioned 2.x script was removed from upstream. Add it back. +cp %{buildroot}/%{_bindir}/virtualenv %{buildroot}/%{_bindir}/virtualenv-%{python2_version} +mv %{buildroot}/%{_bindir}/virtualenv %{buildroot}/%{_bindir}/virtualenv-2 +%endif + + +%if %{with python3} +%post -n python3-virtualenv +alternatives --add-slave python3 %{_bindir}/python%{python3_version} \ + %{_bindir}/virtualenv-3 \ + virtualenv-3 \ + %{_bindir}/virtualenv-%{python3_version} +alternatives --add-slave python3 %{_bindir}/python%{python3_version} \ + %{_bindir}/virtualenv \ + virtualenv \ + %{_bindir}/virtualenv-3 + +%postun -n python3-virtualenv +# Do this only during uninstall process (not during update) +if [ $1 -eq 0 ]; then + alternatives --keep-foreign --remove-slave python3 %{_bindir}/python%{python3_version} \ + virtualenv-3 + alternatives --keep-foreign --remove-slave python3 %{_bindir}/python%{python3_version} \ + virtualenv +fi +%endif + + +%if %{with python2} +%files -n python2-virtualenv +%license LICENSE.txt +%doc docs/*rst PKG-INFO AUTHORS.txt + +%{python2_sitelib}/* +%{_bindir}/virtualenv-2 +%{_bindir}/virtualenv-%{python2_version} +%endif + +%if %{with python3} +# Include sphinx docs on Fedora +%files -n python-virtualenv-doc +%doc build/sphinx/* + +%files -n python3-virtualenv +%license LICENSE.txt +%doc docs/*rst PKG-INFO AUTHORS.txt +%{_bindir}/py3-virtualenv +%ghost %{_bindir}/virtualenv +%ghost %{_bindir}/virtualenv-3 +%{_bindir}/virtualenv-%{python3_version} +%{python3_sitelib}/virtualenv.py +%{python3_sitelib}/virtualenv_support/ +%{python3_sitelib}/virtualenv-*.egg-info/ +%{python3_sitelib}/__pycache__/* +%endif # with python3 + + + +%changelog +* Wed Apr 03 2024 MSVSphere Packaging Team - 15.1.0-22 +- Rebuilt for MSVSphere 8.10 beta + +* Wed Feb 01 2023 Miro Hrončok - 15.1.0-22 +- Add a custom error message when users attempt to create Python 3.11+ virtual environments +- Resolves: rhbz#2165702 + +* Wed Jul 28 2021 Tomas Orsava - 15.1.0-21 +- Adjusted the postun scriptlets to enable upgrading to RHEL 9 +- Resolves: rhbz#1933055 + +* Thu Mar 18 2021 Lumír Balhar - 15.1.0-20 +- Use python-version-specific wheels from Python modules +Resolves: rhbz#1917971 + +* Fri Jun 21 2019 Miro Hrončok - 15.1.0-19 +- Use wheels from RPM packages (rhbz#1659550) (rhbz#1659551) +- Fail with a warning on Python versions < 2.7 + +* Thu Apr 25 2019 Tomas Orsava - 15.1.0-18 +- Bumping due to problems with modular RPM upgrade path +- Resolves: rhbz#1695587 + +* Fri Dec 14 2018 Miro Hrončok - 15.1.0-17 +- Don't fail on missing certifi's cert bundle +- Resolves: rhbz#1659440 + +* Wed Nov 28 2018 Tomas Orsava - 15.1.0-16 +- Provide the package name `virtualenv` and the /usr/bin/virtualenv binary +- Resolves: rhbz#1649958 + +* Thu Oct 04 2018 Lumír Balhar - 15.1.0-15 +- Fix alternatives - post and postun sections only with python3 +- Resolves: rhbz#1633534 + +* Mon Oct 01 2018 Lumír Balhar - 15.1.0-14 +- Add alternatives for virtualenv-3 +- Resolves: rhbz#1633534 + +* Wed Aug 15 2018 Lumír Balhar - 15.1.0-13 +- Remove virtualenv-3 executable. This will be provided by python3 module. +- Resolves: rhbz#1615727 + +* Wed Aug 08 2018 Lumír Balhar - 15.1.0-12 +- Remove unversioned binaries from python2 subpackage +- Resolves: rhbz#1613343 + +* Sat Aug 04 2018 Lumír Balhar - 15.1.0-11 +- Fixed conditions + +* Tue Jul 31 2018 Lumír Balhar - 15.1.0-10 +- Switch python3 coditions to bcond + +* Tue Jul 17 2018 Tomas Orsava - 15.1.0-9 +- BuildRequire also python36-rpm-macros as part of the python36 module build + +* Wed Jul 04 2018 Miro Hrončok - 15.1.0-8 +- Add a bcond for python2 + +* Thu Jun 14 2018 Tomas Orsava - 15.1.0-7 +- Switch to using Python 3 version of sphinx + +* Mon Apr 30 2018 Tomas Orsava - 15.1.0-6 +- Require the python36-devel package when building for the python36 module + +* Wed Feb 28 2018 Iryna Shcherbina - 15.1.0-5 +- Update Python 2 dependency declarations to new packaging standards + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + +* Fri Feb 09 2018 Fedora Release Engineering - 15.1.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Fri Sep 29 2017 Troy Dawson - 15.1.0-3 +- Cleanup spec file conditionals + +* Thu Jul 27 2017 Fedora Release Engineering - 15.1.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Mon Jun 12 2017 Steve Milner - 15.1.0-1 +- Update to 15.1.0 per https://bugzilla.redhat.com/show_bug.cgi?id=1454962 + +* Fri Feb 17 2017 Michal Cyprian - 15.0.3-6 +- Check if exec_dir exists before listing it's content during venv create process + +* Sat Feb 11 2017 Fedora Release Engineering - 15.0.3-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Wed Jan 4 2017 Steve Milner - 15.0.3-4 +- Updated version binaries per discussion at bz#1385240. + +* Tue Dec 13 2016 Stratakis Charalampos - 15.0.3-3 +- Rebuild for Python 3.6 + +* Mon Oct 17 2016 Steve Milner - 15.0.3-2 +- Added MAJOR symlinks per bz#1385240. + +* Mon Aug 8 2016 Steve Milner - 15.0.3-1 +- Update for upstream release. + +* Tue Jul 19 2016 Fedora Release Engineering - 14.0.6-2 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Sun Feb 21 2016 Orion Poplawski - 14.0.6-1 +- Update to 14.0.6 + +* Tue Feb 2 2016 Orion Poplawski - 13.1.2-4 +- Modernize spec +- Fix python3 package file ownership + +* Wed Dec 2 2015 Orion Poplawski - 13.1.2-3 +- Move documentation to separate package (bug #1219139) + +* Wed Oct 14 2015 Robert Kuska - 13.1.2-2 +- Rebuilt for Python3.5 rebuild + +* Mon Aug 24 2015 Steve Milner - 13.1.2-1 +- Update for upstream release. + +* Thu Jun 18 2015 Fedora Release Engineering - 12.0.7-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Mon Mar 16 2015 Matej Stuchlik - 12.0.7-1 +- Update to 12.0.7 + +* Thu Jan 15 2015 Matthias Runge - 1.11.6-2 +- add a python3-package, thanks to Matej Stuchlik (rhbz#1179150) + +* Wed Jul 09 2014 Matthias Runge - 1.11.6-1 +- update to 1.11.6: + Upstream updated setuptools to 3.6, updated pip to 1.5.6 + +* Sun Jun 08 2014 Fedora Release Engineering - 1.10.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Thu Aug 15 2013 Steve 'Ashcrow' Milner - 1.10.1-1 +- Upstream upgraded pip to v1.4.1 +- Upstream upgraded setuptools to v0.9.8 (fixes CVE-2013-1633) + +* Sun Aug 04 2013 Fedora Release Engineering - 1.9.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Tue May 14 2013 Toshio Kuratomi - 1.9.1-1 +- Update to upstream 1.9.1 because of security issues with the bundled + python-pip in older releases. This is just a quick fix until a + python-virtualenv maintainer can unbundle the python-pip package + see: https://bugzilla.redhat.com/show_bug.cgi?id=749378 + +* Thu Feb 14 2013 Fedora Release Engineering - 1.7.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Tue Aug 14 2012 Steve Milner - 1.7.2-1 +- Update for upstream bug fixes. +- Added path for versioned binary. +- Patch no longer required. + +* Sat Jul 21 2012 Fedora Release Engineering - 1.7.1.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Wed Mar 14 2012 Steve 'Ashcrow' Milner - 1.7.1.2-1 +- Update for upstream bug fixes. +- Added patch for sphinx building + +* Sat Jan 14 2012 Fedora Release Engineering - 1.7-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue Dec 20 2011 Steve 'Ashcrow' Milner - 1.7-1 +- Update for https://bugzilla.redhat.com/show_bug.cgi?id=769067 + +* Wed Feb 09 2011 Fedora Release Engineering - 1.5.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Sat Oct 16 2010 Steve 'Ashcrow' Milner - 1.5.1-1 +- Added _weakrefset requirement for Python 2.7.1. +- Add support for PyPy. +- Uses a proper temporary dir when installing environment requirements. +- Add --prompt option to be able to override the default prompt prefix. +- Add fish and csh activate scripts. + +* Thu Jul 22 2010 David Malcolm - 1.4.8-4 +- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild + +* Wed Jul 7 2010 Steve 'Ashcrow' Milner - 1.4.8-3 +- Fixed EPEL installation issue from BZ#611536 + +* Wed Jun 9 2010 Steve 'Ashcrow' Milner - 1.4.8-2 +- Only replace the python shebang on the first line (Robert Buchholz) + +* Wed Apr 28 2010 Steve 'Ashcrow' Milner - 1.4.8-1 +- update pip to 0.7 +- move regen-docs into bin/ +- Fix #31, make activate_this.py work on Windows (use Lib/site-packages) +unset PYTHONHOME envioronment variable -- first step towards fixing the PYTHONHOME issue; see e.g. https://bugs.launchpad.net/virtualenv/+bug/290844 +- unset PYTHONHOME in the (Unix) activate script (and reset it in deactivate()) +- use the activate.sh in virtualenv.py via running bin/rebuild-script.py +- add warning message if PYTHONHOME is set + +* Fri Apr 2 2010 Steve 'Ashcrow' Milner - 1.4.6-1 +- allow script creation without setuptools +- fix problem with --relocate when bin/ has subdirs (fixes #12) +- Allow more flexible .pth file fixup +- make nt a required module, along with posix. it may not be a builtin module on jython +- don't mess with PEP 302-supplied __file__, from CPython, and merge in a small startup optimization for Jython, from Jython + +* Tue Dec 22 2009 Steve 'Ashcrow' Milner - 1.4.3-1 +- Updated for upstream release. + +* Thu Nov 12 2009 Steve 'Ashcrow' Milner - 1.4.2-1 +- Updated for upstream release. + +* Sun Jul 26 2009 Fedora Release Engineering - 1.3.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Tue Apr 28 2009 Steve 'Ashcrow' Milner - 1.3.3-1 +- Updated for upstream release. + +* Thu Feb 26 2009 Fedora Release Engineering - 1.3.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Thu Dec 25 2008 Steve 'Ashcrow' Milner - 1.3.2-1 +- Updated for upstream release. + +* Thu Dec 04 2008 Ignacio Vazquez-Abrams - 1.3.1-4 +- Rebuild for Python 2.6 + +* Mon Dec 1 2008 Steve 'Ashcrow' Milner - 1.3.1-3 +- Added missing dependencies. + +* Sat Nov 29 2008 Ignacio Vazquez-Abrams - 1.3.1-2 +- Rebuild for Python 2.6 + +* Fri Nov 28 2008 Steve 'Ashcrow' Milner - 1.3.1-1 +- Updated for upstream release + +* Sun Sep 28 2008 Steve 'Ashcrow' Milner - 1.3-1 +- Updated for upstream release + +* Sat Aug 30 2008 Steve 'Ashcrow' Milner - 1.2-1 +- Updated for upstream release + +* Fri Aug 29 2008 Steve 'Ashcrow' Milner - 1.1-3 +- Updated from review notes + +* Thu Aug 28 2008 Steve 'Ashcrow' Milner - 1.1-2 +- Updated from review notes + +* Tue Aug 26 2008 Steve 'Ashcrow' Milner - 1.1-1 +- Initial Version