Fix conflict between pipenv directory .venv and pyvenv file .venv
This commit is contained in:
parent
7857bcae4d
commit
c2a351cac7
|
@ -1722,6 +1722,8 @@ Benner and Paweł Siudak):
|
|||
JimmyG)
|
||||
- Highlight python3.7 builtin =breakpoint()= function (thanks to Boris
|
||||
Verhovsky)
|
||||
- Fix conflict between pipenv directory .venv and pyvenv file .venv (thanks to
|
||||
rgb-24bit)
|
||||
**** Racket
|
||||
- Restore smart closing paren behavior in racket-mode (thanks to Don March)
|
||||
**** Ranger
|
||||
|
|
|
@ -212,18 +212,22 @@ as the pyenv version then also return nil. This works around https://github.com/
|
|||
version file-path))))))
|
||||
|
||||
(defun spacemacs//pyvenv-mode-set-local-virtualenv ()
|
||||
"Set pyvenv virtualenv from \".venv\" by looking in parent directories."
|
||||
"Set pyvenv virtualenv from \".venv\" by looking in parent directories. handle directory or file"
|
||||
(interactive)
|
||||
(let ((root-path (locate-dominating-file default-directory
|
||||
".venv")))
|
||||
(when root-path
|
||||
(let* ((file-path (expand-file-name ".venv" root-path))
|
||||
(virtualenv
|
||||
(with-temp-buffer
|
||||
(insert-file-contents-literally file-path)
|
||||
(buffer-substring-no-properties (line-beginning-position)
|
||||
(line-end-position)))))
|
||||
(pyvenv-workon virtualenv)))))
|
||||
(if (file-directory-p file-path)
|
||||
file-path
|
||||
(with-temp-buffer
|
||||
(insert-file-contents-literally file-path)
|
||||
(buffer-substring-no-properties (line-beginning-position)
|
||||
(line-end-position))))))
|
||||
(if (file-directory-p virtualenv)
|
||||
(pyvenv-activate virtualenv)
|
||||
(pyvenv-workon virtualenv))))))
|
||||
|
||||
|
||||
;; Tests
|
||||
|
|
Loading…
Reference in New Issue