mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 14:50:16 +00:00
fix #4775 Consider environment variable PIP_TARGET when calculate depndancy delta.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
If `PIP_TARGET` is set to environment variables, Refer specified directory for calculate delta, instead default directory
|
||||
@@ -540,7 +540,7 @@ class Environment:
|
||||
:rtype: iterator
|
||||
"""
|
||||
|
||||
libdirs = self.base_paths["libdirs"].split(os.pathsep)
|
||||
libdirs = os.environ.get('PIP_TARGET', self.base_paths["libdirs"].split(os.pathsep))
|
||||
dists = (pkg_resources.find_distributions(libdir) for libdir in libdirs)
|
||||
yield from itertools.chain.from_iterable(dists)
|
||||
|
||||
|
||||
@@ -111,3 +111,30 @@ requests = "*"
|
||||
c = p.pipenv('sync --sequential --verbose')
|
||||
for package in p.lockfile['default']:
|
||||
assert f'Successfully installed {package}' in c.stdout
|
||||
|
||||
|
||||
@pytest.mark.sync
|
||||
def test_sync_consider_pip_target(PipenvInstance):
|
||||
"""
|
||||
"""
|
||||
with PipenvInstance(chdir=True) as p:
|
||||
with open(p.pipfile_path, 'w') as f:
|
||||
f.write("""
|
||||
[packages]
|
||||
six = "*"
|
||||
""".strip())
|
||||
|
||||
# Perform initial lock.
|
||||
c = p.pipenv('lock')
|
||||
assert c.returncode == 0
|
||||
lockfile_content = p.lockfile
|
||||
assert lockfile_content
|
||||
c = p.pipenv('sync')
|
||||
assert c.returncode == 0
|
||||
|
||||
pip_target_dir = 'target_dir'
|
||||
os.environ['PIP_TARGET'] = pip_target_dir
|
||||
c = p.pipenv('sync')
|
||||
assert c.returncode == 0
|
||||
assert 'six.py' in os.listdir(os.path.join(p.path, pip_target_dir))
|
||||
os.environ.pop('PIP_TARGET')
|
||||
|
||||
Reference in New Issue
Block a user