Commit e8577d98fa

e8577d98faff1bed72ba6f2d204b8b44c6827c23

parent: 0b2895a90c

Unsigned

github-actions <41898282+github-actions[bot]@users.noreply.github.com> · 2025-06-04 00:51 UTC

Commit from GitHub Actions (Ruff)

Layout: unified · split

build.py +11 −6
@@ -5,11 +5,13 @@ import subprocess
55import sys
66from pathlib import Path
77
8
89def prompt(prompt_text):
910 try:
1011 return input(prompt_text).strip()
1112 except EOFError:
12 return ''
13 return ""
14
1315
1416def remove_build_directory(build_dir):
1517 if build_dir.exists():
@@ -17,6 +19,7 @@ def remove_build_directory(build_dir):
1719 shutil.rmtree(build_dir)
1820 build_dir.mkdir(parents=True, exist_ok=True)
1921
22
2023def minify_css(src_css, dest_css):
2124 print(f"Minifying CSS: {src_css} → {dest_css}")
2225 result = subprocess.run(
@@ -30,6 +33,7 @@ def minify_css(src_css, dest_css):
3033 print(result.stderr, file=sys.stderr)
3134 sys.exit(1)
3235
36
3337def run_emacs_publish(dev_mode=True):
3438 if dev_mode:
3539 print("Running Emacs publish script (development)...")
@@ -53,6 +57,7 @@ def run_emacs_publish(dev_mode=True):
5357 print(result.stderr, file=sys.stderr)
5458 sys.exit(1)
5559
60
5661def deploy_to_server(build_dir, server):
5762 remote_path = f"{server}:/var/www/cleberg.net/"
5863 print(f"Deploying .build/ → {remote_path}")
@@ -67,21 +72,20 @@ def deploy_to_server(build_dir, server):
6772 print(result.stderr, file=sys.stderr)
6873 sys.exit(1)
6974
75
7076def start_dev_server(build_dir):
7177 print(f"Starting development HTTP server from {build_dir}/ on port 8000")
7278 os.chdir(build_dir)
7379 # This will run until interrupted (Ctrl+C)
7480 try:
75 subprocess.run(
76 [sys.executable, "-m", "http.server", "8000"],
77 check=True
78 )
81 subprocess.run([sys.executable, "-m", "http.server", "8000"], check=True)
7982 except KeyboardInterrupt:
8083 print("\nDevelopment server stopped.")
8184 except subprocess.CalledProcessError as e:
8285 print(f"Error starting development server: {e}", file=sys.stderr)
8386 sys.exit(1)
8487
88
8589def main():
8690 build_dir = Path(".build")
8791 theme_dir = Path("theme/static")
@@ -132,5 +136,6 @@ def main():
132136 # Launch development web server
133137 start_dev_server(build_dir)
134138
139
135140if __name__ == "__main__":
136 main()
\ No newline at end of file
141 main()