From 1d93c35c50aef548afb4abc6efcfbe76671cc5fc Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Fri, 23 Aug 2024 10:18:32 +0200 Subject: [PATCH] Format common.py file. --- .github/scripts/common.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/scripts/common.py b/.github/scripts/common.py index 4bdc1d0..7a2beac 100644 --- a/.github/scripts/common.py +++ b/.github/scripts/common.py @@ -42,7 +42,7 @@ SOURCE_DIR = HOME / "SOURCE" ARCHIVE_DIR = HOME / "ARCHIVE" TOOLCHAIN_DIR = BASE_DIR / "TOOLCHAINS" INSTALL_DIR = BASE_DIR / "INSTALL" -default_tmp_dir = os.getenv("TEMP") if platform.system() == 'Windows' else "/tmp" +default_tmp_dir = os.getenv("TEMP") if platform.system() == "Windows" else "/tmp" TMP_DIR = Path(os.getenv("TMP_DIR", default_tmp_dir)) KBUILD_SOURCE_DIR = HOME / "kiwix-build" @@ -204,6 +204,7 @@ def run_kiwix_build( subprocess.check_call(command, cwd=str(HOME), env=env) print_message("Build ended") + try: import paramiko @@ -216,8 +217,8 @@ try: host, port = host.split(":", 1) else: port = "22" - if '@' in host: - user, host = host.split('@', 1) + if "@" in host: + user, host = host.split("@", 1) else: user = None @@ -228,7 +229,14 @@ try: client = paramiko.client.SSHClient() client.set_missing_host_key_policy(paramiko.client.WarningPolicy) print_message(f"Connect to {host}:{port}") - client.connect(host, port=port, username=user, key_filename=_environ.get("SSH_KEY"), look_for_keys=False, compress=True) + client.connect( + host, + port=port, + username=user, + key_filename=_environ.get("SSH_KEY"), + look_for_keys=False, + compress=True, + ) try: yield client finally: @@ -257,7 +265,6 @@ try: print_message(f"Sending archive {file_to_upload} to {remote_file}") sftp.put(str(file_to_upload), str(remote_file), confirm=True) - except ModuleNotFoundError: # On old system (bionic) paramiko is really complex to install # Keep the old implementaion on sush system.