Format common.py file.
This commit is contained in:
parent
ce4d03989b
commit
1d93c35c50
|
@ -42,7 +42,7 @@ SOURCE_DIR = HOME / "SOURCE"
|
||||||
ARCHIVE_DIR = HOME / "ARCHIVE"
|
ARCHIVE_DIR = HOME / "ARCHIVE"
|
||||||
TOOLCHAIN_DIR = BASE_DIR / "TOOLCHAINS"
|
TOOLCHAIN_DIR = BASE_DIR / "TOOLCHAINS"
|
||||||
INSTALL_DIR = BASE_DIR / "INSTALL"
|
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))
|
TMP_DIR = Path(os.getenv("TMP_DIR", default_tmp_dir))
|
||||||
KBUILD_SOURCE_DIR = HOME / "kiwix-build"
|
KBUILD_SOURCE_DIR = HOME / "kiwix-build"
|
||||||
|
|
||||||
|
@ -204,6 +204,7 @@ def run_kiwix_build(
|
||||||
subprocess.check_call(command, cwd=str(HOME), env=env)
|
subprocess.check_call(command, cwd=str(HOME), env=env)
|
||||||
print_message("Build ended")
|
print_message("Build ended")
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import paramiko
|
import paramiko
|
||||||
|
|
||||||
|
@ -216,8 +217,8 @@ try:
|
||||||
host, port = host.split(":", 1)
|
host, port = host.split(":", 1)
|
||||||
else:
|
else:
|
||||||
port = "22"
|
port = "22"
|
||||||
if '@' in host:
|
if "@" in host:
|
||||||
user, host = host.split('@', 1)
|
user, host = host.split("@", 1)
|
||||||
else:
|
else:
|
||||||
user = None
|
user = None
|
||||||
|
|
||||||
|
@ -228,7 +229,14 @@ try:
|
||||||
client = paramiko.client.SSHClient()
|
client = paramiko.client.SSHClient()
|
||||||
client.set_missing_host_key_policy(paramiko.client.WarningPolicy)
|
client.set_missing_host_key_policy(paramiko.client.WarningPolicy)
|
||||||
print_message(f"Connect to {host}:{port}")
|
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:
|
try:
|
||||||
yield client
|
yield client
|
||||||
finally:
|
finally:
|
||||||
|
@ -257,7 +265,6 @@ try:
|
||||||
print_message(f"Sending archive {file_to_upload} to {remote_file}")
|
print_message(f"Sending archive {file_to_upload} to {remote_file}")
|
||||||
sftp.put(str(file_to_upload), str(remote_file), confirm=True)
|
sftp.put(str(file_to_upload), str(remote_file), confirm=True)
|
||||||
|
|
||||||
|
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
# On old system (bionic) paramiko is really complex to install
|
# On old system (bionic) paramiko is really complex to install
|
||||||
# Keep the old implementaion on sush system.
|
# Keep the old implementaion on sush system.
|
||||||
|
|
Loading…
Reference in New Issue