diff options
author | Patrik Teivonen <patrik.teivonen@qt.io> | 2022-09-19 13:56:08 +0300 |
---|---|---|
committer | Patrik Teivonen <patrik.teivonen@qt.io> | 2023-01-24 08:16:22 +0000 |
commit | af577fe8782e18188273e48c3ce3f475ac2debf4 (patch) | |
tree | ee765420a3668a22ce476485ae82421f25c79fdd /packaging-tools/build_clang_qdoc.py | |
parent | e1ade868e5aa13abc368444c582a0de762204ff2 (diff) |
PL122: os.path.splitext("foo.bar") should be replaced by path.suffix
os.path.split and os.path.splitext to pathlib equivalents
adjust bldinstallercommon.calculate_relpath unit tests
Change-Id: Ieb49864ed4f804cfdff61492edfb622ce1c4a9dc
Reviewed-by: Antti Kokko <antti.kokko@qt.io>
Diffstat (limited to 'packaging-tools/build_clang_qdoc.py')
-rw-r--r-- | packaging-tools/build_clang_qdoc.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/packaging-tools/build_clang_qdoc.py b/packaging-tools/build_clang_qdoc.py index d4d9f78df..97377032a 100644 --- a/packaging-tools/build_clang_qdoc.py +++ b/packaging-tools/build_clang_qdoc.py @@ -3,7 +3,7 @@ ############################################################################# # -# Copyright (C) 2022 The Qt Company Ltd. +# Copyright (C) 2023 The Qt Company Ltd. # Contact: https://www.qt.io/licensing/ # # This file is part of the release tools of the Qt Toolkit. @@ -31,6 +31,7 @@ import os from contextlib import suppress +from pathlib import Path from subprocess import CalledProcessError from typing import Dict, List, Optional @@ -251,16 +252,16 @@ def check_clang(toolchain: str, build_path: str, environment: Optional[Dict[str, def package_clang(install_path: str, result_file_path: str) -> None: - (basepath, dirname) = os.path.split(install_path) - zip_command = ['cmake', '-E', 'tar', 'cvf', result_file_path, '--format=7zip', dirname] - run_command(zip_command, basepath) + install_dir = Path(install_path) + zip_cmd = ['cmake', '-E', 'tar', 'cvf', result_file_path, '--format=7zip', install_dir.name] + run_command(zip_cmd, cwd=str(install_dir.parent)) def upload_clang(file_path: str, remote_path: str) -> None: - (path, filename) = os.path.split(file_path) + local_path = Path(file_path) scp_bin = '%SCP%' if is_windows() else 'scp' - scp_command = [scp_bin, filename, remote_path] - run_command(scp_command, path) + scp_command = [scp_bin, local_path.name, remote_path] + run_command(scp_command, cwd=str(local_path.parent)) def main() -> None: |