From e8d9f33f350206aec044dc7189911c9745134293 Mon Sep 17 00:00:00 2001 From: Matt Craddock <5796417+craddm@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:03:00 +0100 Subject: [PATCH 1/2] Add archive.rds and expand package path to allow archived versions --- nexus_allowlist/actions.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/nexus_allowlist/actions.py b/nexus_allowlist/actions.py index c33296d..7a514ec 100644 --- a/nexus_allowlist/actions.py +++ b/nexus_allowlist/actions.py @@ -173,6 +173,18 @@ def recreate_privileges( ) cran_privilege_names.append(privilege_name) + # Content selector and privilege for CRAN 'archive.rds' file which contains an + # metadata for all archived packages + privilege_name = create_content_selector_and_privilege( + nexus_api, + name="archive", + description="Allow access to 'archive.rds' file in CRAN repository", + expression='format == "r" and path=="/src/contrib/Meta/archive.rds"', + repo_type=_NEXUS_REPOSITORIES["cran_proxy"].repo_type, + repo=_NEXUS_REPOSITORIES["cran_proxy"].name, + ) + cran_privilege_names.append(privilege_name) + # Create content selectors and privileges for packages according to the # package setting if packages == "all": @@ -216,7 +228,7 @@ def recreate_privileges( nexus_api, name=f"cran-{package}", description=f"allow access to {package} on CRAN", - expression=f'format == "r" and path=^"/src/contrib/{package}_"', + expression=f'format == "r" and (path=^"/src/contrib/{package}_" or path=^"/src/contrib/Archive/{package}/{package}_")', repo_type=_NEXUS_REPOSITORIES["cran_proxy"].repo_type, repo=_NEXUS_REPOSITORIES["cran_proxy"].name, ) From 4f8f6bb8bc7ea88a6b581e14a4795887f1e94892 Mon Sep 17 00:00:00 2001 From: Jim Madge Date: Fri, 9 Aug 2024 10:52:52 +0100 Subject: [PATCH 2/2] Fix linting --- nexus_allowlist/actions.py | 6 +++++- pyproject.toml | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/nexus_allowlist/actions.py b/nexus_allowlist/actions.py index 7a514ec..40cd349 100644 --- a/nexus_allowlist/actions.py +++ b/nexus_allowlist/actions.py @@ -228,7 +228,11 @@ def recreate_privileges( nexus_api, name=f"cran-{package}", description=f"allow access to {package} on CRAN", - expression=f'format == "r" and (path=^"/src/contrib/{package}_" or path=^"/src/contrib/Archive/{package}/{package}_")', + expression=( + 'format == "r" ' + f'and (path=^"/src/contrib/{package}_" ' + f'or path=^"/src/contrib/Archive/{package}/{package}_")' + ), repo_type=_NEXUS_REPOSITORIES["cran_proxy"].repo_type, repo=_NEXUS_REPOSITORIES["cran_proxy"].name, ) diff --git a/pyproject.toml b/pyproject.toml index be89b9e..727a22e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,7 @@ all = [ [tool.black] target-version = ["py310", "py311"] -[tool.ruff] +[tool.ruff.lint] select = [ "A", "ARG", @@ -91,12 +91,12 @@ unfixable = [ "F401", ] -[tool.ruff.isort] +[tool.ruff.lint.isort] known-first-party = ["nexus_allowlist"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "all" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"]