lang/python: fix pipenv creating Pipfiles in pwd #888

`pipenv run ...` searches for a Pipfile itself, but doesn't search far
enough, creating a Pipfile in the current directory. Instead, we run the
command from the pipenv project root so it doesn't have to search.
This commit is contained in:
Henrik Lissner 2018-09-21 13:31:46 -04:00
parent 77b5571ed9
commit ccaa642d98
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -14,7 +14,9 @@ the current pipenv.
This is not necessarily aware of env management tools like virtualenv, pyenv or
pipenv, unless those tools have modified the PATH that Emacs picked up when you
started it."
(let* ((command (if (pipenv-project-p)
(let* ((pipenv-dir (pipenv-project-p))
(default-directory (or pipenv-dir default-directory))
(command (if pipenv-dir
"pipenv run python --version"
"python --version"))
(bin (car (split-string command " "))))
@ -26,4 +28,4 @@ started it."
(output (string-trim (buffer-string))))
(unless (zerop p)
(user-error "'%s' failed: %s" command output))
(nth 1 (split-string output " " t))))))
(cadr (split-string output " " t))))))