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:
parent
77b5571ed9
commit
ccaa642d98
1 changed files with 4 additions and 2 deletions
|
@ -14,7 +14,9 @@ the current pipenv.
|
||||||
This is not necessarily aware of env management tools like virtualenv, pyenv or
|
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
|
pipenv, unless those tools have modified the PATH that Emacs picked up when you
|
||||||
started it."
|
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"
|
"pipenv run python --version"
|
||||||
"python --version"))
|
"python --version"))
|
||||||
(bin (car (split-string command " "))))
|
(bin (car (split-string command " "))))
|
||||||
|
@ -26,4 +28,4 @@ started it."
|
||||||
(output (string-trim (buffer-string))))
|
(output (string-trim (buffer-string))))
|
||||||
(unless (zerop p)
|
(unless (zerop p)
|
||||||
(user-error "'%s' failed: %s" command output))
|
(user-error "'%s' failed: %s" command output))
|
||||||
(nth 1 (split-string output " " t))))))
|
(cadr (split-string output " " t))))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue