@@ -172,11 +172,20 @@ def fetch_wheels(
172172 else :
173173 force_pinned = False
174174
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
180189
181190 fetched_filenames = set ()
182191 for name , version , package in rrp :
@@ -211,6 +220,7 @@ def fetch_wheels(
211220 print (f'Missed package { nv } in remote repo, has only:' )
212221 for pv in rr .get_versions (n ):
213222 print (' ' , pv )
223+ raise Exception ('Missed some packages in remote repo' )
214224
215225
216226def fetch_sources (
@@ -261,6 +271,8 @@ def fetch_sources(
261271 fetched = package .fetch_sdist (dest_dir = dest_dir )
262272 error = f'Failed to fetch' if not fetched else None
263273 yield package , error
274+ if missed :
275+ raise Exception (f'Missing source packages in { remote_links_url } ' , missed )
264276
265277################################################################################
266278#
@@ -693,8 +705,7 @@ def save_if_modified(location, content):
693705 return False
694706
695707 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 :
698709 fo .write (content )
699710 return True
700711
@@ -1845,7 +1856,7 @@ def get(self, path_or_url, as_text=True):
18451856 if not os .path .exists (cached ):
18461857 content = get_file_content (path_or_url = path_or_url , as_text = as_text )
18471858 wmode = 'w' if as_text else 'wb'
1848- with open (cached , wmode , encoding = "utf-8" ) as fo :
1859+ with open (cached , wmode ) as fo :
18491860 fo .write (content )
18501861 return content
18511862 else :
@@ -1857,7 +1868,7 @@ def put(self, filename, content):
18571868 """
18581869 cached = os .path .join (self .directory , filename )
18591870 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 :
18611872 fo .write (content )
18621873
18631874
@@ -2331,7 +2342,7 @@ def get_required_remote_packages(
23312342 repo = get_remote_repo (remote_links_url = remote_links_url )
23322343 else :
23332344 # 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 } '
23352346 repo = get_local_repo (directory = remote_links_url )
23362347
23372348 for name , version in required_name_versions :
@@ -2365,7 +2376,7 @@ def update_requirements(name, version=None, requirements_file='requirements.txt'
23652376 updated_name_versions = sorted (updated_name_versions )
23662377 nvs = '\n ' .join (f'{ name } =={ version } ' for name , version in updated_name_versions )
23672378
2368- with open (requirements_file , 'w' , encoding = "utf-8" ) as fo :
2379+ with open (requirements_file , 'w' ) as fo :
23692380 fo .write (nvs )
23702381
23712382
@@ -2383,7 +2394,7 @@ def hash_requirements(dest_dir=THIRDPARTY_DIR, requirements_file='requirements.t
23832394 raise Exception (f'Missing required package { name } =={ version } ' )
23842395 hashed .append (package .specifier_with_hashes )
23852396
2386- with open (requirements_file , 'w' , encoding = "utf-8" ) as fo :
2397+ with open (requirements_file , 'w' ) as fo :
23872398 fo .write ('\n ' .join (hashed ))
23882399
23892400################################################################################
@@ -2915,7 +2926,7 @@ def fetch_package_wheel(name, version, environment, dest_dir=THIRDPARTY_DIR):
29152926
29162927def check_about (dest_dir = THIRDPARTY_DIR ):
29172928 try :
2918- subprocess .check_output (f'venv/bin/ about check { dest_dir } ' .split ())
2929+ subprocess .check_output (f'about check { dest_dir } ' .split ())
29192930 except subprocess .CalledProcessError as cpe :
29202931 print ()
29212932 print ('Invalid ABOUT files:' )
@@ -2953,7 +2964,6 @@ def find_problems(
29532964
29542965 check_about (dest_dir = dest_dir )
29552966
2956-
29572967def compute_normalized_license_expression (declared_licenses ):
29582968 if not declared_licenses :
29592969 return
@@ -2962,4 +2972,4 @@ def compute_normalized_license_expression(declared_licenses):
29622972 return pypi .compute_normalized_license (declared_licenses )
29632973 except ImportError :
29642974 # 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