Use constraint lines to update requirements

Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
Dan Ryan
2018-06-12 03:05:01 -04:00
parent 50be8c31fa
commit caf09662d6
2 changed files with 9 additions and 3 deletions
+2 -2
View File
@@ -251,7 +251,7 @@ def actually_resolve_deps(
# req.as_line() is theoratically the same as dep, but is guaranteed to
# be normalized. This is safer than passing in dep.
# TODO: Stop passing dep lines around; just use requirement objects.
constraints.append(req.requirement.line)
constraints.append(req.constraint_line)
# extra_constraints = []
if url:
@@ -1220,7 +1220,7 @@ def clean_resolved_dep(dep, is_top_level=False, pipfile_entry=None):
lockfile = {
'version': '=={0}'.format(dep['version']),
}
for key in ['hashes', 'index']:
for key in ['hashes', 'index', 'extras']:
if key in dep:
lockfile[key] = dep[key]
# In case we lock a uri or a file when the user supplied a path
+7 -1
View File
@@ -566,7 +566,7 @@ class Requirement(object):
name, extras = _strip_extras(name)
if version:
name = '{0}{1}'.format(name, version)
r = NamedRequirement.from_line(name)
r = NamedRequirement.from_line(line)
if extras:
extras = first(
requirements.parse("fakepkg{0}".format(extras_to_string(extras)))
@@ -639,6 +639,12 @@ class Requirement(object):
line = "{0} {1}".format(line, index_string)
return line
@property
def constraint_line(self):
if self.is_named or self.is_vcs:
return self.as_line()
return self.req.req.line
def as_pipfile(self):
good_keys = (
"hashes",