mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 22:43:42 +00:00
setup_path_on_import: Skip activate_this if already activated.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
committed by
Tim Abbott
parent
2ad1a27b28
commit
7a58f574bf
@@ -7,12 +7,13 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
activate_this = os.path.join(
|
|
||||||
BASE_DIR,
|
venv = os.path.join(BASE_DIR, "zulip-py3-venv")
|
||||||
"zulip-py3-venv",
|
if sys.prefix != venv:
|
||||||
"bin",
|
activate_this = os.path.join(venv, "bin", "activate_this.py")
|
||||||
"activate_this.py")
|
|
||||||
if os.path.exists(activate_this):
|
|
||||||
# this file will exist in production
|
# this file will exist in production
|
||||||
exec(open(activate_this).read(), {}, dict(__file__=activate_this))
|
if os.path.exists(activate_this):
|
||||||
|
activate_locals = dict(__file__=activate_this)
|
||||||
|
exec(open(activate_this).read(), {}, activate_locals)
|
||||||
|
|
||||||
sys.path.append(BASE_DIR)
|
sys.path.append(BASE_DIR)
|
||||||
|
|||||||
Reference in New Issue
Block a user