diff options
author | Patrik Teivonen <patrik.teivonen@qt.io> | 2022-07-05 16:29:43 +0300 |
---|---|---|
committer | Patrik Teivonen <patrik.teivonen@qt.io> | 2022-09-06 12:51:34 +0000 |
commit | 0c572d513806d3c514d58d1cc940d3e419caba50 (patch) | |
tree | ceb184228cb59b6a046026f9f649abbe1a554f58 | |
parent | b572d10a9d12bd2d983fdaf57de4ec3050e6d800 (diff) |
pylint: Avoid redefining built-in or outer functions and variables
Enable W0621 and W0622 in pylint.
Rename variables and functions affected to avoid unintended redefinition.
Change-Id: I7ffb87c9665788e6d68e14f27c652c98248900e7
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
-rw-r--r-- | .pre-commit-config.yaml | 2 | ||||
-rwxr-xr-x | packaging-tools/bld_ifw_tools.py | 6 | ||||
-rw-r--r-- | packaging-tools/bld_lib.py | 7 | ||||
-rw-r--r-- | packaging-tools/bld_openssl.py | 4 | ||||
-rw-r--r-- | packaging-tools/bld_sdktool.py | 8 | ||||
-rw-r--r-- | packaging-tools/build_clang.py | 4 | ||||
-rw-r--r-- | packaging-tools/build_wrapper.py | 20 | ||||
-rwxr-xr-x | packaging-tools/release_repo_updater.py | 78 | ||||
-rw-r--r-- | packaging-tools/tests/test_bldinstallercommon.py | 12 | ||||
-rw-r--r-- | packaging-tools/tests/test_create_installer.py | 18 | ||||
-rwxr-xr-x | packaging-tools/tests/test_release_repo_updater.py | 2 | ||||
-rwxr-xr-x | packaging-tools/tests/test_runner.py | 18 |
12 files changed, 90 insertions, 89 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7dfa82b96..4ba597411 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,7 +41,7 @@ repos: fail_fast: true - id: pylint name: Analyze code (pylint) - entry: bash -c 'for x in "$@"; do pipenv run python3 -m pylint --errors-only --enable=C0209,W1202,W1203,C0325,R1705,R1720,R1721,R1723,R1724,W0104,W0105,W0107,W0612,W0613,R0205,R1711,R1727,R1719,W1503,W0402,W1514,R1732 "$x"; done' + entry: bash -c 'for x in "$@"; do pipenv run python3 -m pylint --errors-only --enable=C0209,W1202,W1203,C0325,R1705,R1720,R1721,R1723,R1724,W0104,W0105,W0107,W0612,W0613,R0205,R1711,R1727,R1719,W1503,W0402,W1514,R1732,W0621,W0622 "$x"; done' language: system types: [python] fail_fast: true diff --git a/packaging-tools/bld_ifw_tools.py b/packaging-tools/bld_ifw_tools.py index 46a7af446..3c1eff560 100755 --- a/packaging-tools/bld_ifw_tools.py +++ b/packaging-tools/bld_ifw_tools.py @@ -736,14 +736,14 @@ def sign_windows_installerbase(file_name): ############################### # Replace all dict keys with values in file ############################### -def patch(file, dict): +def patch(file, replacements): filedata = None print(f"Patching {file} ...") with open(file, 'r', encoding="utf-8") as f: filedata = f.read() - for key in dict: - filedata = filedata.replace(key, dict[key]) + for key in replacements: + filedata = filedata.replace(key, replacements[key]) with open(file, 'w', encoding="utf-8") as f: f.write(filedata) diff --git a/packaging-tools/bld_lib.py b/packaging-tools/bld_lib.py index 6bba8d57a..2dd78dd2e 100644 --- a/packaging-tools/bld_lib.py +++ b/packaging-tools/bld_lib.py @@ -38,6 +38,7 @@ import shutil import sys import tarfile from glob import glob +from pathlib import Path from shutil import which from subprocess import CalledProcessError, check_call from time import gmtime, strftime @@ -71,9 +72,9 @@ def findFile(searchPath: str, fileName: str) -> str: def collectLibs(searchPath: str) -> List[str]: for root, dirs, _ in os.walk(searchPath): - for dir in dirs: - if dir == "lib": - return [os.path.join(root, dir, x) for x in os.listdir(os.path.join(root, dir))] + for dir_name in dirs: + if dir_name == "lib": + return [str(Path(root, dir_name, x)) for x in os.listdir(Path(root, dir_name))] assert False, f"Unable to find: 'lib' from: {searchPath}" diff --git a/packaging-tools/bld_openssl.py b/packaging-tools/bld_openssl.py index 4b26257db..40d23ad3b 100644 --- a/packaging-tools/bld_openssl.py +++ b/packaging-tools/bld_openssl.py @@ -54,8 +54,8 @@ def build(src_dir, install_dir, toolset): def archive(install_dir, archive_prefix): - (dir, name) = os.path.split(install_dir) - do_execute_sub_process(['7z', 'a', archive_prefix + '.7z', name], dir, True) + (directory, name) = os.path.split(install_dir) + do_execute_sub_process(['7z', 'a', archive_prefix + '.7z', name], directory, True) do_execute_sub_process(['7z', 'a', archive_prefix + '-runtime.7z', '*.dll'], os.path.join(install_dir, 'bin'), True) diff --git a/packaging-tools/bld_sdktool.py b/packaging-tools/bld_sdktool.py index 3ad122ef0..ce5bfba5f 100644 --- a/packaging-tools/bld_sdktool.py +++ b/packaging-tools/bld_sdktool.py @@ -61,11 +61,11 @@ def qt_static_platform_configure_options(): return [] -def qt_src_path(qt_build_base): +def get_qt_src_path(qt_build_base): return os.path.join(qt_build_base, 'src') -def qt_build_path(qt_build_base): +def get_qt_build_path(qt_build_base): return os.path.join(qt_build_base, 'build') @@ -134,8 +134,8 @@ def build_sdktool(qt_src_url, qt_build_base, sdktool_src_path, sdktool_build_pat target_path=sdktool_target_path, make_command=make_command, redirect_output=redirect_output) - qt_src = qt_src_path(qt_build_base) - qt_build = qt_build_path(qt_build_base) + qt_src = get_qt_src_path(qt_build_base) + qt_build = get_qt_build_path(qt_build_base) get_and_extract_qt_src(qt_src_url, qt_build_base, qt_src) configure_qt(params, qt_src, qt_build) build_qt(params, qt_build) diff --git a/packaging-tools/build_clang.py b/packaging-tools/build_clang.py index fc285f9b9..cff938dfd 100644 --- a/packaging-tools/build_clang.py +++ b/packaging-tools/build_clang.py @@ -345,7 +345,7 @@ def build_and_install(build_path, environment, build_targets, install_targets): do_execute_sub_process(install_cmd + install_targets, build_path, extra_env=environment) -def cmake_command(toolchain, src_path, install_path, profile_data_path, first_run, bitness, build_type): +def get_cmake_command(toolchain, src_path, install_path, profile_data_path, first_run, bitness, build_type): enabled_projects = 'clang;clang-tools-extra' if profile_data_path and first_run: enabled_projects = 'clang' @@ -376,7 +376,7 @@ def build_clang(toolchain, src_path, build_path, install_path, profile_data_path if build_path and not os.path.lexists(build_path): os.makedirs(build_path) - cmake_cmd = cmake_command(toolchain, src_path, install_path, profile_data_path, first_run, bitness, build_type) + cmake_cmd = get_cmake_command(toolchain, src_path, install_path, profile_data_path, first_run, bitness, build_type) do_execute_sub_process(cmake_cmd, build_path, extra_env=environment) diff --git a/packaging-tools/build_wrapper.py b/packaging-tools/build_wrapper.py index 799cea36c..4a041124e 100644 --- a/packaging-tools/build_wrapper.py +++ b/packaging-tools/build_wrapper.py @@ -308,9 +308,9 @@ class BuildLog: raise return self.file - def __exit__(self, type, value, traceback): + def __exit__(self, exc_type, exc_value, exc_traceback): self.file.close() - if type: # exception raised -> print the log and re-raise + if exc_type: # exception raised -> print the log and re-raise with open(self.log_filepath, 'r', encoding="utf-8") as f: print(f.read()) return True # re-raise @@ -629,9 +629,9 @@ def handle_qt_creator_build(optionDict, qtCreatorPlugins): extract_work = Task('Extract packages') def add_download_extract(url, target_path): - (download, extract) = create_download_and_extract_tasks( + (dl_task, extract) = create_download_and_extract_tasks( url, target_path, download_temp) - download_work.addTaskObject(download) + download_work.addTaskObject(dl_task) extract_work.addFunction(extract.do) # clang package @@ -668,14 +668,14 @@ def handle_qt_creator_build(optionDict, qtCreatorPlugins): # Documentation package for cross-references to Qt. # Unfortunately this doesn't follow the normal module naming convention. # We have to download, unpack, and repack renaming the toplevel directory. - (download, repackage, documentation_local_url) = create_download_documentation_task( + (dl_task, repackage, documentation_local_url) = create_download_documentation_task( pkg_base_path + '/' + qt_base_path, os.path.join(download_temp, 'qtdocumentation')) - download_work.addTaskObject(download) + download_work.addTaskObject(dl_task) extract_work.addFunction(repackage.do) if openssl_libs: - (download, repackage, openssl_local_url) = create_download_openssl_task(openssl_libs, os.path.join(download_temp, 'openssl')) - download_work.addTaskObject(download) + (dl_task, repackage, openssl_local_url) = create_download_openssl_task(openssl_libs, os.path.join(download_temp, 'openssl')) + download_work.addTaskObject(dl_task) extract_work.addFunction(repackage.do) download_packages_work = Task('Get and extract all needed packages') @@ -1074,7 +1074,7 @@ def initPkgOptions(args): else: optionDict = dict(os.environ) # Check for command line overrides - optionDict['LICENSE'] = args.license + optionDict['LICENSE'] = args.license_ optionDict['PACKAGE_STORAGE_SERVER_BASE_DIR'] = args.path optionDict['OPENSSL_LIBS'] = args.openssl_libs optionDict['SNAPSHOT_SERVER_PATH'] = args.snapshot_path @@ -1153,7 +1153,7 @@ def main() -> None: parser = argparse.ArgumentParser(prog="Build Wrapper", description="Manage all packaging related build steps.") parser.add_argument("-c", "--command", dest="command", required=True, choices=CMD_LIST, help=str(CMD_LIST)) parser.add_argument("--pkg-conf-file", dest="pkg_conf_file", default="", help="instead of reading various config options from env variables read them from the given file.") - parser.add_argument("-l", "--license", dest="license", default="", help="license type: enterprise or opensource") + parser.add_argument("-l", "--license", dest="license_", default="", help="license type: enterprise or opensource") parser.add_argument("-b", "--build_number", dest="build_number", default="", help="Unique build number identifier") parser.add_argument("-s", "--server", dest="server", default="", help="Upload server e.g. <user>@<host>") parser.add_argument("--override_server_path_http", dest="override_server_path_http", help="In case we already have local downloaded modules or we want to use a different source it can be overwritten here.") diff --git a/packaging-tools/release_repo_updater.py b/packaging-tools/release_repo_updater.py index 748bfa434..44045b6eb 100755 --- a/packaging-tools/release_repo_updater.py +++ b/packaging-tools/release_repo_updater.py @@ -121,9 +121,9 @@ class event_register(): class QtRepositoryLayout: - def __init__(self, root_path: str, license: str, repo_domain: str) -> None: + def __init__(self, root_path: str, license_: str, repo_domain: str) -> None: self.root_path = root_path - self.license = license + self.license_ = license_ self.repo_domain = repo_domain self.pending = "pending" self.staging = "staging" @@ -131,8 +131,8 @@ class QtRepositoryLayout: # <root_path>/<license>/<pending|staging|production>/<repo_domain>/ # /data/online_repositories/opensource/pending|staging|production/qtsdkrepository/ log.info("self.root_path %s", self.root_path) - log.info("self.license %s", self.license) - self.base_repo_path = os.path.join(self.root_path, self.license) + log.info("self.license_ %s", self.license_) + self.base_repo_path = os.path.join(self.root_path, self.license_) def get_base_repo_path(self) -> str: return self.base_repo_path @@ -244,18 +244,18 @@ def trigger_rta(rtaServerUrl: str, task: ReleaseTask) -> None: # let it proceed -def _remote_path_exists(server: str, remotePath: str, type: str) -> bool: - cmd = get_remote_login_cmd(server) + ['test', type, remotePath, '&& echo OK || echo NOK'] +def _remote_path_exists(server: str, remotePath: str, test_arg: str) -> bool: + cmd = get_remote_login_cmd(server) + ['test', test_arg, remotePath, '&& echo OK || echo NOK'] output = subprocess.check_output(' '.join(cmd), shell=True, timeout=60 * 2).decode("utf-8") return output.strip() == "OK" def remote_path_exists(server: str, remotePath: str) -> bool: - return _remote_path_exists(server, remotePath, type="-d") + return _remote_path_exists(server, remotePath, test_arg="-d") def remote_file_exists(server: str, remotePath: str) -> bool: - return _remote_path_exists(server, remotePath, type="-f") + return _remote_path_exists(server, remotePath, test_arg="-f") async def ensure_ext_repo_paths(server: str, ext: str, repo: str) -> None: @@ -327,8 +327,8 @@ def create_remote_repository_backup(server: str, remote_repo_path: str) -> str: def sync_production_repositories_to_s3(server: str, s3: str, updatedProductionRepositories: Dict[str, str], - remoteRootPath: str, license: str) -> None: - remoteLogsBasePath = os.path.join(remoteRootPath, license, "s3_sync_logs") + remoteRootPath: str, license_: str) -> None: + remoteLogsBasePath = os.path.join(remoteRootPath, license_, "s3_sync_logs") create_remote_paths(server, [remoteLogsBasePath]) for repo, remoteProductionRepoFullPath in updatedProductionRepositories.items(): @@ -361,8 +361,8 @@ def sync_production_xml_to_s3(server: str, serverHome: str, productionRepoPath: async def sync_production_repositories_to_ext(server: str, ext: str, updatedProductionRepositories: Dict[str, str], - remoteRootPath: str, license: str) -> None: - remoteLogsBasePath = os.path.join(remoteRootPath, license, "ext_sync_logs") + remoteRootPath: str, license_: str) -> None: + remoteLogsBasePath = os.path.join(remoteRootPath, license_, "ext_sync_logs") create_remote_paths(server, [remoteLogsBasePath]) extServer, extBasePath = parse_ext(ext) @@ -418,7 +418,7 @@ async def update_repository(stagingServer: str, repoLayout: QtRepositoryLayout, trigger_rta(rta, task) -async def build_online_repositories(tasks: List[ReleaseTask], license: str, installerConfigBaseDir: str, artifactShareBaseUrl: str, +async def build_online_repositories(tasks: List[ReleaseTask], license_: str, installerConfigBaseDir: str, artifactShareBaseUrl: str, ifwTools: str, buildRepositories: bool) -> List[str]: log.info("Building online repositories: %i", len(tasks)) # create base tmp dir @@ -427,7 +427,7 @@ async def build_online_repositories(tasks: List[ReleaseTask], license: str, inst shutil.rmtree(tmpBaseDir, ignore_errors=True) os.makedirs(tmpBaseDir, exist_ok=True) - assert license, "The 'license' must be defined!" + assert license_, "The 'license_' must be defined!" assert artifactShareBaseUrl, "The 'artifactShareBaseUrl' must be defined!" assert ifwTools, "The 'ifwTools' must be defined!" # locate the repo build script @@ -449,7 +449,7 @@ async def build_online_repositories(tasks: List[ReleaseTask], license: str, inst raise PackagingError(f"Invalid 'config_file' path: {installerConfigFile}") cmd = [sys.executable, scriptPath, "-c", installerConfigBaseDir, "-f", installerConfigFile] - cmd += ["--create-repo", "-l", license, "-u", artifactShareBaseUrl, "--ifw-tools", ifwTools] + cmd += ["--create-repo", "-l", license_, "-u", artifactShareBaseUrl, "--ifw-tools", ifwTools] cmd += ["--force-version-number-increase"] for substitution in task.get_installer_string_replacement_list(): cmd += ["--add-substitution=" + substitution] @@ -484,7 +484,7 @@ async def update_repositories(tasks: List[ReleaseTask], stagingServer: str, stag async def sync_production(tasks: List[ReleaseTask], repoLayout: QtRepositoryLayout, syncS3: str, syncExt: str, - stagingServer: str, stagingServerRoot: str, license: str, event_injector: str, + stagingServer: str, stagingServerRoot: str, license_: str, event_injector: str, export_data: Dict[str, str]) -> None: log.info("triggering production sync..") # collect production sync jobs @@ -497,17 +497,17 @@ async def sync_production(tasks: List[ReleaseTask], repoLayout: QtRepositoryLayo # if _all_ repository updates to production were successful then we can sync to production if syncS3: - async with event_register(f"{license}: repo sync s3", event_injector, export_data): + async with event_register(f"{license_}: repo sync s3", event_injector, export_data): sync_production_repositories_to_s3(stagingServer, syncS3, updatedProductionRepositories, - stagingServerRoot, license) + stagingServerRoot, license_) if syncExt: - async with event_register(f"{license}: repo sync ext", event_injector, export_data): + async with event_register(f"{license_}: repo sync ext", event_injector, export_data): await sync_production_repositories_to_ext(stagingServer, syncExt, updatedProductionRepositories, - stagingServerRoot, license) + stagingServerRoot, license_) log.info("Production sync trigger done!") -async def handle_update(stagingServer: str, stagingServerRoot: str, license: str, tasks: List[ReleaseTask], +async def handle_update(stagingServer: str, stagingServerRoot: str, license_: str, tasks: List[ReleaseTask], repoDomain: str, installerConfigBaseDir: str, artifactShareBaseUrl: str, updateStaging: bool, updateProduction: bool, syncS3: str, syncExt: str, rta: str, ifwTools: str, buildRepositories: bool, updateRepositories: bool, syncRepositories: bool, @@ -515,18 +515,18 @@ async def handle_update(stagingServer: str, stagingServerRoot: str, license: str """Build all online repositories, update those to staging area and sync to production.""" log.info("Starting repository update for %i tasks..", len(tasks)) # get repository layout - repoLayout = QtRepositoryLayout(stagingServerRoot, license, repoDomain) + repoLayout = QtRepositoryLayout(stagingServerRoot, license_, repoDomain) # this may take a while depending on how big the repositories are - async with event_register(f"{license}: repo build", event_injector, export_data): - ret = await build_online_repositories(tasks, license, installerConfigBaseDir, artifactShareBaseUrl, ifwTools, + async with event_register(f"{license_}: repo build", event_injector, export_data): + ret = await build_online_repositories(tasks, license_, installerConfigBaseDir, artifactShareBaseUrl, ifwTools, buildRepositories) if updateRepositories: - async with event_register(f"{license}: repo update", event_injector, export_data): + async with event_register(f"{license_}: repo update", event_injector, export_data): await update_repositories(tasks, stagingServer, stagingServerRoot, repoLayout, updateStaging, updateProduction, rta, ifwTools) if syncRepositories: - await sync_production(tasks, repoLayout, syncS3, syncExt, stagingServer, stagingServerRoot, license, + await sync_production(tasks, repoLayout, syncS3, syncExt, stagingServer, stagingServerRoot, license_, event_injector, export_data) log.info("Repository updates done!") @@ -592,7 +592,7 @@ def update_remote_latest_available_dir(newInstaller: str, remoteUploadPath: str, def upload_offline_to_remote(installerPath: str, remoteUploadPath: str, stagingServer: str, task: ReleaseTask, - installerBuildId: str, enable_oss_snapshots: bool, license: str) -> None: + installerBuildId: str, enable_oss_snapshots: bool, license_: str) -> None: for file in os.listdir(installerPath): if file.endswith(".app"): continue @@ -605,7 +605,7 @@ def upload_offline_to_remote(installerPath: str, remoteUploadPath: str, stagingS log.info("Uploading offline installer: %s to: %s", installer, remote_destination) exec_cmd(cmd, timeout=60 * 60) # 1h update_remote_latest_available_dir(installer, remote_destination, task, stagingServer, installerBuildId) - if enable_oss_snapshots and license == "opensource": + if enable_oss_snapshots and license_ == "opensource": upload_snapshots_to_remote(stagingServer, remoteUploadPath, task, installerBuildId, file_name_final) @@ -633,21 +633,21 @@ def notarize_dmg(dmgPath, installerBasename) -> None: exec_cmd(cmd, timeout=60 * 60 * 3) -async def build_offline_tasks(stagingServer: str, stagingServerRoot: str, tasks: List[ReleaseTask], license: str, +async def build_offline_tasks(stagingServer: str, stagingServerRoot: str, tasks: List[ReleaseTask], license_: str, installerConfigBaseDir: str, artifactShareBaseUrl: str, ifwTools: str, installerBuildId: str, updateStaging: bool, enable_oss_snapshots: bool, event_injector: str, export_data: Dict[str, str]) -> None: - async with event_register(f"{license}: offline", event_injector, export_data): - await _build_offline_tasks(stagingServer, stagingServerRoot, tasks, license, installerConfigBaseDir, + async with event_register(f"{license_}: offline", event_injector, export_data): + await _build_offline_tasks(stagingServer, stagingServerRoot, tasks, license_, installerConfigBaseDir, artifactShareBaseUrl, ifwTools, installerBuildId, updateStaging, enable_oss_snapshots) -async def _build_offline_tasks(stagingServer: str, stagingServerRoot: str, tasks: List[ReleaseTask], license: str, +async def _build_offline_tasks(stagingServer: str, stagingServerRoot: str, tasks: List[ReleaseTask], license_: str, installerConfigBaseDir: str, artifactShareBaseUrl: str, ifwTools: str, installerBuildId: str, updateStaging: bool, enable_oss_snapshots: bool) -> None: log.info("Offline installer task(s): %i", len(tasks)) - assert license, "The 'license' must be defined!" + assert license_, "The 'license_' must be defined!" assert artifactShareBaseUrl, "The 'artifactShareBaseUrl' must be defined!" assert ifwTools, "The 'ifwTools' must be defined!" @@ -663,7 +663,7 @@ async def _build_offline_tasks(stagingServer: str, stagingServerRoot: str, tasks raise PackagingError(f"Invalid 'config_file' path: {installerConfigFile}") cmd = [sys.executable, scriptPath, "-c", installerConfigBaseDir, "-f", installerConfigFile] - cmd += ["--offline", "-l", license, "-u", artifactShareBaseUrl, "--ifw-tools", ifwTools] + cmd += ["--offline", "-l", license_, "-u", artifactShareBaseUrl, "--ifw-tools", ifwTools] cmd += ["--preferred-installer-name", task.get_installer_name()] cmd += ["--force-version-number-increase"] cmd.extend(["--add-substitution=" + s for s in task.get_installer_string_replacement_list()]) @@ -676,7 +676,7 @@ async def _build_offline_tasks(stagingServer: str, stagingServerRoot: str, tasks sign_offline_installer(installer_output_dir, task.get_installer_name()) if updateStaging: remote_upload_path = create_offline_remote_dirs(task, stagingServer, stagingServerRoot, installerBuildId) - upload_offline_to_remote(installer_output_dir, remote_upload_path, stagingServer, task, installerBuildId, enable_oss_snapshots, license) + upload_offline_to_remote(installer_output_dir, remote_upload_path, stagingServer, task, installerBuildId, enable_oss_snapshots, license_) def upload_snapshots_to_remote(staging_server: str, remote_upload_path: str, task: ReleaseTask, installer_build_id: str, installer_filename: str): @@ -779,7 +779,7 @@ def main() -> None: parser.add_argument("--artifacts-share-url", dest="artifact_share_url", type=str, default=os.getenv("ARTIFACTS_SHARE_URL"), help="Root URL for artifacts") - parser.add_argument("--license", dest="license", type=str, choices=["enterprise", "opensource"], default=os.getenv("LICENSE"), + parser.add_argument("--license", dest="license_", type=str, choices=["enterprise", "opensource"], default=os.getenv("LICENSE"), help="enterprise/opensource") parser.add_argument("--repo-domain", dest="repo_domain", type=str, choices=["qtsdkrepository", "marketplace"], help="qtsdkrepository/marketplace") @@ -817,7 +817,7 @@ def main() -> None: assert args.config, "'--config' was not given!" assert args.staging_server_root, "'--staging-server-root' was not given!" - if args.license == "opensource": + if args.license_ == "opensource": assert not args.sync_s3, "The '--sync-s3' is not supported for 'opensource' license!" # user explicitly disabled rta triggers @@ -836,7 +836,7 @@ def main() -> None: if args.build_offline: # get offline tasks tasks = parse_config(args.config, task_filters=append_to_task_filters(args.task_filters, "offline")) - loop.run_until_complete(build_offline_tasks(args.staging_server, args.staging_server_root, tasks, args.license, + loop.run_until_complete(build_offline_tasks(args.staging_server, args.staging_server_root, tasks, args.license_, installerConfigBaseDir, args.artifact_share_url, args.ifw_tools, args.offline_installer_id, args.update_staging, args.enable_oss_snapshots, args.event_injector, export_data)) @@ -844,7 +844,7 @@ def main() -> None: else: # this is either repository build or repository sync build # get repository tasks tasks = parse_config(args.config, task_filters=append_to_task_filters(args.task_filters, "repository")) - ret = loop.run_until_complete(handle_update(args.staging_server, args.staging_server_root, args.license, tasks, + ret = loop.run_until_complete(handle_update(args.staging_server, args.staging_server_root, args.license_, tasks, args.repo_domain, installerConfigBaseDir, args.artifact_share_url, args.update_staging, args.update_production, args.sync_s3, args.sync_ext, args.rta, args.ifw_tools, diff --git a/packaging-tools/tests/test_bldinstallercommon.py b/packaging-tools/tests/test_bldinstallercommon.py index 32f1a6b2d..51136782b 100644 --- a/packaging-tools/tests/test_bldinstallercommon.py +++ b/packaging-tools/tests/test_bldinstallercommon.py @@ -72,9 +72,9 @@ class TestCommon(unittest.TestCase): ), ("%foo\nbar%foo", [("%foobar%", "foobar"), ("%foo%", "")], "%foo\nbar%foo"), ) - def test_replace_in_files(self, data): + def test_replace_in_files(self, test_data): # unpack data - file_contents, replacements, expected_file_content = data + file_contents, replacements, expected_file_content = test_data with TemporaryDirectory(dir=os.getcwd()) as tmp_base_dir: # run tag substitution with data tmp_file = Path(tmp_base_dir) / "test" @@ -135,8 +135,8 @@ class TestCommon(unittest.TestCase): ["file.x"], ), ) - def test_search_for_files(self, data): - file, params, expected_files = data + def test_search_for_files(self, test_data): + file, params, expected_files = test_data with TemporaryDirectory(dir=os.getcwd()) as tmp_base_dir: path, content = file tmp_file = Path(tmp_base_dir) / path @@ -160,8 +160,8 @@ class TestCommon(unittest.TestCase): ((["*.t", "*.y"], [], ['tst.y', '.t', 'tst.t', 'd/tst.t', '.d/.t'])), (([".t", ".d"], [], ['.d', '.t', '.d/.t'])) ) - def test_locate_paths(self, data): - pattern, filters, expected_results = data + def test_locate_paths(self, test_data): + pattern, filters, expected_results = test_data with TemporaryDirectory(dir=os.getcwd()) as tmp_base_dir: # Create files and folders test_folders = ["/tempty", "/d/n", "/.d"] diff --git a/packaging-tools/tests/test_create_installer.py b/packaging-tools/tests/test_create_installer.py index ee5fc5c11..3bb4f53cc 100644 --- a/packaging-tools/tests/test_create_installer.py +++ b/packaging-tools/tests/test_create_installer.py @@ -55,18 +55,18 @@ class TestCommon(unittest.TestCase): ] if is_windows() else ["foodebugbar"] )) @unittest.skipIf(not(is_windows() or is_macos()), "This test is only for Windows and macOS") - def test_remove_all_debug_libraries_win(self, data): - dirs, files, remaining_files = data + def test_remove_all_debug_libraries_win(self, test_data): + dirs, files, remaining_files = test_data with TemporaryDirectory(dir=os.getcwd()) as tmpdir: - for dir in dirs: - Path(tmpdir + dir).mkdir() + for directory in dirs: + Path(tmpdir + directory).mkdir() for file in files: - Path(tmpdir + dir + file).touch() + Path(tmpdir + directory + file).touch() remove_all_debug_libraries(tmpdir) - for dir in dirs: - result_paths = locate_paths(tmpdir + dir, ["*"], [os.path.isfile]) - result_rel = [str(Path(p).relative_to(tmpdir + dir)) for p in result_paths] - if dir == "/unrelated/": + for directory in dirs: + result_paths = locate_paths(tmpdir + directory, ["*"], [os.path.isfile]) + result_rel = [str(Path(p).relative_to(tmpdir + directory)) for p in result_paths] + if directory == "/unrelated/": self.assertCountEqual(result_rel, files) else: self.assertCountEqual(result_rel, remaining_files) diff --git a/packaging-tools/tests/test_release_repo_updater.py b/packaging-tools/tests/test_release_repo_updater.py index d92a19dd5..4ddd0ec8f 100755 --- a/packaging-tools/tests/test_release_repo_updater.py +++ b/packaging-tools/tests/test_release_repo_updater.py @@ -200,7 +200,7 @@ class TestReleaseRepoUpdater(unittest.TestCase): # parse all tasks i.e. no filters tasks = parse_data(config, task_filters=[]) - await build_online_repositories(tasks=tasks, license="opensource", installerConfigBaseDir="foo", artifactShareBaseUrl="foo", + await build_online_repositories(tasks=tasks, license_="opensource", installerConfigBaseDir="foo", artifactShareBaseUrl="foo", ifwTools="foo", buildRepositories=False) task = tasks.pop() self.assertTrue(task.source_online_repository_path.endswith("foo/bar/path_1/online_repository")) diff --git a/packaging-tools/tests/test_runner.py b/packaging-tools/tests/test_runner.py index 6aa7269ba..3144261c6 100755 --- a/packaging-tools/tests/test_runner.py +++ b/packaging-tools/tests/test_runner.py @@ -29,10 +29,10 @@ # ############################################################################# +import asyncio import os import sys import unittest -from asyncio import TimeoutError from pathlib import Path from tempfile import TemporaryDirectory @@ -52,7 +52,7 @@ class TestRunner(unittest.TestCase): await async_exec_cmd(['echo', "TEST"]) cmd = ['sleep', '2'] - with self.assertRaises(TimeoutError): + with self.assertRaises(asyncio.TimeoutError): await async_exec_cmd(cmd, timeout=1) @unittest.skipIf(is_windows(), "Windows not supported for this test yet") @@ -62,16 +62,16 @@ class TestRunner(unittest.TestCase): self.assertEqual(output, "TEST") cmd = ['sleep', '2'] - with self.assertRaises(TimeoutError): + with self.assertRaises(asyncio.TimeoutError): await async_exec_cmd(cmd, timeout=1) @data( (["echo", "TEST"], "TEST", True), (["echo", "TEST"], '', False), ) - def test_do_execute_sub_process_get_output(self, data): + def test_do_execute_sub_process_get_output(self, test_data): # Test get_output - args, expected_output, get_output = data + args, expected_output, get_output = test_data _, output = do_execute_sub_process(args, os.getcwd(), get_output=get_output) self.assertEqual(output.strip(), expected_output) @@ -81,9 +81,9 @@ class TestRunner(unittest.TestCase): (None, TypeError), (1234, TypeError) ) - def test_do_execute_sub_process_invalid_args(self, data): + def test_do_execute_sub_process_invalid_args(self, test_data): # Test with invalid args - test_args, expected_exception = data + test_args, expected_exception = test_data with self.assertRaises(expected_exception): do_execute_sub_process(test_args, os.getcwd()) @@ -118,10 +118,10 @@ class TestRunner(unittest.TestCase): ({"EXTRA": "ENV"}, "ENV"), ({}, "%EXTRA%" if is_windows() else ""), ) - def test_do_execute_sub_process_extra_env(self, data): + def test_do_execute_sub_process_extra_env(self, test_data): args = ["echo", "%EXTRA%"] if is_windows() else ["printenv", "EXTRA"] # Test extra_env - extra_env, expected_value = data + extra_env, expected_value = test_data _, output = do_execute_sub_process(args, os.getcwd(), False, True, extra_env) self.assertEqual(output.strip(), expected_value) |