Skip to content

Commit 39fdf95

Browse files
authored
Bump pip to 20.3.3 and wheel to 0.36.2 (#2036)
1 parent 26943f6 commit 39fdf95

9 files changed

Lines changed: 58 additions & 20 deletions

File tree

docs/changelog/2036.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Bump embed pip to ``20.3.3``, setuptools to ``51.1.1`` and wheel to ``0.36.2`` - by :user:`gaborbernat`.

src/virtualenv/seed/embed/via_app_data/pip_install/base.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,28 @@ def build_image(self):
5151
# 1. first extract the wheel
5252
logging.debug("build install image for %s to %s", self._wheel.name, self._image_dir)
5353
with zipfile.ZipFile(str(self._wheel)) as zip_ref:
54+
self._shorten_path_if_needed(zip_ref)
5455
zip_ref.extractall(str(self._image_dir))
5556
self._extracted = True
5657
# 2. now add additional files not present in the distribution
5758
new_files = self._generate_new_files()
5859
# 3. finally fix the records file
5960
self._fix_records(new_files)
6061

62+
def _shorten_path_if_needed(self, zip_ref):
63+
if os.name == "nt":
64+
to_folder = str(self._image_dir)
65+
# https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation
66+
zip_max_len = max(len(i) for i in zip_ref.namelist())
67+
path_len = zip_max_len + len(to_folder)
68+
if path_len > 260:
69+
self._image_dir.mkdir(exist_ok=True) # to get a short path must exist
70+
71+
from virtualenv.util.path import get_short_path_name
72+
73+
to_folder = get_short_path_name(to_folder)
74+
self._image_dir = Path(to_folder)
75+
6176
def _records_text(self, files):
6277
record_data = "\n".join(
6378
"{},,".format(os.path.relpath(ensure_text(str(rec)), ensure_text(str(self._image_dir)))) for rec in files

src/virtualenv/seed/wheels/embed/__init__.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,44 @@
66
BUNDLE_FOLDER = Path(__file__).absolute().parent
77
BUNDLE_SUPPORT = {
88
"3.10": {
9-
"pip": "pip-20.3.1-py2.py3-none-any.whl",
10-
"setuptools": "setuptools-51.0.0-py3-none-any.whl",
11-
"wheel": "wheel-0.36.1-py2.py3-none-any.whl",
9+
"pip": "pip-20.3.3-py2.py3-none-any.whl",
10+
"setuptools": "setuptools-51.1.2-py3-none-any.whl",
11+
"wheel": "wheel-0.36.2-py2.py3-none-any.whl",
1212
},
1313
"3.9": {
14-
"pip": "pip-20.3.1-py2.py3-none-any.whl",
15-
"setuptools": "setuptools-51.0.0-py3-none-any.whl",
16-
"wheel": "wheel-0.36.1-py2.py3-none-any.whl",
14+
"pip": "pip-20.3.3-py2.py3-none-any.whl",
15+
"setuptools": "setuptools-51.1.2-py3-none-any.whl",
16+
"wheel": "wheel-0.36.2-py2.py3-none-any.whl",
1717
},
1818
"3.8": {
19-
"pip": "pip-20.3.1-py2.py3-none-any.whl",
20-
"setuptools": "setuptools-51.0.0-py3-none-any.whl",
21-
"wheel": "wheel-0.36.1-py2.py3-none-any.whl",
19+
"pip": "pip-20.3.3-py2.py3-none-any.whl",
20+
"setuptools": "setuptools-51.1.2-py3-none-any.whl",
21+
"wheel": "wheel-0.36.2-py2.py3-none-any.whl",
2222
},
2323
"3.7": {
24-
"pip": "pip-20.3.1-py2.py3-none-any.whl",
25-
"setuptools": "setuptools-51.0.0-py3-none-any.whl",
26-
"wheel": "wheel-0.36.1-py2.py3-none-any.whl",
24+
"pip": "pip-20.3.3-py2.py3-none-any.whl",
25+
"setuptools": "setuptools-51.1.2-py3-none-any.whl",
26+
"wheel": "wheel-0.36.2-py2.py3-none-any.whl",
2727
},
2828
"3.6": {
29-
"pip": "pip-20.3.1-py2.py3-none-any.whl",
30-
"setuptools": "setuptools-51.0.0-py3-none-any.whl",
31-
"wheel": "wheel-0.36.1-py2.py3-none-any.whl",
29+
"pip": "pip-20.3.3-py2.py3-none-any.whl",
30+
"setuptools": "setuptools-51.1.2-py3-none-any.whl",
31+
"wheel": "wheel-0.36.2-py2.py3-none-any.whl",
3232
},
3333
"3.5": {
34-
"pip": "pip-20.3.1-py2.py3-none-any.whl",
34+
"pip": "pip-20.3.3-py2.py3-none-any.whl",
3535
"setuptools": "setuptools-50.3.2-py3-none-any.whl",
36-
"wheel": "wheel-0.36.1-py2.py3-none-any.whl",
36+
"wheel": "wheel-0.36.2-py2.py3-none-any.whl",
3737
},
3838
"3.4": {
3939
"pip": "pip-19.1.1-py2.py3-none-any.whl",
4040
"setuptools": "setuptools-43.0.0-py2.py3-none-any.whl",
4141
"wheel": "wheel-0.33.6-py2.py3-none-any.whl",
4242
},
4343
"2.7": {
44-
"pip": "pip-20.3.1-py2.py3-none-any.whl",
44+
"pip": "pip-20.3.3-py2.py3-none-any.whl",
4545
"setuptools": "setuptools-44.1.1-py2.py3-none-any.whl",
46-
"wheel": "wheel-0.36.1-py2.py3-none-any.whl",
46+
"wheel": "wheel-0.36.2-py2.py3-none-any.whl",
4747
},
4848
}
4949
MAX = "3.10"

src/virtualenv/seed/wheels/embed/pip-20.3.1-py2.py3-none-any.whl renamed to src/virtualenv/seed/wheels/embed/pip-20.3.3-py2.py3-none-any.whl

1.45 MB
Binary file not shown.

src/virtualenv/seed/wheels/embed/setuptools-51.0.0-py3-none-any.whl renamed to src/virtualenv/seed/wheels/embed/setuptools-51.1.2-py3-none-any.whl

767 KB
Binary file not shown.

src/virtualenv/seed/wheels/embed/wheel-0.36.1-py2.py3-none-any.whl renamed to src/virtualenv/seed/wheels/embed/wheel-0.36.2-py2.py3-none-any.whl

34 KB
Binary file not shown.

src/virtualenv/util/path/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from ._pathlib import Path
44
from ._permission import make_exe, set_tree
55
from ._sync import copy, copytree, ensure_dir, safe_delete, symlink
6+
from ._win import get_short_path_name
67

78
__all__ = (
89
"ensure_dir",
@@ -13,4 +14,5 @@
1314
"make_exe",
1415
"set_tree",
1516
"safe_delete",
17+
"get_short_path_name",
1618
)

src/virtualenv/util/path/_win.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
def get_short_path_name(long_name):
2+
"""
3+
Gets the short path name of a given long path.
4+
http://stackoverflow.com/a/23598461/200291
5+
"""
6+
import ctypes
7+
from ctypes import wintypes
8+
9+
_GetShortPathNameW = ctypes.windll.kernel32.GetShortPathNameW
10+
_GetShortPathNameW.argtypes = [wintypes.LPCWSTR, wintypes.LPWSTR, wintypes.DWORD]
11+
_GetShortPathNameW.restype = wintypes.DWORD
12+
output_buf_size = 0
13+
while True:
14+
output_buf = ctypes.create_unicode_buffer(output_buf_size)
15+
needed = _GetShortPathNameW(long_name, output_buf, output_buf_size)
16+
if output_buf_size >= needed:
17+
return output_buf.value
18+
else:
19+
output_buf_size = needed

tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,8 @@ def current_fastest(current_creators):
334334

335335
@pytest.fixture(scope="session")
336336
def session_app_data(tmp_path_factory):
337-
app_data = AppDataDiskFolder(folder=str(tmp_path_factory.mktemp("session-app-data")))
337+
temp_folder = tmp_path_factory.mktemp("session-app-data")
338+
app_data = AppDataDiskFolder(folder=str(temp_folder))
338339
with change_env_var(str("VIRTUALENV_OVERRIDE_APP_DATA"), str(app_data.lock.path)):
339340
yield app_data
340341

0 commit comments

Comments
 (0)