Fix bug in lockfile generation

Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
Dan Ryan
2018-11-21 18:32:23 -05:00
parent 18f8c0a403
commit 4d713e7ffe
2 changed files with 7 additions and 6 deletions
+5 -4
View File
@@ -785,10 +785,11 @@ class Project(object):
def get_lockfile_meta(self):
from .vendor.plette.lockfiles import PIPFILE_SPEC_CURRENT
sources = self.lockfile_content.get("_meta", {}).get("sources", [])
if not sources:
sources = self.pipfile_sources
elif not isinstance(sources, list):
if self.lockfile_exists:
sources = self.lockfile_content.get("_meta", {}).get("sources", [])
else:
sources = [dict(source) for source in self.parsed_pipfile["source"]]
if not isinstance(sources, list):
sources = [sources,]
return {
"hash": {"sha256": self.calculate_pipfile_hash()},
+2 -2
View File
@@ -320,7 +320,7 @@ class Resolver(object):
if self.sources:
requirementstxt_sources = " ".join(self.pip_args) if self.pip_args else ""
requirementstxt_sources = requirementstxt_sources.replace(" --", "\n--")
constraints_file.write(u"{0}\n".format(requirementstxt_sources))
constraints_file.write(u"{0}\n".format(requirementstxt_sources))
constraints = self.initial_constraints
constraints_file.write(u"\n".join([c for c in constraints]))
constraints_file.close()
@@ -855,7 +855,7 @@ def mkdir_p(newdir):
if exn.errno != errno.EEXIST:
raise
def is_required_version(version, specified_version):
"""Check to see if there's a hard requirement for version
number provided in the Pipfile.