diff options
author | Patrik Teivonen <patrik.teivonen@qt.io> | 2023-02-10 11:43:48 +0200 |
---|---|---|
committer | Patrik Teivonen <patrik.teivonen@qt.io> | 2023-02-10 10:32:53 +0000 |
commit | 132645ce501248d46c2b2e65342d8f3ac6c82ced (patch) | |
tree | b094874eb78e498a44ae01b904a7f31d94664906 | |
parent | ff73adae0068ff323e68a1e0f244e2a02a4ca5d6 (diff) |
Fix some linter errors, broken Pipfile import, update readme
Change minimum Python requirement to 3.6.2 reflecting the
current state of the repository. Make sure linter hook passes
on this version and fix some errors.
Change-Id: I4f569cbda286a2fc878f8d8e5de5d61890a7b301
Reviewed-by: Antti Kokko <antti.kokko@qt.io>
-rw-r--r-- | Pipfile | 4 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | packaging-tools/bld_utils.py | 2 | ||||
-rw-r--r-- | packaging-tools/create_installer.py | 5 | ||||
-rw-r--r-- | packaging-tools/dump_debug_infos.py | 13 | ||||
-rwxr-xr-x | packaging-tools/release_repo_updater.py | 4 | ||||
-rw-r--r-- | packaging-tools/release_repo_updater_deb.py | 12 | ||||
-rw-r--r-- | packaging-tools/sdkcomponent.py | 4 | ||||
-rwxr-xr-x | packaging-tools/tests/test_packaging.py | 2 |
9 files changed, 26 insertions, 22 deletions
@@ -24,7 +24,7 @@ aptly-api-client = "==0.2.4" validators = "==0.20.0" aiofiles = "==0.8.0" aiohttp = "==3.6.3" -typing_extensions = "==4.4.0" +typing_extensions = "==4.1.1" [dev-packages] ddt = "==1.6.0" @@ -46,4 +46,4 @@ types-aiofiles = "==0.8.0" [requires] -python_version = "3.6" +python_version = "3" # Pipfile doesn't support specifying minimum version (>=3.6.2) @@ -6,7 +6,7 @@ The qtsdk repository provides tools used in packaging. ## Requirements -- [Python](https://www.python.org/) 3.6 or higher +- [Python](https://www.python.org/) 3.6.2 or higher - [Pip](https://pip.pypa.io/en/stable/) version 18.0 or higher - 7z command line utility added to PATH - Relevant toolchains for building e.g. GCC, MinGW, MSVC diff --git a/packaging-tools/bld_utils.py b/packaging-tools/bld_utils.py index a71d8fb41..636f360cb 100644 --- a/packaging-tools/bld_utils.py +++ b/packaging-tools/bld_utils.py @@ -110,7 +110,7 @@ def compress(path: str, directory_name: str, sevenzip_target: str) -> None: current_sevenzip_path = Path(parent_directory_path, sevenzip_filename) if current_sevenzip_path != sevenzip_target_path: - shutil.move(current_sevenzip_path, sevenzip_target_path) + shutil.move(str(current_sevenzip_path), str(sevenzip_target_path)) def strip_vars(sobject: Namespace, chars: str) -> None: diff --git a/packaging-tools/create_installer.py b/packaging-tools/create_installer.py index 1abc39d2e..94b4bd4e8 100644 --- a/packaging-tools/create_installer.py +++ b/packaging-tools/create_installer.py @@ -1218,7 +1218,8 @@ class QtInstallerTask(Generic[QtInstallerTaskType]): def _parse_substitutions(self) -> None: for item in self.substitution_list: # pylint: disable=not-an-iterable key, value = item.split("=", maxsplit=1) - if self.substitutions.get(key) is not None: # Do not override already present substs + if self.substitutions.get(key) is not None: # pylint: disable=no-member + # Do not override already present substs log.warning("Duplicate substitution string given, ignoring: %s", item) continue if not value: @@ -1394,7 +1395,7 @@ def main() -> None: create_installer(task) if task.errors: log.warning("Collected %s errors during the execution of the task:", len(task.errors)) - for err_msg in task.errors: + for err_msg in task.errors: # pylint: disable=not-an-iterable log.warning(err_msg) diff --git a/packaging-tools/dump_debug_infos.py b/packaging-tools/dump_debug_infos.py index 0c1b635ee..7f35174b8 100644 --- a/packaging-tools/dump_debug_infos.py +++ b/packaging-tools/dump_debug_infos.py @@ -76,11 +76,14 @@ def dump_sym(dump_syms_path: str, architecture: str, absolute_path: str, sym_pat dump_syms_command = f'{dump_syms_path} {architecture} "{absolute_path}" > "{sym_path}"' if verbose: log.info("call: %s", dump_syms_command) - dump_syms_result = subprocess.run(dump_syms_command, - shell=True, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - text=True) + dump_syms_result = subprocess.run( + dump_syms_command, + shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + universal_newlines=True, + check=True, + ) if os.path.exists(sym_path) and os.stat(sym_path).st_size > 0 and dump_syms_result.returncode == 0: return True raise Exception( diff --git a/packaging-tools/release_repo_updater.py b/packaging-tools/release_repo_updater.py index 8229b595b..91cac3ef1 100755 --- a/packaging-tools/release_repo_updater.py +++ b/packaging-tools/release_repo_updater.py @@ -561,7 +561,7 @@ async def build_online_repositories( if dry_run and installer_task.errors: errors.append( f"Collected {len(installer_task.errors)} errors during the repository task: " - f"{task.get_repo_path()}" + f"{task.repo_path}" ) errors.extend(installer_task.errors) if not dry_run: @@ -837,7 +837,7 @@ async def _build_offline_tasks( if dry_run and installer_task.errors: errors.append( f"Collected {len(installer_task.errors)} errors during the installer task: " - f"{task.get_installer_name()}" + f"{task.installer_name}" ) errors.extend(installer_task.errors) diff --git a/packaging-tools/release_repo_updater_deb.py b/packaging-tools/release_repo_updater_deb.py index 391641912..ec2aebba6 100644 --- a/packaging-tools/release_repo_updater_deb.py +++ b/packaging-tools/release_repo_updater_deb.py @@ -265,7 +265,7 @@ class PopulateRepoCmd: self._execute(work_dir=tmp_dir.path) def _execute(self, work_dir: Path) -> None: - for content_path in self.content_paths: + for content_path in self.content_paths: # pylint: disable=not-an-iterable # support local filesystem paths source_path = Path(content_path).resolve() # if not local filesystem path then we assume an URL @@ -407,7 +407,7 @@ class BatchOperation: def execute(self) -> None: completed: List[Transaction] = [] try: - for command in self.commands: + for command in self.commands: # pylint: disable=not-an-iterable command.execute() completed.append(command) except Exception as ex: @@ -418,7 +418,7 @@ class BatchOperation: raise def undo(self) -> None: - for command in reversed(self.commands): + for command in reversed(self.commands): # pylint: disable=bad-reversed-sequence command.undo() @@ -433,16 +433,16 @@ class RepoController: which can be rewound if any of the Transactions should have failed. """ - undo_stack: list[Transaction] = field(default_factory=list) + undo_stack: List[Transaction] = field(default_factory=list) def execute(self, transaction: Transaction) -> None: transaction.execute() - self.undo_stack.append(transaction) + self.undo_stack.append(transaction) # pylint: disable=no-member def undo(self) -> None: if not self.undo_stack: return - transaction = self.undo_stack.pop() + transaction = self.undo_stack.pop() # pylint: disable=no-member transaction.undo() diff --git a/packaging-tools/sdkcomponent.py b/packaging-tools/sdkcomponent.py index ea67c0db0..ca9c04b61 100644 --- a/packaging-tools/sdkcomponent.py +++ b/packaging-tools/sdkcomponent.py @@ -253,7 +253,7 @@ class ArchiveResolver: if sys.version_info < (3, 7): loop = asyncio.get_event_loop() # keep for Python 3.6 compatibility else: - loop = asyncio.get_running_loop() + loop = asyncio.get_running_loop() # pylint: disable=no-member log.info("Crawl: %s", url) return await loop.run_in_executor(None, htmllistparse.fetch_listing, url, 30) @@ -374,7 +374,7 @@ class IfwSdkComponent: archive.validate_uri() return True except IfwSdkError as err: - self.errors.append(f"[{self.ifw_sdk_comp_name}]: {str(err)}") + self.errors.append(f"[{self.ifw_sdk_comp_name}]: {str(err)}") # pylint: disable=no-member if not ignore_errors: raise log.exception("[%s] Ignored error in component: %s", self.ifw_sdk_comp_name, err) diff --git a/packaging-tools/tests/test_packaging.py b/packaging-tools/tests/test_packaging.py index 570d58153..8a9f21772 100755 --- a/packaging-tools/tests/test_packaging.py +++ b/packaging-tools/tests/test_packaging.py @@ -140,7 +140,7 @@ class TestPackaging(unittest.TestCase): expected_data.append("nonsense") idx = 0 - for line in FileInput(temp_file, inplace=False): + for line in FileInput(str(temp_file), inplace=False): msg = f"Received data: [{line}] differs from expected data: [{expected_data[idx]}]" self.assertEqual(line.strip(), expected_data[idx], msg) idx += 1 |