Merge branch 'master' into editable-packages-fix

This commit is contained in:
Frost Ming
2018-11-17 17:50:10 +08:00
5 changed files with 40 additions and 16 deletions
+5 -5
View File
@@ -367,18 +367,18 @@ The only optional section is the ``@<branch_or_tag>`` section. When using git o
Note that it is **strongly recommended** that you install any version-controlled dependencies in editable mode, using ``pipenv install -e``, in order to ensure that dependency resolution can be performed with an up to date copy of the repository each time it is performed, and that it includes all known dependencies.
Below is an example usage which installs the git repository located at ``https://github.com/requests/requests.git`` from tag ``v2.19.1`` as package name ``requests``::
Below is an example usage which installs the git repository located at ``https://github.com/requests/requests.git`` from tag ``v2.20.1`` as package name ``requests``::
$ pipenv install -e git+https://github.com/requests/requests.git@v2.19#egg=requests
$ pipenv install -e git+https://github.com/requests/requests.git@v2.20.1#egg=requests
Creating a Pipfile for this project...
Installing -e git+https://github.com/requests/requests.git@v2.19.1#egg=requests...
Installing -e git+https://github.com/requests/requests.git@v2.20.1#egg=requests...
[...snipped...]
Adding -e git+https://github.com/requests/requests.git@v2.19.1#egg=requests to Pipfile's [packages]...
Adding -e git+https://github.com/requests/requests.git@v2.20.1#egg=requests to Pipfile's [packages]...
[...]
$ cat Pipfile
[packages]
requests = {git = "https://github.com/requests/requests.git", editable = true, ref = "2.19.1"}
requests = {git = "https://github.com/requests/requests.git", editable = true, ref = "v2.20.1"}
Valid values for ``<vcs_type>`` include ``git``, ``bzr``, ``svn``, and ``hg``. Valid values for ``<scheme>`` include ``http``, ``https``, ``ssh``, and ``file``. In specific cases you also have access to other schemes: ``svn`` may be combined with ``svn`` as a scheme, and ``bzr`` can be combined with ``sftp`` and ``lp``.
+1
View File
@@ -0,0 +1 @@
Pipenv will no longer disable user-mode installation when the ``--system`` flag is passed in.
+4 -2
View File
@@ -725,7 +725,8 @@ def batch_install(deps_list, procs, failed_deps_queue,
extra_indexes = indexes[1:]
with vistir.contextmanagers.temp_environ():
os.environ["PIP_USER"] = vistir.compat.fs_str("0")
if not allow_global:
os.environ["PIP_USER"] = vistir.compat.fs_str("0")
c = pip_install(
dep,
ignore_hashes=any([ignore_hashes, dep.editable, dep.is_vcs]),
@@ -1896,7 +1897,8 @@ def do_install(
)
# pip install:
with vistir.contextmanagers.temp_environ(), create_spinner("Installing...") as sp:
os.environ["PIP_USER"] = vistir.compat.fs_str("0")
if not system:
os.environ["PIP_USER"] = vistir.compat.fs_str("0")
try:
pkg_requirement = Requirement.from_line(pkg_line)
except ValueError as e:
+13 -9
View File
@@ -728,6 +728,18 @@ class Project(object):
data[u"requires"] = {"python_version": version[: len("2.7")]}
self.write_toml(data)
@classmethod
def populate_source(cls, source):
"""Derive missing values of source from the existing fields."""
# Only URL pararemter is mandatory, let the KeyError be thrown.
if "name" not in source:
source["name"] = get_url_name(source["url"])
if "verify_ssl" not in source:
source["verify_ssl"] = "https://" in source["url"]
if not isinstance(source["verify_ssl"], bool):
source["verify_ssl"] = source["verify_ssl"].lower() == "true"
return source
def get_or_create_lockfile(self):
from pipenv.vendor.requirementslib.models.lockfile import Lockfile as Req_Lockfile
lockfile = None
@@ -748,15 +760,7 @@ class Project(object):
elif not isinstance(sources, list):
sources = [sources,]
lockfile_dict["_meta"]["sources"] = [
{
"name": s.get("name", get_url_name(s.get("url"))),
"url": s["url"],
"verify_ssl": (
s["verify_ssl"] if isinstance(s["verify_ssl"], bool) else (
True if s["verify_ssl"].lower() == "true" else False
)
)
} for s in sources
self.populate_source(s) for s in sources
]
_created_lockfile = Req_Lockfile.from_data(
path=self.lockfile_location, data=lockfile_dict, meta_from_project=False
+17
View File
@@ -486,3 +486,20 @@ def test_lockfile_with_empty_dict(PipenvInstance):
assert c.return_code == 0
assert 'Pipfile.lock is corrupted' in c.err
assert p.lockfile['_meta']
@pytest.mark.lock
@pytest.mark.install
def test_lock_with_incomplete_source(PipenvInstance, pypi):
with PipenvInstance(pypi=pypi, chdir=True) as p:
with open(p.pipfile_path, 'w') as f:
f.write("""
[[source]]
url = "https://test.pypi.org/simple"
[packages]
requests = "*"
""")
c = p.pipenv('install')
assert c.return_code == 0
assert p.lockfile['_meta']['sources']