mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Corrections based on test results.
This commit is contained in:
+19
-3
@@ -10,8 +10,11 @@ import os
|
||||
import re
|
||||
import sys
|
||||
import urllib.parse
|
||||
from json.decoder import JSONDecodeError
|
||||
from pathlib import Path
|
||||
|
||||
import click
|
||||
|
||||
from pipenv.cmdparse import Script
|
||||
from pipenv.environment import Environment
|
||||
from pipenv.environments import Setting, is_in_virtualenv, normalize_pipfile_path
|
||||
@@ -758,7 +761,11 @@ class Project:
|
||||
from .vendor.plette.lockfiles import PIPFILE_SPEC_CURRENT
|
||||
|
||||
if self.lockfile_exists:
|
||||
sources = self.lockfile_content.get("_meta", {}).get("sources", [])
|
||||
sources = (
|
||||
self.load_lockfile(expand_env_vars=False)
|
||||
.get("_meta", {})
|
||||
.get("sources", [])
|
||||
)
|
||||
elif "source" in self.parsed_pipfile:
|
||||
sources = [dict(source) for source in self.parsed_pipfile["source"]]
|
||||
else:
|
||||
@@ -992,8 +999,17 @@ class Project:
|
||||
def load_lockfile(self, expand_env_vars=True):
|
||||
lockfile_modified = False
|
||||
with io.open(self.lockfile_location, encoding="utf-8") as lock:
|
||||
j = json.load(lock)
|
||||
self._lockfile_newlines = preferred_newlines(lock)
|
||||
try:
|
||||
j = json.load(lock)
|
||||
self._lockfile_newlines = preferred_newlines(lock)
|
||||
except JSONDecodeError:
|
||||
click.secho(
|
||||
"Pipfile.lock is corrupted; ignoring contents.",
|
||||
fg="yellow",
|
||||
bold=True,
|
||||
err=True,
|
||||
)
|
||||
j = {}
|
||||
if not j.get("_meta"):
|
||||
with open(self.pipfile_location) as pf:
|
||||
default_lockfile = plette.Lockfile.with_meta_from(
|
||||
|
||||
Reference in New Issue
Block a user