From ae5e82003149bf4a328fcc498f64904f0def5476 Mon Sep 17 00:00:00 2001 From: Jan Morawiec Date: Fri, 30 Oct 2020 17:42:20 +0000 Subject: [PATCH 1/2] Fix #4225 - virtualenv name when PIPENV_PYTHON set to filepath --- pipenv/project.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pipenv/project.py b/pipenv/project.py index 8f5cb7a5..62dffd74 100644 --- a/pipenv/project.py +++ b/pipenv/project.py @@ -443,7 +443,13 @@ class Project(object): 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 From 8d84e6e0b292a2f7cd3f29b72ea7ea068c460589 Mon Sep 17 00:00:00 2001 From: Jan Morawiec Date: Sat, 31 Oct 2020 10:51:24 +0000 Subject: [PATCH 2/2] News entry --- news/4225.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/4225.bugfix.rst diff --git a/news/4225.bugfix.rst b/news/4225.bugfix.rst new file mode 100644 index 00000000..39e335a7 --- /dev/null +++ b/news/4225.bugfix.rst @@ -0,0 +1 @@ +Fix a bug where setting PIPENV_PYTHON to file path breaks environment name \ No newline at end of file