From fc506e35ad62bff256c077f9c438367cca3e6e90 Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Thu, 3 Jun 2021 11:35:57 +0200 Subject: [PATCH 1/4] back-fixes for CARTA 1.4 --- iglesia/__init__.py | 2 +- radiopadre_client/remote.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/iglesia/__init__.py b/iglesia/__init__.py index 4eb90c2..5203e7b 100644 --- a/iglesia/__init__.py +++ b/iglesia/__init__.py @@ -186,7 +186,7 @@ def get_carta_url(*args): url = f"http://localhost:{CARTA_PORT}" if CARTA_VERSION < "2": - args = [f"socketUrl=ws://localhost:{CARTA_WS_PORT}"] + args + args = [f"socketUrl=ws://localhost:{CARTA_WS_PORT}"] + list(args) if args: return f"{url}?{'&'.join(args)}" diff --git a/radiopadre_client/remote.py b/radiopadre_client/remote.py index 0b8f7f0..bd2cbb8 100644 --- a/radiopadre_client/remote.py +++ b/radiopadre_client/remote.py @@ -314,6 +314,7 @@ def check_remote_command(command): for _ in range(NUM_PORTS): starting_port = find_unused_port(starting_port + 1, 10000) ports.append(starting_port) + iglesia.set_userside_ports(ports) remote_config["remote"] = ":".join(map(str, ports)) @@ -422,6 +423,7 @@ def check_remote_command(command): iglesia.CARTA_VERSION = match.group(1) if config.CARTA_BROWSER: urls.append(iglesia.get_carta_url()) + message(f"Remote CARTA version is {iglesia.CARTA_VERSION} ({config.CARTA_BROWSER})") continue if "jupyter notebook server is running" in line: From 8655785ee8e12151853d9b67776aa276784e071a Mon Sep 17 00:00:00 2001 From: Lexy Andati Date: Wed, 14 Jul 2021 17:25:08 +0200 Subject: [PATCH 2/4] Fix str error with no-browser mode (#39) --- bin/run-radiopadre | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/run-radiopadre b/bin/run-radiopadre index a7f639f..2ed7b06 100755 --- a/bin/run-radiopadre +++ b/bin/run-radiopadre @@ -324,7 +324,7 @@ import signal signal.signal(signal.SIGHUP, _handle_hup) # work out browser -if config.BROWSER.upper() in ("NONE", "FALSE", "0"): +if str(config.BROWSER).upper() in ("NONE", "FALSE", "0"): config.BROWSER = None From d1b3fc83686513db57dd61ad6afa11a8d93998d6 Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Wed, 17 Nov 2021 16:52:09 +0200 Subject: [PATCH 3/4] fixes https://github.com/ratt-ru/radiopadre/issues/112 some more --- iglesia/utils.py | 7 +++++-- radiopadre_client/backends/venv.py | 7 ++++++- radiopadre_client/remote.py | 7 ++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/iglesia/utils.py b/iglesia/utils.py index 7e48090..42363ad 100644 --- a/iglesia/utils.py +++ b/iglesia/utils.py @@ -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 diff --git a/radiopadre_client/backends/venv.py b/radiopadre_client/backends/venv.py index 3abe534..176d935 100644 --- a/radiopadre_client/backends/venv.py +++ b/radiopadre_client/backends/venv.py @@ -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}") diff --git a/radiopadre_client/remote.py b/radiopadre_client/remote.py index bd2cbb8..2061e01 100644 --- a/radiopadre_client/remote.py +++ b/radiopadre_client/remote.py @@ -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}") From 50cfc2d2f66562c6e98a02c2642c4ebaedaa6fad Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Wed, 17 Nov 2021 17:01:48 +0200 Subject: [PATCH 4/4] fixes https://github.com/ratt-ru/radiopadre/issues/112 some more --- radiopadre_client/backends/venv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radiopadre_client/backends/venv.py b/radiopadre_client/backends/venv.py index 176d935..65ce2be 100644 --- a/radiopadre_client/backends/venv.py +++ b/radiopadre_client/backends/venv.py @@ -121,7 +121,7 @@ def update_installation(): bye("no radiopadre installation method specified (see --server-install options)") if config.VENV_IGNORE_JS9: - env = dict(RADIOPADRE_JS9_IGNORE_ERRORS=1) + env = dict(RADIOPADRE_JS9_IGNORE_ERRORS='1') else: env = None