@@ -213,15 +213,13 @@ def get_sdist_file_path_from_filename(sdist):
213213 sdist_file = sdist .rstrip (".tar.gz" )
214214 with tarfile .open (os .path .join (utils_pypi .CACHE_THIRDPARTY_DIR , sdist )) as file :
215215 file .extractall (
216- os .path .join (utils_pypi .CACHE_THIRDPARTY_DIR ,
217- "extracted_sdists" , sdist_file )
216+ os .path .join (utils_pypi .CACHE_THIRDPARTY_DIR , "extracted_sdists" , sdist_file )
218217 )
219218 elif sdist .endswith (".zip" ):
220219 sdist_file = sdist .rstrip (".zip" )
221220 with ZipFile (os .path .join (utils_pypi .CACHE_THIRDPARTY_DIR , sdist )) as zip :
222221 zip .extractall (
223- os .path .join (utils_pypi .CACHE_THIRDPARTY_DIR ,
224- "extracted_sdists" , sdist_file )
222+ os .path .join (utils_pypi .CACHE_THIRDPARTY_DIR , "extracted_sdists" , sdist_file )
225223 )
226224
227225 else :
@@ -364,8 +362,7 @@ def __init__(
364362 ignore_errors = False ,
365363 ):
366364 self .environment = environment
367- self .environment_marker = get_environment_marker_from_environment (
368- self .environment )
365+ self .environment_marker = get_environment_marker_from_environment (self .environment )
369366 self .repos = repos or []
370367 self .versions_by_package : Dict [str , List [Version ]] = {}
371368 self .dependencies_by_purl = {}
@@ -427,11 +424,9 @@ async def _get_versions_for_package_from_repo(
427424 versions = []
428425 for version , package in (await repo .get_package_versions (name )).items ():
429426 python_version = parse_version (
430- get_python_version_from_env_tag (
431- python_version = self .environment .python_version )
427+ get_python_version_from_env_tag (python_version = self .environment .python_version )
432428 )
433- wheels = list (package .get_supported_wheels (
434- environment = self .environment ))
429+ wheels = list (package .get_supported_wheels (environment = self .environment ))
435430 valid_wheel_present = False
436431 pypi_valid_python_version = False
437432 if wheels :
@@ -496,8 +491,7 @@ async def _get_requirements_for_package_from_pypi_simple(
496491 Return requirements for a package from the simple repositories.
497492 """
498493 python_version = parse_version (
499- get_python_version_from_env_tag (
500- python_version = self .environment .python_version )
494+ get_python_version_from_env_tag (python_version = self .environment .python_version )
501495 )
502496
503497 wheels = await utils_pypi .download_wheel (
@@ -510,8 +504,7 @@ async def _get_requirements_for_package_from_pypi_simple(
510504
511505 if wheels :
512506 for wheel in wheels :
513- wheel_location = os .path .join (
514- utils_pypi .CACHE_THIRDPARTY_DIR , wheel )
507+ wheel_location = os .path .join (utils_pypi .CACHE_THIRDPARTY_DIR , wheel )
515508 requirements = get_requirements_from_distribution (
516509 handler = PypiWheelHandler ,
517510 location = wheel_location ,
@@ -594,8 +587,7 @@ def get_candidates(
594587 ):
595588 valid_versions .append (parsed_version )
596589 if not all (version .is_prerelease for version in valid_versions ):
597- valid_versions = [
598- version for version in valid_versions if not version .is_prerelease ]
590+ valid_versions = [version for version in valid_versions if not version .is_prerelease ]
599591 for version in valid_versions :
600592 yield Candidate (name = name , version = version , extras = extras )
601593
@@ -611,7 +603,12 @@ def _iter_matches(
611603 name = remove_extras (identifier = identifier )
612604 bad_versions = {c .version for c in incompatibilities [identifier ]}
613605 extras = {e for r in requirements [identifier ] for e in r .extras }
614- versions = self .get_versions_for_package (name )
606+ versions = []
607+ if not self .repos :
608+ versions .extend (self .get_versions_for_package (name = name ))
609+ else :
610+ for repo in self .repos :
611+ versions .extend (self .get_versions_for_package (name = name , repo = repo ))
615612
616613 if not versions :
617614 if self .ignore_errors :
@@ -702,8 +699,7 @@ def dfs(mapping: Dict, graph: DirectedGraph, src: str):
702699
703700 return dict (
704701 package = str (src_purl ),
705- dependencies = sorted ([dfs (mapping , graph , c )
706- for c in children ], key = lambda d : d ["package" ]),
702+ dependencies = sorted ([dfs (mapping , graph , c ) for c in children ], key = lambda d : d ["package" ]),
707703 )
708704
709705
@@ -821,8 +817,7 @@ def get_setup_requirements(sdist_location: str, setup_py_location: str, setup_cf
821817 """
822818
823819 if not os .path .exists (setup_py_location ) and not os .path .exists (setup_cfg_location ):
824- raise Exception (
825- f"No setup.py or setup.cfg found in pypi sdist { sdist_location } " )
820+ raise Exception (f"No setup.py or setup.cfg found in pypi sdist { sdist_location } " )
826821
827822 # Some commonon packages like flask may have some dependencies in setup.cfg
828823 # and some dependencies in setup.py. We are going to check both.
0 commit comments