Don't write build artifacts to cwd

- Fixes #3106

Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
Dan Ryan
2018-11-02 11:17:33 -04:00
parent 740c589ef4
commit b1d3aec5d2
3 changed files with 13 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
Pipenv will avoid leaving build artifacts in the current working directory.
+5 -1
View File
@@ -295,7 +295,11 @@ def actually_resolve_deps(
hashes = {
ireq: pypi._hash_cache.get_hash(ireq.link)
for ireq in constraints if getattr(ireq, "link", None)
and ireq.link.is_artifact and not is_pypi_url(ireq.link.url)
# We can only hash artifacts, but we don't want normal pypi artifcats since the
# normal resolver handles those
and ireq.link.is_artifact and not is_pypi_url(ireq.link.url) and not
# We also don't want to try to hash directories as this will fail (editable deps)
(ireq.link.scheme == "file" and os.path.isdir(ireq.link.path))
}
try:
results = resolver.resolve(max_rounds=environments.PIPENV_MAX_ROUNDS)
+7
View File
@@ -186,7 +186,14 @@ def ensure_setup_py(base_dir):
if not base_dir:
base_dir = create_tracked_tempdir(prefix="requirementslib-setup")
base_dir = Path(base_dir)
if base_dir.exists() and base_dir.name == "setup.py":
base_dir = base_dir.parent
elif not (base_dir.exists() and base_dir.is_dir()):
base_dir = base_dir.parent
if not (base_dir.exists() and base_dir.is_dir()):
base_dir = base_dir.parent
setup_py = base_dir.joinpath("setup.py")
is_new = False if setup_py.exists() else True
if not setup_py.exists():
setup_py.write_text(u"")