Skip to content

Commit 1bac5b0

Browse files
resolve comments
1 parent f64c727 commit 1bac5b0

File tree

3 files changed

+33
-52
lines changed

3 files changed

+33
-52
lines changed

build/azure-pipeline.pre-release.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,11 @@ extends:
7070
- script: npm ci
7171
displayName: Install NPM dependencies
7272

73-
- script: python -m pip install -U pip
74-
displayName: Upgrade pip
75-
76-
- script: python -m pip install wheel
77-
displayName: Install wheel
78-
79-
- script: python -m pip install nox
80-
displayName: Install nox
73+
-install wheel script: python -m pip install -U pip pipx wheel
74+
displayName: Update pip, install pipx and install wheel
8175

8276
# update according packageArch
83-
- script: python -m nox --session install_bundled_libs
77+
- script: pipx run nox --session install_bundled_libs
8478
displayName: Install Python dependencies
8579
env:
8680
VSCETARGET: ${{ variables.VSCETARGET }}

debugpy_info.json

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,32 @@
11
{
22
"macOS": {
33
"url": "https://files.pythonhosted.org/packages/bd/a3/5e37ce13c7dd850b72a52be544a058ed49606ebbbf8b95b2ba3c1db5620a/debugpy-1.7.0-cp311-cp311-macosx_11_0_universal2.whl",
4-
"hash": [
5-
"sha256",
6-
"538765a41198aa88cc089295b39c7322dd598f9ef1d52eaae12145c63bf9430a"
7-
]
4+
"hash": {
5+
"sha256": "538765a41198aa88cc089295b39c7322dd598f9ef1d52eaae12145c63bf9430a"
6+
}
87
},
98
"win32": {
109
"url": "https://files.pythonhosted.org/packages/52/59/3591e9f709b7ee4d3a926a8903a395669cd0e0279204a94b6acccf6ed6ee/debugpy-1.7.0-cp311-cp311-win32.whl",
11-
"hash": [
12-
"sha256",
13-
"18a69f8e142a716310dd0af6d7db08992aed99e2606108732efde101e7c65e2a"
14-
]
10+
"hash": {
11+
"sha256": "18a69f8e142a716310dd0af6d7db08992aed99e2606108732efde101e7c65e2a"
12+
}
1513
},
1614
"win64": {
1715
"url": "https://files.pythonhosted.org/packages/51/59/84ebd58d3e9de33a54ca8aa4532e03906e5458092dafe240264c2937a99b/debugpy-1.7.0-cp311-cp311-win_amd64.whl",
18-
"hash": [
19-
"sha256",
20-
"7515a5ba5ee9bfe956685909c5f28734c1cecd4ee813523363acfe3ca824883a"
21-
]
16+
"hash": {
17+
"sha256": "7515a5ba5ee9bfe956685909c5f28734c1cecd4ee813523363acfe3ca824883a"
18+
}
2219
},
2320
"linux": {
2421
"url": "https://files.pythonhosted.org/packages/b4/fc/087324d46dab8e21e084ce2cf670fa7e524ab5e7691692438e4987bd3ecb/debugpy-1.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
25-
"hash": [
26-
"sha256",
27-
"c7e8cf91f8f3f9b5fad844dd88427b85d398bda1e2a0cd65d5a21312fcbc0c6f"
28-
]
22+
"hash": {
23+
"sha256": "c7e8cf91f8f3f9b5fad844dd88427b85d398bda1e2a0cd65d5a21312fcbc0c6f"
24+
}
2925
},
3026
"any": {
3127
"url": "https://files.pythonhosted.org/packages/39/2f/c8a8cfac6c7fa3d9e163a6bf46e6d27d027b7a1331028e99a6ef7fd3699d/debugpy-1.7.0-py2.py3-none-any.whl",
32-
"hash": [
33-
"sha256",
34-
"f6de2e6f24f62969e0f0ef682d78c98161c4dca29e9fb05df4d2989005005502"
35-
]
28+
"hash": {
29+
"sha256": "f6de2e6f24f62969e0f0ef682d78c98161c4dca29e9fb05df4d2989005005502"
30+
}
3631
}
3732
}

noxfile.py

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ def install_bundled_libs(session):
5050
"--implementation",
5151
"py",
5252
"--no-deps",
53-
"--upgrade",
53+
"--require-hashes",
54+
"--only-binary",
55+
":all:",
5456
"-r",
5557
"./requirements.txt",
5658
)
@@ -73,11 +75,13 @@ def install_bundled_libs(session):
7375
download_url(debugpy_info["any"])
7476

7577

76-
def download_url(value):
78+
def download_url(value, hash_algorithm="sha256"):
7779
with url_lib.urlopen(value["url"]) as response:
7880
data = response.read()
79-
hash_algorithm, hash_digest = value["hash"]
80-
if hashlib.new(hash_algorithm, data).hexdigest() != hash_digest:
81+
if (
82+
hashlib.new(hash_algorithm, data).hexdigest()
83+
!= value["hash"][hash_algorithm]
84+
):
8185
raise ValueError("Failed hash verification for {}.".format(value["url"]))
8286
print("Download: ", value["url"])
8387
with zipfile.ZipFile(io.BytesIO(data), "r") as wheel:
@@ -90,7 +94,7 @@ def download_url(value):
9094
@nox.session()
9195
def update_build_number(session: nox.Session) -> None:
9296
"""Updates build number for the extension."""
93-
if len(session.posargs) == 0:
97+
if not len(session.posargs):
9498
session.log("No updates to package version")
9599
return
96100

@@ -99,7 +103,7 @@ def update_build_number(session: nox.Session) -> None:
99103

100104
package_json = json.loads(package_json_path.read_text(encoding="utf-8"))
101105

102-
parts = re.split("\\.|-", package_json["version"])
106+
parts = re.split(r"\.|-", package_json["version"])
103107
major, minor = parts[:2]
104108

105109
version = f"{major}.{minor}.{session.posargs[0]}"
@@ -128,19 +132,11 @@ def _get_debugpy_info(version="latest", platform="none-any", cp="cp311"):
128132
else:
129133
use_version = version
130134

131-
try:
132-
return list(
133-
{"url": r["url"], "hash": ("sha256", r["digests"]["sha256"])}
134-
for r in data["releases"][use_version]
135-
if _contains(r["url"], ("{}-{}".format(cp, platform),))
136-
)[0]
137-
138-
except:
139-
return list(
140-
{"url": r["url"], "hash": ("sha256", r["digests"]["sha256"])}
141-
for r in data["releases"][use_version]
142-
if _contains(r["url"], ("{}-{}".format("py3", platform),))
143-
)[0]
135+
return list(
136+
{"url": r["url"], "hash": {"sha256": r["digests"]["sha256"]}}
137+
for r in data["releases"][use_version]
138+
if f"{cp}-{platform}" in r["url"] or f"py3-{platform}" in r["url"]
139+
)[0]
144140

145141

146142
@nox.session()
@@ -157,7 +153,3 @@ def create_debugpy_json(session: nox.Session, version="1.7.0", cp="cp311"):
157153
debugpy_info_json_path.write_text(
158154
json.dumps(debugpy_info, indent=4), encoding="utf-8"
159155
)
160-
161-
162-
def _contains(s, parts=()):
163-
return any(p for p in parts if p in s)

0 commit comments

Comments
 (0)