@@ -172,11 +172,20 @@ def fetch_wheels(
172
172
else :
173
173
force_pinned = False
174
174
175
- rrp = list (get_required_remote_packages (
176
- requirements_file = requirements_file ,
177
- force_pinned = force_pinned ,
178
- remote_links_url = remote_links_url ,
179
- ))
175
+ try :
176
+ rrp = list (get_required_remote_packages (
177
+ requirements_file = requirements_file ,
178
+ force_pinned = force_pinned ,
179
+ remote_links_url = remote_links_url ,
180
+ ))
181
+ except Exception as e :
182
+ raise Exception (
183
+ dict (
184
+ requirements_file = requirements_file ,
185
+ force_pinned = force_pinned ,
186
+ remote_links_url = remote_links_url ,
187
+ )
188
+ ) from e
180
189
181
190
fetched_filenames = set ()
182
191
for name , version , package in rrp :
@@ -211,6 +220,7 @@ def fetch_wheels(
211
220
print (f'Missed package { nv } in remote repo, has only:' )
212
221
for pv in rr .get_versions (n ):
213
222
print (' ' , pv )
223
+ raise Exception ('Missed some packages in remote repo' )
214
224
215
225
216
226
def fetch_sources (
@@ -261,6 +271,8 @@ def fetch_sources(
261
271
fetched = package .fetch_sdist (dest_dir = dest_dir )
262
272
error = f'Failed to fetch' if not fetched else None
263
273
yield package , error
274
+ if missed :
275
+ raise Exception (f'Missing source packages in { remote_links_url } ' , missed )
264
276
265
277
################################################################################
266
278
#
@@ -693,8 +705,7 @@ def save_if_modified(location, content):
693
705
return False
694
706
695
707
if TRACE : print (f'Saving ABOUT (and NOTICE) files for: { self } ' )
696
- wmode = 'wb' if isinstance (content , bytes ) else 'w'
697
- with open (location , wmode , encoding = "utf-8" ) as fo :
708
+ with open (location , 'w' ) as fo :
698
709
fo .write (content )
699
710
return True
700
711
@@ -1845,7 +1856,7 @@ def get(self, path_or_url, as_text=True):
1845
1856
if not os .path .exists (cached ):
1846
1857
content = get_file_content (path_or_url = path_or_url , as_text = as_text )
1847
1858
wmode = 'w' if as_text else 'wb'
1848
- with open (cached , wmode , encoding = "utf-8" ) as fo :
1859
+ with open (cached , wmode ) as fo :
1849
1860
fo .write (content )
1850
1861
return content
1851
1862
else :
@@ -1857,7 +1868,7 @@ def put(self, filename, content):
1857
1868
"""
1858
1869
cached = os .path .join (self .directory , filename )
1859
1870
wmode = 'wb' if isinstance (content , bytes ) else 'w'
1860
- with open (cached , wmode , encoding = "utf-8" ) as fo :
1871
+ with open (cached , wmode ) as fo :
1861
1872
fo .write (content )
1862
1873
1863
1874
@@ -2331,7 +2342,7 @@ def get_required_remote_packages(
2331
2342
repo = get_remote_repo (remote_links_url = remote_links_url )
2332
2343
else :
2333
2344
# a local path
2334
- assert os .path .exists (remote_links_url )
2345
+ assert os .path .exists (remote_links_url ), f'Path does not exist: { remote_links_url } '
2335
2346
repo = get_local_repo (directory = remote_links_url )
2336
2347
2337
2348
for name , version in required_name_versions :
@@ -2365,7 +2376,7 @@ def update_requirements(name, version=None, requirements_file='requirements.txt'
2365
2376
updated_name_versions = sorted (updated_name_versions )
2366
2377
nvs = '\n ' .join (f'{ name } =={ version } ' for name , version in updated_name_versions )
2367
2378
2368
- with open (requirements_file , 'w' , encoding = "utf-8" ) as fo :
2379
+ with open (requirements_file , 'w' ) as fo :
2369
2380
fo .write (nvs )
2370
2381
2371
2382
@@ -2383,7 +2394,7 @@ def hash_requirements(dest_dir=THIRDPARTY_DIR, requirements_file='requirements.t
2383
2394
raise Exception (f'Missing required package { name } =={ version } ' )
2384
2395
hashed .append (package .specifier_with_hashes )
2385
2396
2386
- with open (requirements_file , 'w' , encoding = "utf-8" ) as fo :
2397
+ with open (requirements_file , 'w' ) as fo :
2387
2398
fo .write ('\n ' .join (hashed ))
2388
2399
2389
2400
################################################################################
@@ -2915,7 +2926,7 @@ def fetch_package_wheel(name, version, environment, dest_dir=THIRDPARTY_DIR):
2915
2926
2916
2927
def check_about (dest_dir = THIRDPARTY_DIR ):
2917
2928
try :
2918
- subprocess .check_output (f'venv/bin/ about check { dest_dir } ' .split ())
2929
+ subprocess .check_output (f'about check { dest_dir } ' .split ())
2919
2930
except subprocess .CalledProcessError as cpe :
2920
2931
print ()
2921
2932
print ('Invalid ABOUT files:' )
@@ -2953,7 +2964,6 @@ def find_problems(
2953
2964
2954
2965
check_about (dest_dir = dest_dir )
2955
2966
2956
-
2957
2967
def compute_normalized_license_expression (declared_licenses ):
2958
2968
if not declared_licenses :
2959
2969
return
@@ -2962,4 +2972,4 @@ def compute_normalized_license_expression(declared_licenses):
2962
2972
return pypi .compute_normalized_license (declared_licenses )
2963
2973
except ImportError :
2964
2974
# Scancode is not installed, we join all license strings and return it
2965
- return ' ' .join (declared_licenses )
2975
+ return ' ' .join (declared_licenses ). lower ()
0 commit comments