mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
More explicit failures
This commit is contained in:
+5
-1
@@ -102,7 +102,11 @@ if PIPENV_NOSPIN:
|
||||
|
||||
def which(command, location=None, allow_global=False):
|
||||
if not allow_global and location is None:
|
||||
location = project.virtualenv_location or os.environ.get("VIRTUAL_ENV")
|
||||
location = (
|
||||
project.virtualenv_location
|
||||
or os.environ.get("VIRTUAL_ENV", "")
|
||||
)
|
||||
assert location, "virtual environment not created"
|
||||
if not allow_global:
|
||||
if os.name == "nt":
|
||||
p = find_windows_executable(os.path.join(location, "Scripts"), command)
|
||||
|
||||
+3
-1
@@ -319,12 +319,14 @@ class Project(object):
|
||||
if self._virtualenv_location:
|
||||
return self._virtualenv_location
|
||||
|
||||
assert self.project_directory, "project not created"
|
||||
|
||||
# Default mode.
|
||||
if not self.is_venv_in_project():
|
||||
loc = self._get_virtualenv_location(self.virtualenv_name)
|
||||
# The user wants the virtualenv in the project.
|
||||
else:
|
||||
loc = os.sep.join(self.pipfile_location.split(os.sep)[:-1] + [".venv"])
|
||||
loc = os.path.join(self.project_directory, ".venv")
|
||||
self._virtualenv_location = loc
|
||||
return loc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user