diff --git a/virtualenv.py b/virtualenv.py index c7f71e6..3740014 100755 --- a/virtualenv.py +++ b/virtualenv.py @@ -475,7 +475,18 @@ def virtualenv_support_dirs(): # normal filesystem installation if os.path.isdir(join(HERE, "virtualenv_support")): - yield [join(HERE, "virtualenv_support")] + dirs = [join(HERE, "virtualenv_support")] + if os.path.isdir("/usr/share/python-wheels"): + dirs.insert(0, "/usr/share/python-wheels") + try: + import ensurepip + ensurepip_path = os.path.join(ensurepip.__path__[0], "_bundled") + except (ImportError, AttributeError, IndexError): + pass + else: + if os.path.isdir(ensurepip_path): + dirs.insert(0, ensurepip_path) + yield dirs elif IS_ZIPAPP: tmpdir = tempfile.mkdtemp() try: @@ -998,6 +998,8 @@ def find_wheels(projects, search_dirs): ) if project == "pip" and sys.version_info[0:2] == (3, 4): wheel = next(p for v, p in versions if v <= (19, 1, 1)) + elif project == "setuptools" and sys.version_info[0:2] == (3, 4): + wheel = next(p for v, p in versions if v < (44,)) else: wheel = versions[0][1] wheels.append(wheel) @@ -1091,9 +1093,13 @@ def _install_wheel_with_search_dir(download, project_names, py_executable, searc ) ).encode("utf8") - if sys.version_info[0:2] == (3, 4) and "pip" in project_names: - at = project_names.index("pip") - project_names[at] = "pip<19.2" + if sys.version_info[0:2] == (3, 4): + if "pip" in project_names: + at = project_names.index("pip") + project_names[at] = "pip<19.2" + if "setuptools" in project_names: + at = project_names.index("setuptools") + project_names[at] = "setuptools<44" cmd = [py_executable, "-"] + project_names logger.start_progress("Installing {}...".format(", ".join(project_names)))