From: Oleg Broytman Date: Thu, 18 Jan 2024 12:52:04 +0000 (+0300) Subject: Feat(.vim/python/virtualenv.py): Search for `activate_this.py` in w32 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=4012586325e2641a1ea2a960bdeebb7422f3cc9e;p=dotfiles.git Feat(.vim/python/virtualenv.py): Search for `activate_this.py` in w32 --- diff --git a/.vim/python/virtualenv.py b/.vim/python/virtualenv.py index 078a0f8..9341bc7 100644 --- a/.vim/python/virtualenv.py +++ b/.vim/python/virtualenv.py @@ -3,8 +3,14 @@ import sys, os virtualenv_dir = os.environ.get('VIRTUAL_ENV') if virtualenv_dir: sys.path.insert(0, virtualenv_dir) - activate_this = os.path.join(virtualenv_dir, 'bin', 'activate_this.py') - if sys.version_info[0] == 2: - execfile(activate_this, dict(__file__=activate_this)) - else: - exec(open(activate_this, 'r').read(), dict(__file__=activate_this)) + for activate_this in [ + os.path.join(virtualenv_dir, 'bin', 'activate_this.py'), + os.path.join(virtualenv_dir, 'Scripts', 'activate_this.py') + ]: + if not os.path.exists(activate_this): + continue + if sys.version_info[0] == 2: + execfile(activate_this, dict(__file__=activate_this)) + else: + exec(open(activate_this, 'r').read(), dict(__file__=activate_this)) + break