Update vcs resolution

Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
Dan Ryan
2018-11-07 22:16:14 -05:00
parent 59961d6bbb
commit 9c02f6ef5f
2 changed files with 34 additions and 32 deletions
+29 -29
View File
@@ -969,7 +969,6 @@ def do_lock(
pypi_mirror=None,
):
"""Executes the freeze functionality."""
from .utils import get_vcs_deps
cached_lockfile = {}
if not pre:
@@ -1931,38 +1930,39 @@ def do_install(
extra_indexes=extra_index_url,
pypi_mirror=pypi_mirror,
)
except (ValueError, RuntimeError):
except (ValueError, RuntimeError) as e:
sp.write_err(vistir.compat.fs_str("{0}: {1}".format(crayons.red("WARNING"), e)))
sp.fail(environments.PIPENV_SPINNER_FAIL_TEXT.format("Installation Failed"))
# Warn if --editable wasn't passed.
if pkg_requirement.is_vcs and not pkg_requirement.editable:
sp.write_err(
"{0}: You installed a VCS dependency in non-editable mode. "
"This will work fine, but sub-dependencies will not be resolved by {1}."
"\n To enable this sub-dependency functionality, specify that this dependency is editable."
"".format(
crayons.red("Warning", bold=True),
crayons.red("$ pipenv lock"),
)
)
click.echo(crayons.blue(format_pip_output(c.out)))
# Ensure that package was successfully installed.
if c.return_code != 0:
sp.write_err(vistir.compat.fs_str(
"{0} An error occurred while installing {1}!".format(
crayons.red("Error: ", bold=True), crayons.green(pkg_line)
),
))
sp.write_err(vistir.compat.fs_str(crayons.blue(format_pip_error(c.err))))
if "setup.py egg_info" in c.err:
sp.write_err(vistir.compat.fs_str(
"This is likely caused by a bug in {0}. "
"Report this to its maintainers.".format(
crayons.green(pkg_requirement.name)
else:
# Warn if --editable wasn't passed.
if pkg_requirement.is_vcs and not pkg_requirement.editable:
sp.write_err(
"{0}: You installed a VCS dependency in non-editable mode. "
"This will work fine, but sub-dependencies will not be resolved by {1}."
"\n To enable this sub-dependency functionality, specify that this dependency is editable."
"".format(
crayons.red("Warning", bold=True),
crayons.red("$ pipenv lock"),
)
)
click.echo(crayons.blue(format_pip_output(c.out)))
# Ensure that package was successfully installed.
if c.return_code != 0:
sp.write_err(vistir.compat.fs_str(
"{0} An error occurred while installing {1}!".format(
crayons.red("Error: ", bold=True), crayons.green(pkg_line)
),
))
sp.fail(environments.PIPENV_SPINNER_FAIL_TEXT.format("Installation Failed"))
sys.exit(1)
sp.write_err(vistir.compat.fs_str(crayons.blue(format_pip_error(c.err))))
if "setup.py egg_info" in c.err:
sp.write_err(vistir.compat.fs_str(
"This is likely caused by a bug in {0}. "
"Report this to its maintainers.".format(
crayons.green(pkg_requirement.name)
)
))
sp.fail(environments.PIPENV_SPINNER_FAIL_TEXT.format("Installation Failed"))
sys.exit(1)
sp.write(vistir.compat.fs_str(
u"{0} {1} {2} {3}{4}".format(
crayons.normal(u"Adding", bold=True),
+5 -3
View File
@@ -518,7 +518,7 @@ def venv_resolve_deps(
dev=False,
):
from .vendor.vistir.misc import fs_str
from .vendor.vistir.compat import Path, JSONDecodeError
from .vendor.vistir.compat import Path, to_native_string, JSONDecodeError
from .vendor.vistir.path import create_tracked_tempdir
from . import resolver
import json
@@ -533,7 +533,7 @@ def venv_resolve_deps(
vcs_section = "vcs_dev_packages" if dev else "vcs_packages"
if getattr(project, vcs_section, []):
with create_spinner(text=fs_str("Pinning VCS Packages...")) as sp:
vcs_reqs, vcs_lockfile = get_vcs_deps(
vcs_deps, vcs_lockfile = get_vcs_deps(
project,
which=which,
clear=clear,
@@ -541,7 +541,8 @@ def venv_resolve_deps(
allow_global=allow_global,
dev=dev,
)
vcs_deps = [req.as_line() for req in vcs_reqs if req.editable]
vcs_deps = [req.as_line() for req in vcs_deps if req.editable]
deps.extend([req.as_line() for req in vcs_deps if not req.editable])
sp.write(environments.PIPENV_SPINNER_OK_TEXT.format(
"Successfully pinned VCS Packages!"
))
@@ -569,6 +570,7 @@ def venv_resolve_deps(
if vcs_deps:
with temp_environ():
os.environ["PIPENV_PACKAGES"] = str("\n".join(vcs_deps))
sp.text = to_native_string("Locking VCS Dependencies...")
vcs_c = resolve(cmd, sp)
vcs_results, vcs_err = vcs_c.out, vcs_c.err
else: