Bump pip to 20.3.3 and wheel to 0.36.2 (#2036)

This commit is contained in:
Bernát Gábor 2021-01-12 10:04:54 +00:00 committed by GitHub
parent 26943f6b5b
commit 39fdf9580b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 58 additions and 20 deletions

View file

@ -0,0 +1 @@
Bump embed pip to ``20.3.3``, setuptools to ``51.1.1`` and wheel to ``0.36.2`` - by :user:`gaborbernat`.

View file

@ -51,6 +51,7 @@ class PipInstall(object):
# 1. first extract the wheel
logging.debug("build install image for %s to %s", self._wheel.name, self._image_dir)
with zipfile.ZipFile(str(self._wheel)) as zip_ref:
self._shorten_path_if_needed(zip_ref)
zip_ref.extractall(str(self._image_dir))
self._extracted = True
# 2. now add additional files not present in the distribution
@ -58,6 +59,20 @@ class PipInstall(object):
# 3. finally fix the records file
self._fix_records(new_files)
def _shorten_path_if_needed(self, zip_ref):
if os.name == "nt":
to_folder = str(self._image_dir)
# https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation
zip_max_len = max(len(i) for i in zip_ref.namelist())
path_len = zip_max_len + len(to_folder)
if path_len > 260:
self._image_dir.mkdir(exist_ok=True) # to get a short path must exist
from virtualenv.util.path import get_short_path_name
to_folder = get_short_path_name(to_folder)
self._image_dir = Path(to_folder)
def _records_text(self, files):
record_data = "\n".join(
"{},,".format(os.path.relpath(ensure_text(str(rec)), ensure_text(str(self._image_dir)))) for rec in files

View file

@ -6,34 +6,34 @@ from virtualenv.util.path import Path
BUNDLE_FOLDER = Path(__file__).absolute().parent
BUNDLE_SUPPORT = {
"3.10": {
"pip": "pip-20.3.1-py2.py3-none-any.whl",
"setuptools": "setuptools-51.0.0-py3-none-any.whl",
"wheel": "wheel-0.36.1-py2.py3-none-any.whl",
"pip": "pip-20.3.3-py2.py3-none-any.whl",
"setuptools": "setuptools-51.1.2-py3-none-any.whl",
"wheel": "wheel-0.36.2-py2.py3-none-any.whl",
},
"3.9": {
"pip": "pip-20.3.1-py2.py3-none-any.whl",
"setuptools": "setuptools-51.0.0-py3-none-any.whl",
"wheel": "wheel-0.36.1-py2.py3-none-any.whl",
"pip": "pip-20.3.3-py2.py3-none-any.whl",
"setuptools": "setuptools-51.1.2-py3-none-any.whl",
"wheel": "wheel-0.36.2-py2.py3-none-any.whl",
},
"3.8": {
"pip": "pip-20.3.1-py2.py3-none-any.whl",
"setuptools": "setuptools-51.0.0-py3-none-any.whl",
"wheel": "wheel-0.36.1-py2.py3-none-any.whl",
"pip": "pip-20.3.3-py2.py3-none-any.whl",
"setuptools": "setuptools-51.1.2-py3-none-any.whl",
"wheel": "wheel-0.36.2-py2.py3-none-any.whl",
},
"3.7": {
"pip": "pip-20.3.1-py2.py3-none-any.whl",
"setuptools": "setuptools-51.0.0-py3-none-any.whl",
"wheel": "wheel-0.36.1-py2.py3-none-any.whl",
"pip": "pip-20.3.3-py2.py3-none-any.whl",
"setuptools": "setuptools-51.1.2-py3-none-any.whl",
"wheel": "wheel-0.36.2-py2.py3-none-any.whl",
},
"3.6": {
"pip": "pip-20.3.1-py2.py3-none-any.whl",
"setuptools": "setuptools-51.0.0-py3-none-any.whl",
"wheel": "wheel-0.36.1-py2.py3-none-any.whl",
"pip": "pip-20.3.3-py2.py3-none-any.whl",
"setuptools": "setuptools-51.1.2-py3-none-any.whl",
"wheel": "wheel-0.36.2-py2.py3-none-any.whl",
},
"3.5": {
"pip": "pip-20.3.1-py2.py3-none-any.whl",
"pip": "pip-20.3.3-py2.py3-none-any.whl",
"setuptools": "setuptools-50.3.2-py3-none-any.whl",
"wheel": "wheel-0.36.1-py2.py3-none-any.whl",
"wheel": "wheel-0.36.2-py2.py3-none-any.whl",
},
"3.4": {
"pip": "pip-19.1.1-py2.py3-none-any.whl",
@ -41,9 +41,9 @@ BUNDLE_SUPPORT = {
"wheel": "wheel-0.33.6-py2.py3-none-any.whl",
},
"2.7": {
"pip": "pip-20.3.1-py2.py3-none-any.whl",
"pip": "pip-20.3.3-py2.py3-none-any.whl",
"setuptools": "setuptools-44.1.1-py2.py3-none-any.whl",
"wheel": "wheel-0.36.1-py2.py3-none-any.whl",
"wheel": "wheel-0.36.2-py2.py3-none-any.whl",
},
}
MAX = "3.10"

View file

@ -3,6 +3,7 @@ from __future__ import absolute_import, unicode_literals
from ._pathlib import Path
from ._permission import make_exe, set_tree
from ._sync import copy, copytree, ensure_dir, safe_delete, symlink
from ._win import get_short_path_name
__all__ = (
"ensure_dir",
@ -13,4 +14,5 @@ __all__ = (
"make_exe",
"set_tree",
"safe_delete",
"get_short_path_name",
)

View file

@ -0,0 +1,19 @@
def get_short_path_name(long_name):
"""
Gets the short path name of a given long path.
http://stackoverflow.com/a/23598461/200291
"""
import ctypes
from ctypes import wintypes
_GetShortPathNameW = ctypes.windll.kernel32.GetShortPathNameW
_GetShortPathNameW.argtypes = [wintypes.LPCWSTR, wintypes.LPWSTR, wintypes.DWORD]
_GetShortPathNameW.restype = wintypes.DWORD
output_buf_size = 0
while True:
output_buf = ctypes.create_unicode_buffer(output_buf_size)
needed = _GetShortPathNameW(long_name, output_buf, output_buf_size)
if output_buf_size >= needed:
return output_buf.value
else:
output_buf_size = needed

View file

@ -334,7 +334,8 @@ def current_fastest(current_creators):
@pytest.fixture(scope="session")
def session_app_data(tmp_path_factory):
app_data = AppDataDiskFolder(folder=str(tmp_path_factory.mktemp("session-app-data")))
temp_folder = tmp_path_factory.mktemp("session-app-data")
app_data = AppDataDiskFolder(folder=str(temp_folder))
with change_env_var(str("VIRTUALENV_OVERRIDE_APP_DATA"), str(app_data.lock.path)):
yield app_data