]>
git.mar77i.info Git - admin/blob - gitweb_configs.py
5 from pathlib
import Path
6 from shutil
import rmtree
7 from subprocess
import CalledProcessError
, check_output
, run
11 "owner": "mar77i <mar77i@protonmail.ch>",
12 "description": "admin scripts",
15 "owner": "mar77i <mar77i@protonmail.ch>",
16 "description": "mar77i.info website",
19 "owner": "mar77i <mar77i@protonmail.ch>",
20 "description": "base for websocket toys",
23 "owner": "mar77i <mar77i@protonmail.ch>",
24 "description": "laptop screen configuration",
27 "owner": "mar77i <mar77i@protonmail.ch>",
28 "description": "user configuration files",
31 "owner": "mar77i <mar77i@protonmail.ch>",
32 "description": "Qt mandelbrot toy, with big integers only",
38 base_dir
= Path
.home() / "git"
39 for p
in base_dir
.iterdir():
40 if p
.is_dir() and p
.name
not in GITWEB_CONFIGS
:
42 print(f
"removed {p.name}")
43 for repository
, configs
in GITWEB_CONFIGS
.items():
44 p
= base_dir
/ repository
48 run(["git", "init", "--bare"])
49 print(f
"created {p.name}")
52 description
= p
/ "description"
53 if description
.exists():
55 assert set(configs
) == {"owner", "description"}
56 for key
, value
in configs
.items():
58 output
= check_output(
59 ["git", "config", "--get", f
"gitweb.{key}"], universal_newlines
=True
61 except CalledProcessError
:
63 if output
!= f
"{value}\n":
64 run(["git", "config", f
"gitweb.{key}", value
])
67 if __name__
== "__main__":