Skip to content

Commit d103db1

Browse files
author
Pavel Minaev
authored
Fix handling of empty directories in debugpy wheels when combining them. (#17620)
Add filename logging when combining wheels. Update debugpy to 1.5.0.
1 parent c844352 commit d103db1

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

pythonFiles/install_debugpy.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
DEBUGGER_DEST = os.path.join(EXTENSION_ROOT, "pythonFiles", "lib", "python")
1111
DEBUGGER_PACKAGE = "debugpy"
1212
DEBUGGER_PYTHON_ABI_VERSIONS = ("cp39",)
13-
DEBUGGER_VERSION = "1.4.3" # can also be "latest"
13+
DEBUGGER_VERSION = "1.5.0" # can also be "latest"
1414

1515

1616
def _contains(s, parts=()):
@@ -35,21 +35,16 @@ def _get_debugger_wheel_urls(data, version):
3535

3636
def _download_and_extract(root, url, version):
3737
root = os.getcwd() if root is None or root == "." else root
38-
prefix = os.path.join("debugpy-{0}.data".format(version), "purelib")
38+
print(url)
3939
with url_lib.urlopen(url) as response:
40-
# Extract only the contents of the purelib subfolder (parent folder of debugpy),
41-
# since debugpy files rely on the presence of a 'debugpy' folder.
42-
with zipfile.ZipFile(io.BytesIO(response.read()), "r") as wheel:
40+
data = response.read()
41+
with zipfile.ZipFile(io.BytesIO(data), "r") as wheel:
4342
for zip_info in wheel.infolist():
4443
# Ignore dist info since we are merging multiple wheels
45-
if ".dist-info" in zip_info.filename:
44+
if ".dist-info/" in zip_info.filename:
4645
continue
47-
# Normalize path for Windows, the wheel folder structure
48-
# uses forward slashes.
49-
normalized = os.path.normpath(zip_info.filename)
50-
# Flatten the folder structure.
51-
zip_info.filename = normalized.split(prefix)[-1]
52-
wheel.extract(zip_info, root)
46+
print("\t" + zip_info.filename)
47+
wheel.extract(zip_info.filename, root)
5348

5449

5550
def main(root):

0 commit comments

Comments
 (0)