mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +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
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
activate_this = os.path.join(
|
||||
BASE_DIR,
|
||||
"zulip-py3-venv",
|
||||
"bin",
|
||||
"activate_this.py")
|
||||
if os.path.exists(activate_this):
|
||||
|
||||
venv = os.path.join(BASE_DIR, "zulip-py3-venv")
|
||||
if sys.prefix != venv:
|
||||
activate_this = os.path.join(venv, "bin", "activate_this.py")
|
||||
# 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)
|
||||
|
||||
Reference in New Issue
Block a user