Skip to content

Commit

Permalink
Don't write build artifacts to cwd
Browse files Browse the repository at this point in the history
- Fixes #3106

Signed-off-by: Dan Ryan <dan@danryan.co>
  • Loading branch information
techalchemy committed Nov 2, 2018
1 parent 740c589 commit b1d3aec
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/3106.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pipenv will avoid leaving build artifacts in the current working directory.
6 changes: 5 additions & 1 deletion pipenv/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,11 @@ class PipCommand(Command):
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)
Expand Down
7 changes: 7 additions & 0 deletions pipenv/vendor/requirementslib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"")
Expand Down

0 comments on commit b1d3aec

Please sign in to comment.