mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
recognize editable packages as in project
Signed-off-by: Frost Ming <mianghong@gmail.com>
This commit is contained in:
@@ -246,7 +246,7 @@ class Environment(object):
|
||||
|
||||
def find_egg(self, egg_dist):
|
||||
"""Find an egg by name in the given environment"""
|
||||
site_packages = get_python_lib()
|
||||
site_packages = self.libdir[1]
|
||||
search_filename = "{0}.egg-link".format(egg_dist.project_name)
|
||||
try:
|
||||
user_site = site.getusersitepackages()
|
||||
@@ -264,8 +264,7 @@ class Environment(object):
|
||||
If the egg - link doesn 't exist, return the supplied distribution."""
|
||||
|
||||
location = self.find_egg(dist)
|
||||
if not location:
|
||||
return dist.location
|
||||
return location or dist.location
|
||||
|
||||
def dist_is_in_project(self, dist):
|
||||
"""Determine whether the supplied distribution is in the environment."""
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import io
|
||||
import pytest
|
||||
import os
|
||||
import tarfile
|
||||
from pipenv.project import Project
|
||||
from pipenv.utils import temp_environ
|
||||
from pipenv.patched import pipfile
|
||||
@@ -161,3 +162,21 @@ version = "*"
|
||||
contents = f.read()
|
||||
assert "[packages.requests]" not in contents
|
||||
assert 'requests = {version = "*"}' in contents
|
||||
|
||||
|
||||
@pytest.mark.install
|
||||
@pytest.mark.project
|
||||
def test_include_editable_packages(PipenvInstance, pypi, testsroot, tmpdir):
|
||||
file_name = "requests-2.19.1.tar.gz"
|
||||
package = os.path.join(tmpdir, "requests-2.19.1")
|
||||
source_path = os.path.abspath(os.path.join(testsroot, "test_artifacts", file_name))
|
||||
with PipenvInstance(chdir=True, pypi=pypi) as p:
|
||||
with tarfile.open(source_path, "r:gz") as tarinfo:
|
||||
tarinfo.extractall(path=tmpdir)
|
||||
c = p.pipenv('install -e {}'.format(package))
|
||||
assert c.return_code == 0
|
||||
project = Project()
|
||||
assert "requests" in [
|
||||
package.project_name
|
||||
for package in project.environment.get_installed_packages()
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user