blob: 92745367f8a56b435c31fc65b0d7fd7313ebf103 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
import subprocess
import sys
import logging
"""
All utility functions for deployment
"""
def run_command(command, dry_run: bool):
command_str = " ".join([str(cmd) for cmd in command])
try:
if not dry_run:
subprocess.check_call(command, shell=(sys.platform == "win32"))
else:
print(command_str + "\n")
except FileNotFoundError as error:
logging.exception(f"[DEPLOY]: {error.filename} not found")
raise
except subprocess.CalledProcessError as error:
logging.exception(
f"[DEPLOY]: Command {command_str} failed with error {error} and return_code"
f"{error.returncode}"
)
raise
except Exception as error:
logging.exception(f"[DEPLOY]: Command {command_str} failed with error {error}")
raise
|