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 42b9701 Document more code to move to the storage interface
42b9701 is described below
commit 42b970161f6ddb91162f22c4db7a26245e2c5eb0
Author: Sean B. Palmer <[email protected]>
AuthorDate: Thu Sep 11 19:50:14 2025 +0100
Document more code to move to the storage interface
---
atr/routes/draft.py | 2 ++
atr/routes/finish.py | 7 +++++++
2 files changed, 9 insertions(+)
diff --git a/atr/routes/draft.py b/atr/routes/draft.py
index 7b9ce45..4713830 100644
--- a/atr/routes/draft.py
+++ b/atr/routes/draft.py
@@ -153,10 +153,12 @@ async def delete_file(session: routes.CommitterSession,
project_name: str, versi
# Construct full path within the new revision
metadata_path_obj = creating.interim_path / p
if p.name.startswith(rel_path_to_delete.name + "."):
+ # TODO: Move to the storage interface
await aiofiles.os.remove(metadata_path_obj)
metadata_files_deleted += 1
# Delete the file
+ # TODO: Move to the storage interface
await aiofiles.os.remove(path_in_new_revision)
except Exception as e:
diff --git a/atr/routes/finish.py b/atr/routes/finish.py
index 2b8bf3a..365815b 100644
--- a/atr/routes/finish.py
+++ b/atr/routes/finish.py
@@ -274,6 +274,7 @@ async def _delete_empty_directory(
raise revision.FailedError(f"Path '{dir_to_delete_rel}' is not
a directory.")
if await aiofiles.os.listdir(path_to_remove):
raise revision.FailedError(f"Directory '{dir_to_delete_rel}'
is not empty.")
+ # TODO: Move to the storage interface
await aiofiles.os.rmdir(path_to_remove)
except Exception:
@@ -410,6 +411,7 @@ async def _remove_rc_tags_revision(
try:
if not await
aiofiles.os.path.exists(full_stripped_path.parent):
# This could happen if e.g. a file is in an RC tagged
directory
+ # TODO: Move to the storage interface
await aiofiles.os.makedirs(full_stripped_path.parent,
exist_ok=True)
if await aiofiles.os.path.exists(full_stripped_path):
@@ -418,6 +420,7 @@ async def _remove_rc_tags_revision(
)
continue
+ # TODO: Move to the storage interface
await aiofiles.os.rename(full_original_path,
full_stripped_path)
renamed_count_local += 1
except Exception as e:
@@ -441,6 +444,7 @@ async def _remove_rc_tags_revision_item(
if not await aiofiles.os.listdir(full_original_path):
# This means we probably moved files out of the RC tagged
directory
# In any case, we can't move it, so we have to delete it
+ # TODO: Move to the storage interface
await aiofiles.os.rmdir(full_original_path)
renamed_count_local += 1
else:
@@ -474,6 +478,7 @@ async def _setup_revision(
raise revision.FailedError("Segments must not contain '..'")
try:
+ # TODO: Move to the storage interface
await aiofiles.os.makedirs(target_path)
except OSError:
raise revision.FailedError("Failed to create target directory")
@@ -510,6 +515,7 @@ async def _setup_revision_item(
if await aiofiles.os.path.exists(final_target_for_item):
raise revision.FailedError("Target name already exists")
+ # TODO: Move to the storage interface
await aiofiles.os.rename(full_source_item_path, final_target_for_item)
moved_files_names.append(source_file_rel.name)
else:
@@ -524,6 +530,7 @@ async def _setup_revision_item(
raise revision.FailedError("A related file already exists in the
target directory")
for f in bundle:
+ # TODO: Move to the storage interface
await aiofiles.os.rename(creating.interim_path / f, target_path /
f.name)
if f == source_file_rel:
moved_files_names.append(f.name)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]