mirror of
https://github.com/blw1138/cross-py-builder.git
synced 2025-12-17 08:38:11 +00:00
Argparse cleanup
This commit is contained in:
@@ -140,10 +140,11 @@ def process_new_job(args, server_data):
|
||||
print(f"Found {len(available_servers)} servers available to build")
|
||||
print(tabulate(available_servers, headers="keys", tablefmt="grid"))
|
||||
|
||||
project_path = args.build
|
||||
tmp_dir = tempfile.gettempdir()
|
||||
zip_file = os.path.join(tmp_dir, f"{os.path.basename(args.path)}.zip")
|
||||
zip_project(args.path, zip_file)
|
||||
print(f"Zipped {args.path} to {zip_file}")
|
||||
zip_file = os.path.join(tmp_dir, f"{os.path.basename(project_path)}.zip")
|
||||
zip_project(project_path, zip_file)
|
||||
print(f"Zipped {project_path} to {zip_file}")
|
||||
|
||||
# Start builds on all matching servers
|
||||
with concurrent.futures.ThreadPoolExecutor() as executor:
|
||||
@@ -248,17 +249,17 @@ def update_build_workers(server_data):
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Build agent manager for cross-py-builder")
|
||||
parser.add_argument("-status", action="store_true", help="Get status of available servers")
|
||||
parser.add_argument("-path", type=str, help="Path to the project")
|
||||
parser.add_argument("--status", action="store_true", help="Get status of available servers")
|
||||
parser.add_argument("--build", type=str, help="Path to the project to build")
|
||||
parser.add_argument("-cpu", type=str, help="CPU architecture")
|
||||
parser.add_argument("-os", type=str, help="Operating system")
|
||||
parser.add_argument("-d", '--download', action="store_true", help="Download after build")
|
||||
parser.add_argument("-delete-cache", action="store_true", help="Delete cache")
|
||||
parser.add_argument("-update-all", action="store_true", help="Update build agent")
|
||||
parser.add_argument("-restart", type=str, help="Hostname to restart")
|
||||
parser.add_argument("-restart-all", action="store_true", help="Restart all agents")
|
||||
parser.add_argument("-shutdown", type=str, help="Hostname to shutdown")
|
||||
parser.add_argument("-shutdown-all", action="store_true", help="Restart all agents")
|
||||
parser.add_argument("--delete-cache", action="store_true", help="Delete cache")
|
||||
parser.add_argument("--update-all", action="store_true", help="Update build agent")
|
||||
parser.add_argument("--restart", type=str, help="Hostname to restart")
|
||||
parser.add_argument("--restart-all", action="store_true", help="Restart all agents")
|
||||
parser.add_argument("--shutdown", type=str, help="Hostname to shutdown")
|
||||
parser.add_argument("--shutdown-all", action="store_true", help="Restart all agents")
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.status:
|
||||
@@ -278,7 +279,7 @@ def main():
|
||||
shutdown_agent(server_ip)
|
||||
elif args.delete_cache:
|
||||
delete_cache(get_all_servers_status())
|
||||
elif args.path:
|
||||
elif args.build:
|
||||
process_new_job(args, get_all_servers_status())
|
||||
elif args.update_all:
|
||||
update_build_workers(get_all_servers_status())
|
||||
|
||||
Reference in New Issue
Block a user