diff --git a/pyproject.toml b/pyproject.toml index 3e3d0bd..0b8192d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,12 +66,12 @@ dependencies = [ [tool.hatch.envs.lint.scripts] typing = "mypy --install-types --non-interactive {args:src/pisync tests}" style = [ - "ruff {args:.}", + "ruff check {args:.}", "black --check --diff {args:.}", ] fmt = [ "black {args:.}", - "ruff --fix {args:.}", + "ruff check --fix {args:.}", "style", ] all = [ @@ -93,7 +93,7 @@ skip-string-normalization = true [tool.ruff] target-version = "py37" line-length = 120 -select = [ +lint.select = [ "A", "ARG", "B", @@ -120,7 +120,7 @@ select = [ "W", "YTT", ] -ignore = [ +lint.ignore = [ # Allow non-abstract empty methods in abstract base classes "B027", # Allow boolean positional values in function calls, like `dict.get(... True)` @@ -132,18 +132,18 @@ ignore = [ # I do not know how to fix this `subprocess` call: check for execution of untrusted input "S603" ] -unfixable = [ +lint.unfixable = [ # Don't touch unused imports "F401", ] -[tool.ruff.isort] +[tool.ruff.lint.isort] known-first-party = ["pisync"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "all" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] diff --git a/src/pisync/__about__.py b/src/pisync/__about__.py index 6526deb..a73339b 100644 --- a/src/pisync/__about__.py +++ b/src/pisync/__about__.py @@ -1 +1 @@ -__version__ = "0.0.7" +__version__ = "0.0.8" diff --git a/src/pisync/util/__init__.py b/src/pisync/util/__init__.py index b7bc053..744408c 100644 --- a/src/pisync/util/__init__.py +++ b/src/pisync/util/__init__.py @@ -59,10 +59,10 @@ def backup(config: BaseConfig) -> str: return latest_backup_path else: msg = f"Backup failed. Rsync exit code: {exit_code}" - logging.error(msg) + logging.fatal(msg) # backup failed, we should delete the most recent backup if config.file_exists(latest_backup_path): - logging.info(f"Deleting failed backup at {latest_backup_path}") + logging.fatal(f"Deleting failed backup at {latest_backup_path}") config.rmtree(latest_backup_path) raise BackupFailedError(msg) @@ -98,9 +98,17 @@ def run_rsync(rsync_command: List[str]) -> int: start_time = time.perf_counter() process = subprocess.Popen(rsync_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + + # If the stdout argument was not PIPE, this attribute is None. if process.stdout is not None: for line in process.stdout: logging.info(f"RSYNC: {line.rstrip()}") + + # If the stderr argument was not PIPE, this attribute is None. + if process.stderr is not None: + for line in process.stderr: + logging.error(f"RSYNC: {line.rstrip()}") + return_code = process.wait() end_time = time.perf_counter()