--- /dev/null
+---
+repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.5.0 # Use the ref you want to point at
+ hooks:
+ - id: trailing-whitespace
+ exclude: |
+ (?x)^(
+ .*\.py
+ )$
+ - id: check-added-large-files
+ - id: debug-statements
+ - id: detect-private-key
+ - id: end-of-file-fixer
+ - id: mixed-line-ending
+ exclude: |
+ (?x)^(
+ .*\.py
+ )$
+ - id: check-case-conflict
+ exclude: |
+ (?x)^(
+ .*\.py
+ )$
+ - id: check-json
+ - id: pretty-format-json
+ - id: check-merge-conflict
+ - id: check-toml
+ - id: check-xml
+ - id: requirements-txt-fixer
+ - repo: https://github.com/astral-sh/ruff-pre-commit
+ # Ruff version.
+ rev: v0.1.9
+ hooks:
+ # Run the linter.
+ - id: ruff
+ types_or: [python, pyi, jupyter]
+ args: [--fix]
+ exclude: |
+ (?x)^(
+ .*[Tt]est.*|
+ __init__.py
+ )$
+ # Run the formatter.
+ - id: ruff-format
+ types_or: [python, pyi, jupyter]
+ - repo: https://github.com/pre-commit/mirrors-mypy
+ rev: v1.8.0
+ hooks:
+ - id: mypy
+ exclude: |
+ (?x)^(
+ .*[Tt]est.*
+ )$
+ args: [--ignore-missing-imports, --explicit-package-bases]
+ - repo: https://github.com/scop/pre-commit-shfmt
+ rev: v3.7.0-4
+ hooks:
+ # Choose one of:
+ - id: shfmt # prebuilt upstream executable
+ args: [--indent=4, -w, -s]
+ - repo: https://github.com/shellcheck-py/shellcheck-py
+ rev: v0.9.0.6
+ hooks:
+ - id: shellcheck
+ args: [--severity=warning]
+ - repo: https://github.com/adrienverge/yamllint.git
+ rev: v1.21.0 # or higher tag
+ hooks:
+ - id: yamllint
+ args: [--strict, '--config-data={extends: relaxed, rules: {line-length: {max: 120}}}']
+ - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
+ rev: 0.2.1 # or other specific tag
+ hooks:
+ - id: yamlfmt
+ - repo: https://github.com/pre-commit/pygrep-hooks
+ rev: v1.10.0 # Use the ref you want to point at
+ hooks:
+ - id: rst-backticks
+ - id: rst-directive-colons
+ - id: rst-inline-touching-normal
import datetime
import shutil
import gettext
+from pathlib import Path
import pprint as PP
import src
# Load LOCAL config file
# search only in the data directory
src.pyconf.streamOpener = ConfigOpener([cfg.VARS.datadir])
+
+ # if `local.pyconf` file is missing, create it from
+ # `local_original.pyconf` template file
+ localconf_path = osJoin(cfg.VARS.datadir, 'local.pyconf')
+ if not Path(localconf_path).is_file():
+ shutil.copyfile(osJoin(cfg.VARS.datadir, 'local_original.pyconf'), localconf_path)
+
try:
- local_cfg = src.pyconf.Config(open( osJoin(cfg.VARS.datadir,
- 'local.pyconf')),
+ local_cfg = src.pyconf.Config(open(localconf_path),
PWD = ('LOCAL', cfg.VARS.datadir) )
except src.pyconf.ConfigError as e:
raise src.SatException(_("Error in configuration file: "