Fix constraint validation

This commit is contained in:
frostming
2020-08-28 14:21:52 +08:00
parent 627fc4addc
commit f49a1dd873
4 changed files with 13 additions and 9 deletions
+1
View File
@@ -0,0 +1 @@
Fix a bug that non-wheel file requirements can be resolved successfully.
+1
View File
@@ -440,6 +440,7 @@ def lock_options(f):
f = install_base_options(f)
f = lock_dev_option(f)
f = emit_requirements_flag(f)
f = emit_requirements_header_flag(f)
f = dev_only_flag(f)
return f
+4 -4
View File
@@ -841,15 +841,15 @@ def do_install_dependencies(
dev = dev or dev_only
deps_list = list(lockfile.get_requirements(dev=dev, only=dev_only))
if emit_requirements:
index_args = prepare_pip_source_args(get_source_list(pypi_mirror=pypi_mirror, project=project))
index_args = prepare_pip_source_args(
get_source_list(pypi_mirror=pypi_mirror, project=project)
)
index_args = " ".join(index_args).replace(" -", "\n-")
deps = [
req.as_line(sources=False, include_hashes=False) for req in deps_list
]
click.echo(index_args)
click.echo(
"\n".join(sorted(deps))
)
click.echo("\n".join(sorted(deps)))
sys.exit(0)
if concurrent:
nprocs = PIPENV_MAX_SUBPROCESS
+7 -5
View File
@@ -562,13 +562,15 @@ class Entry(object):
:return: True if the constraints are satisfied by the resolution provided
:raises: :exc:`pipenv.exceptions.DependencyConflict` if the constraints dont exist
"""
from pipenv.exceptions import DependencyConflict
from pipenv.environments import is_verbose
constraints = self.get_constraints()
old_version = self.strip_version(self.old_specifiers)
for constraint in constraints:
try:
constraint.check_if_exists(False)
except Exception:
from pipenv.exceptions import DependencyConflict
from pipenv.environments import is_verbose
if not constraint.req:
continue
if not constraint.req.specifier.contains(str(old_version), prereleases=True):
if is_verbose():
print("Tried constraint: {0!r}".format(constraint), file=sys.stderr)
msg = (