From 6a985e0b89296e5cb09ce94189798589da6bc382 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 22 Feb 2025 20:56:41 +0100 Subject: [PATCH] lint --- sync.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sync.py b/sync.py index b7f98d7..a72224b 100755 --- a/sync.py +++ b/sync.py @@ -1,10 +1,13 @@ #! /usr/bin/env python3 +"""Synchronize to remote pubnixes.""" -import os -import subprocess +from __future__ import annotations from logging import log +from os import sep from pathlib import Path from pubnix import PubNix +import subprocess + ARGS = [ { @@ -41,7 +44,7 @@ ARGS = [ PUBNIXES = [PubNix(**args) for args in ARGS] -def sync(root: str, pubnix: PubNix, exclude: list[str] | None = None) -> None: +def sync(root: Path, pubnix: PubNix, exclude: list[str] | None = None) -> None: """Synchronize local root directory with pubnix.""" args = [ "rsync", @@ -53,17 +56,18 @@ def sync(root: str, pubnix: PubNix, exclude: list[str] | None = None) -> None: "--partial", "--progress", "--verbose", - os.path.join(root, ""), + f"{root}{sep}", ] - for item in exclude: - args.extend(["--exclude", os.path.join("", item)]) - args.append(os.path.join(pubnix.target, "")) + if exclude: + for item in exclude: + args.extend(["--exclude", f"{sep}{item}"]) + args.append(f"{pubnix.target}{sep}") subprocess.call(args, stdout=subprocess.DEVNULL) def main() -> None: """Synchronize content on remote pubnixes.""" - root = Path(os.path.realpath(__file__)).parent / "out" / "web" + root = Path(__file__).resolve().parent / "out" / "web" for pn in PUBNIXES: log() log(pn)