Skip to content

Commit

Permalink
fixes ratt-ru/radiopadre#112 some more
Browse files Browse the repository at this point in the history
  • Loading branch information
o-smirnov committed Nov 17, 2021
1 parent 8655785 commit d1b3fc8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
7 changes: 5 additions & 2 deletions iglesia/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ def bye(x, code=1):
message(x, level=logging.ERROR)
sys.exit(code)

def shell(cmd, ignore_fail=False):
def shell(cmd, ignore_fail=False, env=None):
"""Runs shell command. If ignore_fail is set, returns None on failure"""
if env is not None:
env = dict(**env)
env.update(os.environ)
try:
return subprocess.check_call(cmd, shell=True)
return subprocess.check_call(cmd, shell=True, env=env)
except subprocess.CalledProcessError as exc:
if ignore_fail:
return None
Expand Down
7 changes: 6 additions & 1 deletion radiopadre_client/backends/venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,14 @@ def update_installation():
else:
bye("no radiopadre installation method specified (see --server-install options)")

if config.VENV_IGNORE_JS9:
env = dict(RADIOPADRE_JS9_IGNORE_ERRORS=1)
else:
env = None

cmd = f"{pip_install} -U {install}"
message(f"Running {cmd}")
shell(cmd)
shell(cmd, env=env)

# if not config.INSIDE_CONTAINER_PORTS:
# message(f" Radiopadre has been installed from {config.SERVER_INSTALL_PATH}")
Expand Down
7 changes: 4 additions & 3 deletions radiopadre_client/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,11 @@ def check_remote_command(command):
if not check_remote_file(f"{config.RADIOPADRE_VENV}/bin/activate", "-f"):
message(f"Creating virtualenv {remote_venv}")
ssh_remote_v(f"virtualenv -p python3 {config.RADIOPADRE_VENV}")
extras = "pip setuptools"
if config.VENV_EXTRAS:
extras = " ".join(config.VENV_EXTRAS.split(","))
message(f"Installing specified extras: {extras}")
ssh_remote_v(f"source {config.RADIOPADRE_VENV}/bin/activate && {pip_install} {extras}")
extras += " ".join(config.VENV_EXTRAS.split(","))
message(f"Installing {extras}")
ssh_remote_v(f"source {config.RADIOPADRE_VENV}/bin/activate && {pip_install} -U {extras}")
else:
message(f"Installing into existing virtualenv {remote_venv}")

Expand Down

0 comments on commit d1b3fc8

Please sign in to comment.