From fde53b867bd8fc4c0846a44dd7e03ce2addb7727 Mon Sep 17 00:00:00 2001 From: Orsiris de Jong Date: Mon, 27 Mar 2023 18:18:57 +0200 Subject: [PATCH] Remove --arch parameter since Nuitka compiles only on current python arch --- bin/COMPILE.cmd | 4 ++-- bin/COMPILE.sh | 2 +- bin/compile.py | 35 +++++++++++++---------------------- 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/bin/COMPILE.cmd b/bin/COMPILE.cmd index 9b831af..b449614 100644 --- a/bin/COMPILE.cmd +++ b/bin/COMPILE.cmd @@ -11,8 +11,8 @@ cd C:\GIT\npbackup :: Make sure we add npbackup in python path so bin and npbackup subfolders become packages SET PYTHONPATH=c:\GIT\npbackup -"%PYTHON64%" bin\compile.py --arch x64 --audience all -"%PYTHON32%" bin\compile.py --arch x86 --audience all +"%PYTHON64%" bin\compile.py --audience all +"%PYTHON32%" bin\compile.py --audience all diff --git a/bin/COMPILE.sh b/bin/COMPILE.sh index bdde9c8..ecd9a7a 100644 --- a/bin/COMPILE.sh +++ b/bin/COMPILE.sh @@ -6,4 +6,4 @@ cd /opt/npbackup export PYTHONPATH=/opt/npbackup -/opt/npbackup/venv/bin/python bin/compile.py --arch x64 --audience all \ No newline at end of file +/opt/npbackup/venv/bin/python bin/compile.py --audience all \ No newline at end of file diff --git a/bin/compile.py b/bin/compile.py index 2ef1e3d..5da8d62 100644 --- a/bin/compile.py +++ b/bin/compile.py @@ -8,7 +8,7 @@ __author__ = "Orsiris de Jong" __copyright__ = "Copyright (C) 2023 NetInvent" __license__ = "GPL-3.0-only" __build__ = "2023032601" -__version__ = "1.6.1" +__version__ = "1.6.2" import sys @@ -17,7 +17,6 @@ import argparse import atexit from command_runner import command_runner -ARCHES = ["x86", "x64"] AUDIENCES = ["public", "private"] # Insert parent dir as path se we get to use npbackup as package @@ -288,14 +287,6 @@ def compile(arch, audience): return not errors -class ArchAction(argparse.Action): - def __call__(self, parser, namespace, values, option_string=None): - if values not in ARCHES: - print("Got value:", values) - raise argparse.ArgumentError(self, "Not a valid arch") - setattr(namespace, self.dest, values) - - class AudienceAction(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): if values not in AUDIENCES + ["all"]: @@ -309,16 +300,6 @@ if __name__ == "__main__": prog="npbackup compile.py", description="Compiler script for NPBackup" ) - parser.add_argument( - "--arch", - type=str, - dest="arch", - default=None, - required=True, - action=ArchAction, - help="Target arch, x64 or x86", - ) - parser.add_argument( "--audience", type=str, @@ -336,6 +317,7 @@ if __name__ == "__main__": "private", ) try: + errors = False if args.audience.lower() == "all": audiences = AUDIENCES else: @@ -350,9 +332,18 @@ if __name__ == "__main__": if private_build and audience != "private": print("ERROR: Requested private build but no private data available") continue - result = compile(arch=args.arch, audience=audience) + python_arch = "x64" if sys.maxsize > 2**32 else "x86" + result = compile(arch=python_arch, audience=audience) + build_type = 'private' if private_build else 'public' if result: - print("MADE {} build".format('PRIVATE' if private_build else 'PUBLIC')) + print("SUCCESS: MADE {} build for audience {}".format(build_type, audience)) + else: + print("ERROR: Failed making {} build for audience {}".format(build_type, audience)) + errors = True + if errors: + print("ERRORS IN BUILD PROCESS") + else: + print("SUCCESS BUILDING") except Exception: print("COMPILATION FAILED") raise \ No newline at end of file