diff --git a/.ci/scripts/check_release.py b/.ci/scripts/check_release.py index 611c882ca..6e0799952 100755 --- a/.ci/scripts/check_release.py +++ b/.ci/scripts/check_release.py @@ -99,9 +99,9 @@ def main(options: argparse.Namespace, template_config: dict[str, t.Any]) -> int: # Warning: This will not work if branch names contain "/" but we don't really care here. heads = [h.split("/")[-1] for h in repo.git.branch("--remote").split("\n")] - available_branches = [h for h in heads if re.fullmatch(RELEASE_BRANCH_REGEX, h)] - available_branches.sort(key=lambda ver: Version(ver)) - available_branches.append(DEFAULT_BRANCH) + available_branches = sorted( + {h for h in heads if re.fullmatch(RELEASE_BRANCH_REGEX, h)}, key=lambda ver: Version(ver) + ) + [DEFAULT_BRANCH] branches = options.branches if branches == "supported": diff --git a/.ci/scripts/check_requirements.py b/.ci/scripts/check_requirements.py index 0edfaccc0..a19d579af 100755 --- a/.ci/scripts/check_requirements.py +++ b/.ci/scripts/check_requirements.py @@ -9,7 +9,6 @@ import warnings from packaging.requirements import Requirement - CHECK_MATRIX = [ ("pyproject.toml", True, True, True), ("requirements.txt", True, True, True), diff --git a/.ci/scripts/collect_changes.py b/.ci/scripts/collect_changes.py index f79d9a47c..0684e1c05 100755 --- a/.ci/scripts/collect_changes.py +++ b/.ci/scripts/collect_changes.py @@ -25,7 +25,6 @@ from git import GitCommandError, Repo from packaging.version import parse as parse_version - PYPI_PROJECT = "pulp_rpm" # Read Towncrier settings diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5d928af7d..0a7490ae5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: pulpcore-manager openapi --file "api.json" pulpcore-manager openapi --bindings --component "rpm" --file "rpm-api.json" - name: "Upload Package whl" - uses: "actions/upload-artifact@v5" + uses: "actions/upload-artifact@v7" with: name: "plugin_package" path: "pulp_rpm/dist/" @@ -54,7 +54,7 @@ jobs: retention-days: 5 overwrite: true - name: "Upload API specs" - uses: "actions/upload-artifact@v5" + uses: "actions/upload-artifact@v7" with: name: "api_spec" path: | @@ -73,7 +73,7 @@ jobs: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}" - name: "Upload python client packages" - uses: "actions/upload-artifact@v5" + uses: "actions/upload-artifact@v7" with: name: "python-client.tar" path: | @@ -82,7 +82,7 @@ jobs: retention-days: 5 overwrite: true - name: "Upload python client docs" - uses: "actions/upload-artifact@v5" + uses: "actions/upload-artifact@v7" with: name: "python-client-docs.tar" path: | @@ -100,7 +100,7 @@ jobs: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}" - name: "Upload Ruby client" - uses: "actions/upload-artifact@v5" + uses: "actions/upload-artifact@v7" with: name: "ruby-client.tar" path: | diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4faf21fde..fe19c3935 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -30,7 +30,7 @@ jobs: id-token: "write" steps: - - uses: "actions/download-artifact@v4" + - uses: "actions/download-artifact@v8" with: name: "plugin_package" path: "dist/" @@ -53,7 +53,7 @@ jobs: path: "pulp_rpm" - name: "Download Python client" - uses: "actions/download-artifact@v4" + uses: "actions/download-artifact@v8" with: name: "python-client.tar" path: "pulp_rpm/" @@ -82,7 +82,7 @@ jobs: path: "pulp_rpm" - name: "Download Ruby client" - uses: "actions/download-artifact@v4" + uses: "actions/download-artifact@v8" with: name: "ruby-client.tar" path: "pulp_rpm/" diff --git a/.github/workflows/scripts/stage-changelog-for-default-branch.py b/.github/workflows/scripts/stage-changelog-for-default-branch.py index b1fccd77f..c94a0ca07 100755 --- a/.github/workflows/scripts/stage-changelog-for-default-branch.py +++ b/.github/workflows/scripts/stage-changelog-for-default-branch.py @@ -12,16 +12,13 @@ from git import Repo from git.exc import GitCommandError - -helper = textwrap.dedent( - """\ +helper = textwrap.dedent("""\ Stage the changelog for a release on main branch. Example: $ python .github/workflows/scripts/stage-changelog-for-default-branch.py 3.4.0 - """ -) + """) parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=helper) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 54cd63be4..dadefefb4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -126,7 +126,7 @@ jobs: docker logs pulp 2>&1 | grep -i pulpcore.deprecation | tee deprecations-${{ matrix.env.TEST }}.txt - name: "Upload Deprecations" - uses: "actions/upload-artifact@v5" + uses: "actions/upload-artifact@v7" with: name: "deprecations-${{ matrix.env.TEST }}" path: "pulp_rpm/deprecations-${{ matrix.env.TEST }}.txt" diff --git a/lint_requirements.txt b/lint_requirements.txt index 6f8f0086b..bd37551cf 100644 --- a/lint_requirements.txt +++ b/lint_requirements.txt @@ -5,7 +5,7 @@ # # For more info visit https://github.com/pulp/plugin_template -black==24.3.0 +black~=26.3 # Pin style to the year. https://black.readthedocs.io/en/stable/faq.html#how-stable-is-black-s-style bump-my-version check-manifest flake8 diff --git a/pulp_rpm/app/depsolving.py b/pulp_rpm/app/depsolving.py index bfab3f23e..fb81d7377 100644 --- a/pulp_rpm/app/depsolving.py +++ b/pulp_rpm/app/depsolving.py @@ -6,7 +6,6 @@ from django.conf import settings - logger = logging.getLogger(__name__) # The name for the repo inside libsolv which represents the combined set of target/destination @@ -577,7 +576,7 @@ def get_units_from_solvables(self, solvables): """Map a list of solvables into their Pulp units, keyed by the repo they came from.""" repo_unit_map = collections.defaultdict(set) for solvable in solvables: - (unit_id, repo_id) = self.get_unit_id(solvable) + unit_id, repo_id = self.get_unit_id(solvable) repo_unit_map[repo_id].add(unit_id) return repo_unit_map @@ -1026,7 +1025,7 @@ def write_solver_debug_data(solver, problems, mapping, full=False): print(file=summary) for solvable in transaction.newsolvables(): - (reason, rule) = solver.describe_decision(solvable) + reason, rule = solver.describe_decision(solvable) print( "{name}-{evr}.{arch}".format( @@ -1035,15 +1034,15 @@ def write_solver_debug_data(solver, problems, mapping, full=False): file=summary, ) - (reason_name, reason_description) = reason_desc_map[reason] - (unit_id, from_repo) = mapping.get_unit_id(solvable) + reason_name, reason_description = reason_desc_map[reason] + unit_id, from_repo = mapping.get_unit_id(solvable) print( " Pulp Content unit '{}' from repo '{}'".format(unit_id, from_repo), file=summary ) print(" Reason: {} - {}".format(reason_name, reason_description), file=summary) print(" Rules:", file=summary) for info in rule.allinfos(): - (rule_name, rule_description) = rule_desc_map[info.type] + rule_name, rule_description = rule_desc_map[info.type] print(" {} - {}".format(rule_name, rule_description), file=summary) if info.solvable: pkg = str(info.solvable) diff --git a/pulp_rpm/app/downloaders.py b/pulp_rpm/app/downloaders.py index 07dfc4dc3..c61ebdded 100644 --- a/pulp_rpm/app/downloaders.py +++ b/pulp_rpm/app/downloaders.py @@ -9,7 +9,6 @@ from pulp_rpm.app.exceptions import UlnCredentialsError from pulp_rpm.app.shared_utils import urlpath_sanitize - log = getLogger(__name__) @@ -79,7 +78,7 @@ def __init__( # So, we have a pretty ugly workaround. parsed = urlparse(self.url) # two pieces of the URL: pre- and post-path - (before_path, after_path) = self.url.split(parsed.path) + before_path, after_path = self.url.split(parsed.path) new_path = quote(unquote(parsed.path), safe=":/") # fix the path new_url = "{}{}{}".format(before_path, new_path, after_path) # rebuild if self.sles_auth_token: diff --git a/pulp_rpm/app/management/commands/rpm-datarepair.py b/pulp_rpm/app/management/commands/rpm-datarepair.py index cf38ab17f..aa47911db 100644 --- a/pulp_rpm/app/management/commands/rpm-datarepair.py +++ b/pulp_rpm/app/management/commands/rpm-datarepair.py @@ -34,7 +34,7 @@ def repair_2460(self): def fix_package(package): def fix_requirement(require): - (name, flags, epoch, version, release, pre) = require + name, flags, epoch, version, release, pre = require if "&" in name: fixed_name = name.replace("&", "&") return (fixed_name, flags, epoch, version, release) diff --git a/pulp_rpm/app/modelresource.py b/pulp_rpm/app/modelresource.py index 9176d7212..f7be20474 100644 --- a/pulp_rpm/app/modelresource.py +++ b/pulp_rpm/app/modelresource.py @@ -499,7 +499,7 @@ def before_import_row(self, row, **kwargs): """ super().before_import_row(row, **kwargs) - (uc_name, uc_updrec_digest) = row["update_collection"].split("|") + uc_name, uc_updrec_digest = row["update_collection"].split("|") uc_updrecord = UpdateRecord.objects.filter( digest=uc_updrec_digest, pulp_domain=get_domain() ).first() diff --git a/pulp_rpm/app/models/acs.py b/pulp_rpm/app/models/acs.py index 0263ee4a4..a293e9db9 100644 --- a/pulp_rpm/app/models/acs.py +++ b/pulp_rpm/app/models/acs.py @@ -3,7 +3,6 @@ from pulpcore.plugin.models import AlternateContentSource, AutoAddObjPermsMixin from pulp_rpm.app.models import RpmRemote - log = getLogger(__name__) diff --git a/pulp_rpm/app/models/modulemd.py b/pulp_rpm/app/models/modulemd.py index abca648f6..59d3086b5 100644 --- a/pulp_rpm/app/models/modulemd.py +++ b/pulp_rpm/app/models/modulemd.py @@ -7,7 +7,6 @@ from pulp_rpm.app.models.package import Package - log = getLogger(__name__) diff --git a/pulp_rpm/app/models/repository.py b/pulp_rpm/app/models/repository.py index bb2d08e20..439b03512 100644 --- a/pulp_rpm/app/models/repository.py +++ b/pulp_rpm/app/models/repository.py @@ -542,13 +542,11 @@ def content_handler(self, path): repo_config = publication.repo_config repo_config.pop("name", None) repo_config.pop("baseurl", None) - val = textwrap.dedent( - f"""\ + val = textwrap.dedent(f"""\ [{re.sub(self.INVALID_REPO_ID_CHARS, "", self.name)}] name={self.name} baseurl={base_url} - """ - ) + """) for k, v in repo_config.items(): val += f"{k}={v}\n" diff --git a/pulp_rpm/app/serializers/package.py b/pulp_rpm/app/serializers/package.py index 07449291b..5431f61b5 100644 --- a/pulp_rpm/app/serializers/package.py +++ b/pulp_rpm/app/serializers/package.py @@ -16,7 +16,6 @@ from pulp_rpm.app.models import Package from pulp_rpm.app.shared_utils import read_crpackage_from_artifact, format_nvra - log = logging.getLogger(__name__) diff --git a/pulp_rpm/app/tasks/copy.py b/pulp_rpm/app/tasks/copy.py index 397981bd0..c0fc75ac7 100644 --- a/pulp_rpm/app/tasks/copy.py +++ b/pulp_rpm/app/tasks/copy.py @@ -51,7 +51,7 @@ def find_children_of_content(content, src_repo_version): package_nevras = advisory.get_pkglist() advisory_package_q = Q(pk__in=[]) for nevra in package_nevras: - (name, epoch, version, release, arch) = nevra + name, epoch, version, release, arch = nevra advisory_package_q |= Q( name=name, epoch=epoch, @@ -65,7 +65,7 @@ def find_children_of_content(content, src_repo_version): module_nsvcas = advisory.get_module_list() advisory_module_q = Q(pk__in=[]) for nsvca in module_nsvcas: - (name, stream, version, context, arch) = nsvca + name, stream, version, context, arch = nsvca advisory_module_q |= Q( name=name, stream=stream, diff --git a/pulp_rpm/app/tasks/publishing.py b/pulp_rpm/app/tasks/publishing.py index 2aee73eef..6a4aa0155 100644 --- a/pulp_rpm/app/tasks/publishing.py +++ b/pulp_rpm/app/tasks/publishing.py @@ -573,7 +573,7 @@ def generate_repo_metadata( pkg = package.to_createrepo_c() # rewrite the checksum and checksum type with the desired ones - (checksum, pkgId) = pkg_to_hash[package.pk] + checksum, pkgId = pkg_to_hash[package.pk] pkg.checksum_type = checksum pkg.pkgId = pkgId diff --git a/pulp_rpm/app/tasks/synchronizing.py b/pulp_rpm/app/tasks/synchronizing.py index 5db24aa61..4d248b3e2 100644 --- a/pulp_rpm/app/tasks/synchronizing.py +++ b/pulp_rpm/app/tasks/synchronizing.py @@ -928,7 +928,7 @@ async def parse_repository_metadata(self, repomd, metadata_results): # can't be flagged as 'modular' thus broken repository! if modulemd_result.url.endswith("zck"): raise TypeError(_("Modular data compressed with ZCK is not supported.")) - (modulemd_dcs, modulemd_list) = await self.parse_modules_metadata(modulemd_result) + modulemd_dcs, modulemd_list = await self.parse_modules_metadata(modulemd_result) # **Now** we can successfully parse package-metadata await self.parse_packages( @@ -1280,7 +1280,7 @@ def verification_and_skip_callback(pkg): for name, versions in packages.items(): versions.sort(key=lambda p: p[0], reverse=True) for pkg in versions[self.repository.retain_package_versions :]: - (evr, nevra) = pkg + evr, nevra = pkg package_skip_nevras.add(nevra) skipped_packages += 1 diff --git a/pulp_rpm/tests/functional/api/test_auto_publish.py b/pulp_rpm/tests/functional/api/test_auto_publish.py index f697dee53..3e2258f44 100644 --- a/pulp_rpm/tests/functional/api/test_auto_publish.py +++ b/pulp_rpm/tests/functional/api/test_auto_publish.py @@ -1,5 +1,6 @@ # coding=utf-8 """Tests that sync rpm plugin repositories.""" + import pytest diff --git a/pulp_rpm/tests/functional/api/test_character_encoding.py b/pulp_rpm/tests/functional/api/test_character_encoding.py index 0e36ff885..a54c5a001 100644 --- a/pulp_rpm/tests/functional/api/test_character_encoding.py +++ b/pulp_rpm/tests/functional/api/test_character_encoding.py @@ -13,7 +13,6 @@ RPM_WITH_NON_UTF_8_URL, ) - """Test upload of RPMs with different character encoding. This test targets the following issues: diff --git a/pulp_rpm/tests/functional/api/test_crud_content_unit.py b/pulp_rpm/tests/functional/api/test_crud_content_unit.py index 2baa93e25..6bc05196a 100644 --- a/pulp_rpm/tests/functional/api/test_crud_content_unit.py +++ b/pulp_rpm/tests/functional/api/test_crud_content_unit.py @@ -148,8 +148,7 @@ def test_create_modulemd_defaults(monitor_task, gen_object_with_cleanup, rpm_mod "module": "squid", "stream": "4", "profiles": '{"4": ["common"]}', - "snippet": dedent( - """\ + "snippet": dedent("""\ --- document: modulemd-defaults version: 1 @@ -158,8 +157,7 @@ def test_create_modulemd_defaults(monitor_task, gen_object_with_cleanup, rpm_mod stream: "4" profiles: 4: [common] - ...""" - ), + ..."""), } # Can create diff --git a/pulp_rpm/tests/functional/api/test_publish.py b/pulp_rpm/tests/functional/api/test_publish.py index d4b23a129..a5ead4a62 100644 --- a/pulp_rpm/tests/functional/api/test_publish.py +++ b/pulp_rpm/tests/functional/api/test_publish.py @@ -473,7 +473,7 @@ def test_distribution_tree_metadata_publish( # skip any differences that are "correct" i.e. rewritten "repository" and "packages" paths for d in diff: - (diff_type, diff_name, _, new_value) = (d[0], d[1], d[2][0], d[2][1]) + diff_type, diff_name, _, new_value = (d[0], d[1], d[2][0], d[2][1]) # ('change', 'variant-Land.packages', ('Packages', 'Land/Packages')) if diff_type == "change": if diff_name.endswith(".packages") or diff_name.endswith(".repository"): diff --git a/pulp_rpm/tests/functional/utils.py b/pulp_rpm/tests/functional/utils.py index 41823b874..0ac7d8dab 100644 --- a/pulp_rpm/tests/functional/utils.py +++ b/pulp_rpm/tests/functional/utils.py @@ -25,7 +25,6 @@ from pulpcore.client.pulpcore import ApiClient as CoreApiClient, TasksApi from pulpcore.client.pulp_rpm import ApiClient as RpmApiClient - cfg = config.get_config() configuration = cfg.get_bindings_config()