refactor(scripts): extract shared utilities into common module

- Move load_env_file, parse_timeout_seconds, build_remote_script, and
  build_ssh_command to scripts/common.py
- Update remote_docker_run.py to import from common module
- Improves code organization and reusability
This commit is contained in:
2026-05-03 19:01:35 +08:00
parent 8b8e4d3118
commit 0ae6d757dc
5 changed files with 136 additions and 110 deletions

View File

@@ -10,18 +10,10 @@ rsync_flags := "-avLh --progress --stats --itemize-changes"
upload_excludes := "--exclude-from=.rsyncignore"
upload:
if command -v cygpath >/dev/null 2>&1 || test -n "${MSYSTEM:-}" || test -n "${CYGWIN:-}"; then \
env MSYS2_ARG_CONV_EXCL='*' rsync {{ rsync_flags }} {{ upload_excludes }} . {{ remote_root }}/; \
else \
rsync {{ rsync_flags }} {{ upload_excludes }} . {{ remote_root }}/; \
fi
rsync {{ rsync_flags }} {{ upload_excludes }} . {{ remote_root }}/; \
download:
if command -v cygpath >/dev/null 2>&1 || test -n "${MSYSTEM:-}" || test -n "${CYGWIN:-}"; then \
env MSYS2_ARG_CONV_EXCL='*' rsync {{ rsync_flags }} {{ remote_root }}/outputs .; \
else \
rsync {{ rsync_flags }} {{ remote_root }}/outputs .; \
fi
rsync {{ rsync_flags }} {{ remote_root }}/outputs .; \
sync-pkgs:
uv sync --inexact
@@ -61,9 +53,3 @@ remote-check:
remote-dry cmd:
uv run python scripts/remote_docker_run.py run --dry-run -- {{ quote(cmd) }}
remote-test:
uv run python scripts/remote_docker_run.py run -- "uv run pytest -q"
remote-test-one path:
uv run python scripts/remote_docker_run.py run -- "uv run pytest -q {{ path }}"