mirror of https://github.com/zulip/zulip.git
provision: enabling automatic activation of zulip-py3-venv at the lunch of shell only for dedicated containers.
Refactor tools/lib/provision_inner to conditionally write activation commands to user's bash profile based on the host machine type. Automatic activation now skipped for native linux containers. Fixes #15029
This commit is contained in:
parent
08bf7efeb8
commit
ba4c45aa90
|
@ -93,8 +93,16 @@ def setup_shell_profile(shell_profile: str) -> None:
|
|||
with open(shell_profile_path, "w") as shell_profile_file:
|
||||
shell_profile_file.writelines(command + "\n")
|
||||
|
||||
source_activate_command = "source " + os.path.join(VENV_PATH, "bin", "activate")
|
||||
write_command(source_activate_command)
|
||||
# Check if the environment is one of the dedicated containers: Vagrant, Docker, Droplet or WSL2
|
||||
WSL = os.path.exists("/proc/sys/fs/binfmt_misc/WSLInterop")
|
||||
vagrant = os.path.exists("/vagrant")
|
||||
docker = os.path.exists("/var/run/docker.sock")
|
||||
droplet = os.path.exists("/etc/digitalocean")
|
||||
# If the environment matches one of the containers, write the activation command to the user's bash profile
|
||||
if WSL or vagrant or docker or droplet:
|
||||
source_activate_command = "source " + os.path.join(VENV_PATH, "bin", "activate")
|
||||
write_command(source_activate_command)
|
||||
|
||||
if os.path.exists("/srv/zulip"):
|
||||
write_command("cd /srv/zulip")
|
||||
|
||||
|
|
Loading…
Reference in New Issue