@@ -157,7 +157,7 @@ def _get_pypi_package_data(package_name):
157
157
with url_lib .urlopen (json_uri ) as response :
158
158
return json .loads (response .read ())
159
159
160
- def _get_debugpy_url (version = "latest" , platform = "none-any" , cp = "cp311" ):
160
+ def _get_debugpy_info (version = "latest" , platform = "none-any" , cp = "cp311" ):
161
161
from packaging .version import parse as version_parser
162
162
163
163
data = _get_pypi_package_data ('debugpy' )
@@ -167,10 +167,32 @@ def _get_debugpy_url(version="latest", platform="none-any", cp="cp311"):
167
167
else :
168
168
use_version = version
169
169
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 ),))
172
173
)[0 ]
173
- download_url (data )
174
174
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
+
175
197
def _contains (s , parts = ()):
176
198
return any (p for p in parts if p in s )
0 commit comments