Remove more usage of pipfile in favor of plette

This commit is contained in:
Oz N Tiram
2022-09-13 11:40:15 +02:00
parent d9bd51d669
commit 9e170e10af
2 changed files with 9 additions and 7 deletions
+2 -2
View File
@@ -1218,7 +1218,7 @@ def do_init(
if (project.lockfile_exists and not ignore_pipfile) and not skip_lock:
old_hash = project.get_lockfile_hash()
new_hash = project.calculate_pipfile_hash()
if new_hash != old_hash:
if new_hash.value != old_hash:
if deploy:
click.secho(
"Your Pipfile.lock ({}) is out of date. Expected: ({}).".format(
@@ -1244,7 +1244,7 @@ def do_init(
else:
msg = fix_utf8("Pipfile.lock is corrupted, replaced with ({1})...")
click.secho(
msg.format(old_hash[-6:], new_hash[-6:]),
msg.format(old_hash[-6:], new_hash.value[-6:]),
fg="yellow",
bold=True,
err=True,
+7 -5
View File
@@ -556,14 +556,16 @@ class Project:
@property
def _lockfile(self):
"""Pipfile.lock divided by PyPI and external dependencies."""
pfile = plette.Pipfile.load(self.pipfile_location)
lockfile = json.loads(pfile.lock())
lockfile = plette.Lockfile.with_meta_from(
plette.Pipfile.load(open(self.pipfile_location))
)
for section in ("default", "develop"):
lock_section = lockfile.get(section, {})
for key in list(lock_section.keys()):
norm_key = pep423_name(key)
lockfile[section][norm_key] = lock_section.pop(key)
return lockfile
return lockfile._data
@property
def _pipfile(self):
@@ -1008,8 +1010,8 @@ class Project:
def calculate_pipfile_hash(self):
# Update the lockfile if it is out-of-date.
p = plette.Pipfile.load(self.pipfile_location)
return p.hash
p = plette.Pipfile.load(open(self.pipfile_location))
return p.get_hash()
def ensure_proper_casing(self):
"""Ensures proper casing of Pipfile packages"""