Fix special handling of unsafe dependencies as primary dependencies

This commit is contained in:
Ethan Paul 2020-12-16 20:31:41 -05:00
parent 2ce97a5349
commit f116ffefa2
No known key found for this signature in database
GPG Key ID: C5F5542B54A4D9C6

View File

@ -67,7 +67,7 @@ def find_transients(packages: PackageMap, dependency_name: str) -> Set[PoetryPac
if name in _poetry.Provider.UNSAFE_PACKAGES: if name in _poetry.Provider.UNSAFE_PACKAGES:
reporter.warning( reporter.warning(
f"{constants.REPORTER_PREFIX} Installing package '{name}' using Poetry is not supported; skipping installation of package '{name}'" f"{constants.REPORTER_PREFIX} Installing package '{name}' using Poetry is not supported and will be skipped"
) )
reporter.verbosity2( reporter.verbosity2(
f"{constants.REPORTER_PREFIX} Skip {name}: designated unsafe by Poetry" f"{constants.REPORTER_PREFIX} Skip {name}: designated unsafe by Poetry"
@ -110,6 +110,12 @@ def find_transients(packages: PackageMap, dependency_name: str) -> Set[PoetryPac
packages[dependency_name].name, searched packages[dependency_name].name, searched
) )
except KeyError: except KeyError:
if dependency_name in _poetry.Provider.UNSAFE_PACKAGES:
reporter.warning(
f"{constants.REPORTER_PREFIX} Installing package '{dependency_name}' using Poetry is not supported and will be skipped"
)
return set()
if any( if any(
delimiter in dependency_name delimiter in dependency_name
for delimiter in constants.PEP508_VERSION_DELIMITERS for delimiter in constants.PEP508_VERSION_DELIMITERS
@ -117,6 +123,7 @@ def find_transients(packages: PackageMap, dependency_name: str) -> Set[PoetryPac
raise exceptions.LockedDepVersionConflictError( raise exceptions.LockedDepVersionConflictError(
f"Locked dependency '{dependency_name}' cannot include version specifier" f"Locked dependency '{dependency_name}' cannot include version specifier"
) from None ) from None
raise exceptions.LockedDepNotFoundError( raise exceptions.LockedDepNotFoundError(
f"No version of locked dependency '{dependency_name}' found in the project lockfile" f"No version of locked dependency '{dependency_name}' found in the project lockfile"
) from None ) from None