commit 12a62e01a97f2569c46f74976f6e22cc32f7d9ae
parent 4f9188ad4ddc7e626f2b607237ee250284f28475
Author: Jan Pobříslo <ccx@te2000.cz>
Date: Wed, 7 Jun 2023 14:00:41 +0200
Fix pthbs-makegen, Python formatting
Diffstat:
3 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
@@ -13,7 +13,11 @@ $(VERSIONS)/environment.%/.env:
@echo touch '$@'
-make/package.%.mk: packages/%
+%/.exists:
+ mkdir -p '$*'
+ touch '$@'
+
+make/package.%.mk: packages/% make/.exists
pthbs-makegen 'packages/$*' >'$@.new'
mv '$@.new' '$@'
@@ -22,3 +26,14 @@ pkg_files=$(wildcard packages/*)
env_files=$(wildcard environments/*)
mk_files=$(patsubst packages/%,make/package.%.mk,$(pkg_files))
include $(mk_files)
+
+pycodestyle: .pycodestyle.genpkg.py
+ pylama -l 88 ./scripts/genpkg.py
+
+.pycodestyle.%.py: %.py
+ isort - <$< >$<.tmp1
+ black -S - <$<.tmp1 >$<.tmp2
+ rm $<.tmp1
+ mv $<.tmp2 $<
+ touch $@
+
diff --git a/command/pthbs-makegen b/command/pthbs-makegen
@@ -119,4 +119,4 @@ function have_envdep(package) {
{
fatal("unexpected line")
}
-'
+' "$script"
diff --git a/genpkg.py b/genpkg.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-import os.path
import hashlib
+import os.path
from pathlib import Path
import jinja2
@@ -12,8 +12,8 @@ class Main:
self.out_dir = Path(out_dir)
self.template_dir = Path(template_dir)
self.env = jinja2.Environment(
- loader = jinja2.FileSystemLoader(template_dir),
- autoescape = False,
+ loader=jinja2.FileSystemLoader(template_dir),
+ autoescape=False,
)
self.env.globals["pkg_sha256"] = self.pkg_sha256
self.rendered = {}
@@ -47,15 +47,16 @@ class Main:
yield tplname[4:]
def render_all(self):
- for pkgname in self.list_packages()
+ for pkgname in self.list_packages():
print("%s:\t%s" % (pkgname, self.pkg_sha256(pkgname)))
if __name__ == '__main__':
from pprint import pprint as pp
+
m = Main()
m.load_vars_yaml()
- pp(m.env.list_templates(filter_func = lambda name: "/." not in name))
+ pp(m.env.list_templates(filter_func=lambda name: "/." not in name))
m.render_all()
os.write(1, b"\n\n---\n")
os.write(1, m.rendered["musl-cross-make:bootstrap"])