Important information: Google announced that, from September 2026, Android devices will require ALL apps to be signed by Google, effectively leading to an iOS situation. Value your right to a computer that does what you want; do not tolerate this monopolistic practice! Contact me if you don't understand why it is bad. Click to learn more.

 build.py

View raw Download
text/x-script.python • 1.16 kiB
Python script, ASCII text executable
        
            
1
import subprocess
2
import os
3
import tempfile
4
import shutil
5
from pathlib import Path
6
7
source_dir = Path("drawings")
8
9
files = list((source_dir / "apps").iterdir()) + list((source_dir / "categories").iterdir()) + list((source_dir / "places").iterdir()) + list((source_dir / "status").iterdir())
10
sizes = [64, 48, 32, 24, 16]
11
12
build_dir = Path("build")
13
14
if build_dir.exists():
15
shutil.rmtree(build_dir)
16
17
build_dir.mkdir()
18
19
# Copy the theme file
20
shutil.copy(Path("index.theme"), build_dir)
21
22
for size in sizes:
23
(build_dir / f"{size}x{size}").mkdir()
24
25
for file in files:
26
with tempfile.TemporaryDirectory() as scratch:
27
subprocess.run(["inkscape", "--export-page=all", "-Tl", "-o", str(Path(scratch) / "page.svg"), str(file)])
28
# Temporary names will be used; move them
29
icon_name = file.name
30
category_name = file.parent.name
31
print("SCRATCH CONTENTS:", list(Path(scratch).iterdir()), file)
32
33
for i, size in enumerate(sizes, 1):
34
(build_dir / f"{size}x{size}" / category_name).mkdir(parents=True, exist_ok=True)
35
shutil.move(Path(scratch) / f"page_p{i}.svg", build_dir / f"{size}x{size}" / category_name / icon_name)
36
37