From 32d027fcc94544d565f8598223536ad48346ad6b Mon Sep 17 00:00:00 2001 From: Wendell Jones Date: Sun, 26 Apr 2026 10:18:04 -0400 Subject: [PATCH] Add build scripts for ILO and IPMI management tools Co-authored-by: Copilot --- build_all.py | 41 +++++++++++++++++++ personal/cron_scripts/build_ilo_powercycle.py | 40 ++++++++++++++++++ personal/cron_scripts/build_ilo_status.py | 40 ++++++++++++++++++ personal/cron_scripts/build_ipmi_poweroff.py | 38 +++++++++++++++++ personal/cron_scripts/build_ipmi_poweron.py | 38 +++++++++++++++++ .../cron_scripts/build_multi_powercycle.py | 5 ++- personal/cron_scripts/build_set_fanspeed.py | 38 +++++++++++++++++ 7 files changed, 238 insertions(+), 2 deletions(-) create mode 100644 build_all.py create mode 100644 personal/cron_scripts/build_ilo_powercycle.py create mode 100644 personal/cron_scripts/build_ilo_status.py create mode 100644 personal/cron_scripts/build_ipmi_poweroff.py create mode 100644 personal/cron_scripts/build_ipmi_poweron.py create mode 100644 personal/cron_scripts/build_set_fanspeed.py diff --git a/build_all.py b/build_all.py new file mode 100644 index 0000000..cdbc3f1 --- /dev/null +++ b/build_all.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +import subprocess +import sys +from pathlib import Path + +REPO_ROOT = Path(__file__).resolve().parent +CRON_SCRIPTS = REPO_ROOT / "personal" / "cron_scripts" + +BUILD_SCRIPTS = [ + CRON_SCRIPTS / "build_multi_powercycle.py", + CRON_SCRIPTS / "build_set_fanspeed.py", + CRON_SCRIPTS / "build_ilo_status.py", + CRON_SCRIPTS / "build_ilo_powercycle.py", + CRON_SCRIPTS / "build_ipmi_poweron.py", + CRON_SCRIPTS / "build_ipmi_poweroff.py", +] + + +def main(): + failures = [] + for script in BUILD_SCRIPTS: + print(f"\n{'='*60}") + print(f"Building: {script.name}") + print(f"{'='*60}") + result = subprocess.run([sys.executable, str(script)], cwd=REPO_ROOT) + if result.returncode != 0: + failures.append(script.name) + + print(f"\n{'='*60}") + if failures: + print(f"FAILED builds ({len(failures)}/{len(BUILD_SCRIPTS)}):") + for name in failures: + print(f" - {name}") + raise SystemExit(1) + else: + print(f"All {len(BUILD_SCRIPTS)} builds completed successfully.") + print(f"Executables are in: {REPO_ROOT / 'dist'}") + + +if __name__ == "__main__": + main() diff --git a/personal/cron_scripts/build_ilo_powercycle.py b/personal/cron_scripts/build_ilo_powercycle.py new file mode 100644 index 0000000..fa0d0cc --- /dev/null +++ b/personal/cron_scripts/build_ilo_powercycle.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +import subprocess +import sys +from pathlib import Path + + +SCRIPT_DIR = Path(__file__).resolve().parent +REPO_ROOT = SCRIPT_DIR.parents[1] +ENTRYPOINT = REPO_ROOT / "personal" / "tools" / "ilo_powercycle.py" +DIST_DIR = REPO_ROOT / "dist" + + +def main(): + command = [ + sys.executable, + "-m", + "PyInstaller", + "--noconfirm", + "--clean", + "--onefile", + "--name", + "ilo_powercycle", + "--collect-submodules", + "redfish", + str(ENTRYPOINT), + ] + + try: + subprocess.run(command, cwd=REPO_ROOT, check=True) + except subprocess.CalledProcessError as exc: + raise SystemExit(exc.returncode) from exc + + output_name = "ilo_powercycle.exe" if sys.platform.startswith("win") else "ilo_powercycle" + output_path = DIST_DIR / output_name + print(f"Built executable: {output_path}") + print("Build once on each target OS to get a native executable for that platform.") + + +if __name__ == "__main__": + main() diff --git a/personal/cron_scripts/build_ilo_status.py b/personal/cron_scripts/build_ilo_status.py new file mode 100644 index 0000000..d9e5302 --- /dev/null +++ b/personal/cron_scripts/build_ilo_status.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +import subprocess +import sys +from pathlib import Path + + +SCRIPT_DIR = Path(__file__).resolve().parent +REPO_ROOT = SCRIPT_DIR.parents[1] +ENTRYPOINT = SCRIPT_DIR / "ilo_status.py" +DIST_DIR = REPO_ROOT / "dist" + + +def main(): + command = [ + sys.executable, + "-m", + "PyInstaller", + "--noconfirm", + "--clean", + "--onefile", + "--name", + "ilo_status", + "--collect-submodules", + "redfish", + str(ENTRYPOINT), + ] + + try: + subprocess.run(command, cwd=REPO_ROOT, check=True) + except subprocess.CalledProcessError as exc: + raise SystemExit(exc.returncode) from exc + + output_name = "ilo_status.exe" if sys.platform.startswith("win") else "ilo_status" + output_path = DIST_DIR / output_name + print(f"Built executable: {output_path}") + print("Build once on each target OS to get a native executable for that platform.") + + +if __name__ == "__main__": + main() diff --git a/personal/cron_scripts/build_ipmi_poweroff.py b/personal/cron_scripts/build_ipmi_poweroff.py new file mode 100644 index 0000000..22298c2 --- /dev/null +++ b/personal/cron_scripts/build_ipmi_poweroff.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 +import subprocess +import sys +from pathlib import Path + + +SCRIPT_DIR = Path(__file__).resolve().parent +REPO_ROOT = SCRIPT_DIR.parents[1] +ENTRYPOINT = SCRIPT_DIR / "power" / "ipmi_poweroff.py" +DIST_DIR = REPO_ROOT / "dist" + + +def main(): + command = [ + sys.executable, + "-m", + "PyInstaller", + "--noconfirm", + "--clean", + "--onefile", + "--name", + "ipmi_poweroff", + str(ENTRYPOINT), + ] + + try: + subprocess.run(command, cwd=REPO_ROOT, check=True) + except subprocess.CalledProcessError as exc: + raise SystemExit(exc.returncode) from exc + + output_name = "ipmi_poweroff.exe" if sys.platform.startswith("win") else "ipmi_poweroff" + output_path = DIST_DIR / output_name + print(f"Built executable: {output_path}") + print("Build once on each target OS to get a native executable for that platform.") + + +if __name__ == "__main__": + main() diff --git a/personal/cron_scripts/build_ipmi_poweron.py b/personal/cron_scripts/build_ipmi_poweron.py new file mode 100644 index 0000000..e94b388 --- /dev/null +++ b/personal/cron_scripts/build_ipmi_poweron.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 +import subprocess +import sys +from pathlib import Path + + +SCRIPT_DIR = Path(__file__).resolve().parent +REPO_ROOT = SCRIPT_DIR.parents[1] +ENTRYPOINT = SCRIPT_DIR / "power" / "ipmi_poweron.py" +DIST_DIR = REPO_ROOT / "dist" + + +def main(): + command = [ + sys.executable, + "-m", + "PyInstaller", + "--noconfirm", + "--clean", + "--onefile", + "--name", + "ipmi_poweron", + str(ENTRYPOINT), + ] + + try: + subprocess.run(command, cwd=REPO_ROOT, check=True) + except subprocess.CalledProcessError as exc: + raise SystemExit(exc.returncode) from exc + + output_name = "ipmi_poweron.exe" if sys.platform.startswith("win") else "ipmi_poweron" + output_path = DIST_DIR / output_name + print(f"Built executable: {output_path}") + print("Build once on each target OS to get a native executable for that platform.") + + +if __name__ == "__main__": + main() diff --git a/personal/cron_scripts/build_multi_powercycle.py b/personal/cron_scripts/build_multi_powercycle.py index 83e731b..78fdec6 100644 --- a/personal/cron_scripts/build_multi_powercycle.py +++ b/personal/cron_scripts/build_multi_powercycle.py @@ -5,8 +5,9 @@ from pathlib import Path SCRIPT_DIR = Path(__file__).resolve().parent +REPO_ROOT = SCRIPT_DIR.parents[1] ENTRYPOINT = SCRIPT_DIR / "multi_powercycle.py" -DIST_DIR = SCRIPT_DIR / "dist" +DIST_DIR = REPO_ROOT / "dist" def main(): @@ -25,7 +26,7 @@ def main(): ] try: - subprocess.run(command, cwd=SCRIPT_DIR, check=True) + subprocess.run(command, cwd=REPO_ROOT, check=True) except subprocess.CalledProcessError as exc: raise SystemExit(exc.returncode) from exc diff --git a/personal/cron_scripts/build_set_fanspeed.py b/personal/cron_scripts/build_set_fanspeed.py new file mode 100644 index 0000000..6b7ee08 --- /dev/null +++ b/personal/cron_scripts/build_set_fanspeed.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 +import subprocess +import sys +from pathlib import Path + + +SCRIPT_DIR = Path(__file__).resolve().parent +REPO_ROOT = SCRIPT_DIR.parents[1] +ENTRYPOINT = SCRIPT_DIR / "fancontrol" / "set_fanspeed.py" +DIST_DIR = REPO_ROOT / "dist" + + +def main(): + command = [ + sys.executable, + "-m", + "PyInstaller", + "--noconfirm", + "--clean", + "--onefile", + "--name", + "set_fanspeed", + str(ENTRYPOINT), + ] + + try: + subprocess.run(command, cwd=REPO_ROOT, check=True) + except subprocess.CalledProcessError as exc: + raise SystemExit(exc.returncode) from exc + + output_name = "set_fanspeed.exe" if sys.platform.startswith("win") else "set_fanspeed" + output_path = DIST_DIR / output_name + print(f"Built executable: {output_path}") + print("Build once on each target OS to get a native executable for that platform.") + + +if __name__ == "__main__": + main()