Skip to content

Commit

Permalink
Merge pull request #4510 from Honza-m/master
Browse files Browse the repository at this point in the history
Fix #4225 - virtualenv name when PIPENV_PYTHON set to filepath
  • Loading branch information
frostming committed Nov 2, 2020
2 parents 912164d + 8d84e6e commit 20ed424
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/4225.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug where setting PIPENV_PYTHON to file path breaks environment name
8 changes: 7 additions & 1 deletion pipenv/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,13 @@ def get_name(name, location):
def virtualenv_name(self):
# type: () -> str
sanitized, encoded_hash = self._get_virtualenv_hash(self.name)
suffix = "-{0}".format(PIPENV_PYTHON) if PIPENV_PYTHON else ""
suffix = ""
if PIPENV_PYTHON:
if os.path.isabs(PIPENV_PYTHON):
suffix = "-{0}".format(os.path.basename(PIPENV_PYTHON))
else:
suffix = "-{0}".format(PIPENV_PYTHON)

# If the pipfile was located at '/home/user/MY_PROJECT/Pipfile',
# the name of its virtualenv will be 'my-project-wyUfYPqE'
return sanitized + "-" + encoded_hash + suffix
Expand Down

0 comments on commit 20ed424

Please sign in to comment.