This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git
The following commit(s) were added to refs/heads/main by this push:
new 133e577 Move some metadata to the registry module
133e577 is described below
commit 133e577e9d0161d515af49e12a776db020418424
Author: Sean B. Palmer <[email protected]>
AuthorDate: Thu Sep 11 18:48:02 2025 +0100
Move some metadata to the registry module
---
atr/registry.py | 6 +++++-
atr/routes/projects.py | 10 +++-------
atr/storage/writers/project.py | 10 +++-------
atr/storage/writers/sbom.py | 1 -
4 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/atr/registry.py b/atr/registry.py
index 11fde0d..cffb6f7 100644
--- a/atr/registry.py
+++ b/atr/registry.py
@@ -17,7 +17,11 @@
from typing import Final
-# TODO: The metadata in this module should be moved to the Catalogue Server
+# TODO: Most of the metadata in this module should be moved to the Catalogue
Server
+
+FORBIDDEN_PROJECT_CATEGORIES: Final[set[str]] = {
+ "retired",
+}
# Committees which are allowed by Infra to make releases via GitHub Actions
# TODO: This should actually be at the project level, not committee level
diff --git a/atr/routes/projects.py b/atr/routes/projects.py
index 14b4879..7f9253a 100644
--- a/atr/routes/projects.py
+++ b/atr/routes/projects.py
@@ -22,7 +22,7 @@ from __future__ import annotations
import datetime
import http.client
import re
-from typing import TYPE_CHECKING, Any, Final
+from typing import TYPE_CHECKING, Any
import asfquart.base as base
import quart
@@ -33,6 +33,7 @@ import atr.forms as forms
import atr.log as log
import atr.models.policy as policy
import atr.models.sql as sql
+import atr.registry as registry
import atr.routes as routes
import atr.storage as storage
import atr.template as template
@@ -42,11 +43,6 @@ import atr.util as util
if TYPE_CHECKING:
import werkzeug.wrappers.response as response
-# TODO: Duplicates atr.storage.writers.project._FORBIDDEN_CATEGORIES
-_FORBIDDEN_CATEGORIES: Final[set[str]] = {
- "retired",
-}
-
class AddForm(forms.Typed):
committee_name = forms.hidden()
@@ -372,7 +368,7 @@ async def view(session: routes.CommitterSession, name: str)
-> response.Response
policy_form=policy_form,
can_edit=can_edit,
metadata_form=metadata_form,
- forbidden_categories=_FORBIDDEN_CATEGORIES,
+ forbidden_categories=registry.FORBIDDEN_PROJECT_CATEGORIES,
)
diff --git a/atr/storage/writers/project.py b/atr/storage/writers/project.py
index 5a557f3..c149d54 100644
--- a/atr/storage/writers/project.py
+++ b/atr/storage/writers/project.py
@@ -19,17 +19,13 @@
from __future__ import annotations
import datetime
-from typing import Final
import atr.db as db
import atr.models.sql as sql
+import atr.registry as registry
import atr.storage as storage
import atr.util as util
-_FORBIDDEN_CATEGORIES: Final[set[str]] = {
- "retired",
-}
-
class GeneralPublic:
def __init__(
@@ -100,7 +96,7 @@ class CommitteeMember(CommitteeParticipant):
if new_category and (new_category not in current_categories):
if ":" in new_category:
raise ValueError(f"Category '{new_category}' contains a colon")
- if new_category in _FORBIDDEN_CATEGORIES:
+ if new_category in registry.FORBIDDEN_PROJECT_CATEGORIES:
raise ValueError(f"Category '{new_category}' may not be added
or removed")
current_categories.append(new_category)
current_categories.sort()
@@ -115,7 +111,7 @@ class CommitteeMember(CommitteeParticipant):
project = await self.__data.merge(project)
current_categories = self.__current_categories(project)
if action_value in current_categories:
- if action_value in _FORBIDDEN_CATEGORIES:
+ if action_value in registry.FORBIDDEN_PROJECT_CATEGORIES:
raise ValueError(f"Category '{action_value}' may not be added
or removed")
current_categories.remove(action_value)
project.category = ", ".join(current_categories)
diff --git a/atr/storage/writers/sbom.py b/atr/storage/writers/sbom.py
index 8dfa97b..951e05c 100644
--- a/atr/storage/writers/sbom.py
+++ b/atr/storage/writers/sbom.py
@@ -112,7 +112,6 @@ class CommitteeParticipant(FoundationCommitter):
sbom_path_in_new_revision: pathlib.Path,
) -> sql.Task:
# Create and queue the task, using paths within the new revision
- # TODO: Move this to the storage interface
# We still need release.name for the task metadata
sbom_task = sql.Task(
task_type=sql.TaskType.SBOM_GENERATE_CYCLONEDX,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]