75bd96098a
- Introduced .gitignore to exclude unnecessary files - Added scripts for powering on/off servers via IPMI and iLO - Implemented multi_powercycle script to manage multiple servers - Created build script for packaging multi_powercycle with PyInstaller - Enhanced logging functionality across scripts Co-authored-by: Copilot <copilot@github.com>
40 lines
969 B
Python
40 lines
969 B
Python
#!/usr/bin/env python3
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
SCRIPT_DIR = Path(__file__).resolve().parent
|
|
ENTRYPOINT = SCRIPT_DIR / "multi_powercycle.py"
|
|
DIST_DIR = SCRIPT_DIR / "dist"
|
|
|
|
|
|
def main():
|
|
command = [
|
|
sys.executable,
|
|
"-m",
|
|
"PyInstaller",
|
|
"--noconfirm",
|
|
"--clean",
|
|
"--onefile",
|
|
"--name",
|
|
"multi_powercycle",
|
|
"--collect-submodules",
|
|
"redfish",
|
|
str(ENTRYPOINT),
|
|
]
|
|
|
|
try:
|
|
subprocess.run(command, cwd=SCRIPT_DIR, check=True)
|
|
except subprocess.CalledProcessError as exc:
|
|
raise SystemExit(exc.returncode) from exc
|
|
|
|
output_name = "multi_powercycle.exe" if sys.platform.startswith("win") else "multi_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()
|