Skip to content

Commit 33655a2

Browse files
add json file and session that creates it
1 parent 9809ffc commit 33655a2

File tree

2 files changed

+63
-4
lines changed

2 files changed

+63
-4
lines changed

debugpy_platforms.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"macos": {
3+
"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+
]
8+
},
9+
"win32": {
10+
"url": "https://files.pythonhosted.org/packages/52/59/3591e9f709b7ee4d3a926a8903a395669cd0e0279204a94b6acccf6ed6ee/debugpy-1.7.0-cp311-cp311-win32.whl",
11+
"hash": [
12+
"sha256",
13+
"18a69f8e142a716310dd0af6d7db08992aed99e2606108732efde101e7c65e2a"
14+
]
15+
},
16+
"win64": {
17+
"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+
]
22+
},
23+
"linux": {
24+
"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+
]
29+
},
30+
"any": {
31+
"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+
]
36+
}
37+
}

noxfile.py

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def _get_pypi_package_data(package_name):
157157
with url_lib.urlopen(json_uri) as response:
158158
return json.loads(response.read())
159159

160-
def _get_debugpy_url(version="latest", platform="none-any", cp="cp311"):
160+
def _get_debugpy_info(version="latest", platform="none-any", cp="cp311"):
161161
from packaging.version import parse as version_parser
162162

163163
data = _get_pypi_package_data('debugpy')
@@ -167,10 +167,32 @@ def _get_debugpy_url(version="latest", platform="none-any", cp="cp311"):
167167
else:
168168
use_version = version
169169

170-
data = list(
171-
{"url": r["url"], "hash": ("sha256", r["digests"]["sha256"])} for r in data["releases"][use_version] if _contains(r["filename"], ("{}-{}".format(cp, platform),))
170+
try:
171+
return list(
172+
{"url": r["url"], "hash": ("sha256", r["digests"]["sha256"])} for r in data["releases"][use_version] if _contains(r["url"], ("{}-{}".format(cp, platform),))
172173
)[0]
173-
download_url(data)
174174

175+
except:
176+
return list(
177+
{"url": r["url"], "hash": ("sha256", r["digests"]["sha256"])} for r in data["releases"][use_version] if _contains(r["url"], ("{}-{}".format("py3", platform),))
178+
)[0]
179+
180+
181+
@nox.session()
182+
def create_debugpy_json(session: nox.Session, version="1.7.0", cp="cp311"):
183+
platforms = [("macos", "macosx"), ("win32", "win32"), ("win64", "win_amd64"), ("linux", "manylinux"),("any", "none-any")]
184+
185+
debugpy_platforms_json_path = pathlib.Path(__file__).parent / "debugpy_platforms.json"
186+
debugpy_platforms = json.loads(debugpy_platforms_json_path.read_text(encoding="utf-8"))
187+
for p, id in platforms:
188+
print(p, id)
189+
data = _get_debugpy_info(version, id, cp)
190+
print(data)
191+
debugpy_platforms[p] = data
192+
# debugpy_platforms[]
193+
debugpy_platforms_json_path.write_text(json.dumps(debugpy_platforms, indent=4), encoding="utf-8")
194+
195+
196+
175197
def _contains(s, parts=()):
176198
return any(p for p in parts if p in s)

0 commit comments

Comments
 (0)