mirror of https://github.com/zulip/zulip.git
setup_venv: Use run_as_root helper.
Also, don't use split() to break up strings to pass into run().
This commit is contained in:
parent
d9adc9d7bc
commit
478e215acd
|
@ -199,21 +199,20 @@ def try_to_copy_venv(venv_path, new_packages):
|
||||||
_, source_venv_path, copied_packages = overlaps[-1]
|
_, source_venv_path, copied_packages = overlaps[-1]
|
||||||
print('Copying packages from {}'.format(source_venv_path))
|
print('Copying packages from {}'.format(source_venv_path))
|
||||||
clone_ve = "{}/bin/virtualenv-clone".format(source_venv_path)
|
clone_ve = "{}/bin/virtualenv-clone".format(source_venv_path)
|
||||||
cmd = "sudo {exe} {source} {target}".format(exe=clone_ve,
|
cmd = [clone_ve, source_venv_path, venv_path]
|
||||||
source=source_venv_path,
|
|
||||||
target=venv_path).split()
|
|
||||||
try:
|
try:
|
||||||
# TODO: We can probably remove this in a few months, now
|
# TODO: We can probably remove this in a few months, now
|
||||||
# that we can expect that virtualenv-clone is present in
|
# that we can expect that virtualenv-clone is present in
|
||||||
# all of our recent virtualenvs.
|
# all of our recent virtualenvs.
|
||||||
run(cmd)
|
run_as_root(cmd)
|
||||||
except Exception:
|
except Exception:
|
||||||
# Virtualenv-clone is not installed. Install it and try running
|
# Virtualenv-clone is not installed. Install it and try running
|
||||||
# the command again.
|
# the command again.
|
||||||
try:
|
try:
|
||||||
run("{}/bin/pip install --no-deps virtualenv-clone".format(
|
run([os.path.join(source_venv_path, "bin", "pip"), "install",
|
||||||
source_venv_path).split())
|
"--no-deps", "virtualenv-clone"])
|
||||||
run(cmd)
|
run_as_root(cmd)
|
||||||
except Exception:
|
except Exception:
|
||||||
# virtualenv-clone isn't working, so just make a new venv
|
# virtualenv-clone isn't working, so just make a new venv
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in New Issue