diff options
| author | Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> | 2022-10-14 10:44:13 +0200 |
|---|---|---|
| committer | Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> | 2022-10-20 11:58:32 +0200 |
| commit | 55993006f96e5d9d668b33eb4befa31f50e931a4 (patch) | |
| tree | ea0a6da0542a01e16b85a1e41919d1c8949dd5e9 /sources/pyside-tools/deploy/commands.py | |
| parent | 328b8a52e9dda9d9f9a6daca1d2981f022be1720 (diff) | |
Deploy Tool: Split classes and functions
- As deploy.py was getting bigger, each class is split into
respective modules inside psyide-tools/deploy/
Pick-to: 6.4.0
Task-number: PYSIDE-1912
Change-Id: I465a25773343cb842cbfd603941476ed6d575321
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Diffstat (limited to 'sources/pyside-tools/deploy/commands.py')
| -rw-r--r-- | sources/pyside-tools/deploy/commands.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sources/pyside-tools/deploy/commands.py b/sources/pyside-tools/deploy/commands.py new file mode 100644 index 000000000..92745367f --- /dev/null +++ b/sources/pyside-tools/deploy/commands.py @@ -0,0 +1,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 |
