pthbs_genpkgpy

Template engine for producing packages for pthbs written using Python and Jinja
git clone https://ccx.te2000.cz/git/pthbs_genpkgpy
Log | Files | Refs | Submodules | README

commit 43d7c9114d8b2441d7c625aedb37a4283a5a4385
parent 1893cb07333d14a530796df348219e2bea5016bd
Author: ccx <ccx@te2000.cz>
Date:   Thu, 31 Oct 2024 13:39:11 +0000

Fix formatting

Diffstat:
Mgenpkg.py | 23+++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/genpkg.py b/genpkg.py @@ -12,7 +12,7 @@ import yaml class SubmoduleInfo: def __init__(self, cache_dir='cache'): self._current_commits = None - self._by_commit = Path(cache_dir) / "link" / "git-commit-sha1" # TODO: configurable + self._by_commit = Path(cache_dir) / "link" / "git-commit-sha1" @property def current(self): @@ -28,7 +28,10 @@ class SubmoduleInfo: } for repo, commit in self._current_commits.items(): if not (self._by_commit / commit).exists(): - raise RuntimeError(f"commit ID does not seem to be linked: {commit} from {repo!r} in {self._by_commit}") + raise RuntimeError( + f"commit ID does not seem to be linked:" + f" {commit} from {repo!r} in {self._by_commit}" + ) return self._current_commits def commit_info(self, commit_id): @@ -46,7 +49,7 @@ class DownloadsInfo: def __init__(self, downloadlist_path): assert isinstance(downloadlist_path, Path) self._basenames = {} - with downloadlist_path.open('rt') as f: # TODO: configurable + with downloadlist_path.open('rt') as f: for line in f: if line[0] in '#\n': continue @@ -74,7 +77,7 @@ class FileInfo: assert isinstance(cache_dir, Path) self._files_dir = files_dir self._sha256_cache = {} - self._by_sha256 = Path(cache_dir) / "link" / "files-sha256" # TODO: configurable + self._by_sha256 = Path(cache_dir) / "link" / "files-sha256" def __getitem__(self, key): if key in self._sha256_cache: @@ -84,7 +87,9 @@ class FileInfo: file_hash = hashlib.file_digest(f, "sha256").hexdigest() self._sha256_cache[key] = file_hash if not (self._by_sha256 / file_hash).exists(): - raise RuntimeError(f"file {key!r} does not seem to be linked as {file_hash} from {self._by_sha256}") + raise RuntimeError( + f"file {key!r} does not seem to be linked as {file_hash} from {self._by_sha256}" + ) return file_hash @@ -93,8 +98,9 @@ def parse_filelist(filelist_path): with filelist_path.open('rt') as f: return { os.path.basename(fname): fhash - for fhash, fname - in (line.rstrip('\n').split(' ', maxsplit=1) for line in f) + for fhash, fname in ( + line.rstrip('\n').split(' ', maxsplit=1) for line in f + ) } @@ -222,11 +228,8 @@ class Main: if __name__ == '__main__': - #from pprint import pprint as pp - m = Main.from_argv() m.load_vars_yaml() - #pp(m.env.list_templates(filter_func=lambda name: "/." not in name)) m.render_all() # pylama:linters=pycodestyle,pyflakes:ignore=D212,D203,D100,D101,D102,D105,D107