Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update purge_archive.py #226

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build_tools/purge_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import stat
from datetime import datetime, timedelta

max_build_age_in_days = 30
minimum_number_of_builds_to_keep = 10
max_build_age_in_days = 7
minimum_number_of_builds_to_keep = 5
build_area = r"\\isis.cclrc.ac.uk\inst$\kits$\CompGroup\ICP"


def winapi_path(dos_path):

Check failure on line 12 in build_tools/purge_archive.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN201)

build_tools/purge_archive.py:12:5: ANN201 Missing return type annotation for public function `winapi_path`

Check failure on line 12 in build_tools/purge_archive.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN001)

build_tools/purge_archive.py:12:17: ANN001 Missing type annotation for function argument `dos_path`
path = os.path.abspath(dos_path)
long_path_identifier = "\\\\?\\"
if path.startswith(long_path_identifier):
Expand All @@ -21,7 +21,7 @@
return win_path


def rmtree_error(func, path, exc_info):

Check failure on line 24 in build_tools/purge_archive.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN201)

build_tools/purge_archive.py:24:5: ANN201 Missing return type annotation for public function `rmtree_error`

Check failure on line 24 in build_tools/purge_archive.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN001)

build_tools/purge_archive.py:24:18: ANN001 Missing type annotation for function argument `func`

Check failure on line 24 in build_tools/purge_archive.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN001)

build_tools/purge_archive.py:24:24: ANN001 Missing type annotation for function argument `path`

Check failure on line 24 in build_tools/purge_archive.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN001)

build_tools/purge_archive.py:24:30: ANN001 Missing type annotation for function argument `exc_info`
try:
if not os.access(path, os.W_OK):
os.chmod(path, stat.S_IWUSR)
Expand All @@ -30,7 +30,7 @@
print(f"Unable to delete file: {e}")


def delete_dir(directory):

Check failure on line 33 in build_tools/purge_archive.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN201)

build_tools/purge_archive.py:33:5: ANN201 Missing return type annotation for public function `delete_dir`

Check failure on line 33 in build_tools/purge_archive.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN001)

build_tools/purge_archive.py:33:16: ANN001 Missing type annotation for function argument `directory`
print(f"Deleting directory: {directory}")
try:
shutil.rmtree(winapi_path(directory), onerror=rmtree_error)
Expand All @@ -38,7 +38,7 @@
print(f"Unable to delete directory {directory}: {e}")


def delete_file(file):

Check failure on line 41 in build_tools/purge_archive.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN201)

build_tools/purge_archive.py:41:5: ANN201 Missing return type annotation for public function `delete_file`

Check failure on line 41 in build_tools/purge_archive.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN001)

build_tools/purge_archive.py:41:17: ANN001 Missing type annotation for function argument `file`
print(f"Deleting file: {file}")
try:
os.remove(winapi_path(file))
Expand Down