From 42e84134d63cf3c895be79b37faf913d44232f31 Mon Sep 17 00:00:00 2001 From: Laurent Sibilla Date: Sun, 13 Dec 2020 17:00:16 +0100 Subject: [PATCH] Fix pyinstaller packaging --- Dockerfile | 1 + hook-runci.engine.py | 4 ++++ runci.spec | 4 ++-- runci/cli/main.py | 10 +++++----- 4 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 hook-runci.engine.py diff --git a/Dockerfile b/Dockerfile index 98ddbb9..97679e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,7 @@ RUN coverage run --source ./runci --timid -m unittest && coverage report -m RUN pip install . COPY runci.spec /src/runci.spec +COPY hook-*.py /src/ RUN pyinstaller runci.spec diff --git a/hook-runci.engine.py b/hook-runci.engine.py new file mode 100644 index 0000000..e565714 --- /dev/null +++ b/hook-runci.engine.py @@ -0,0 +1,4 @@ +from runci.engine.core import default_modules + + +hiddenimports = default_modules diff --git a/runci.spec b/runci.spec index 0035e46..712f8d2 100644 --- a/runci.spec +++ b/runci.spec @@ -7,8 +7,8 @@ a = Analysis(['main.py'], pathex=['./runci'], binaries=[], datas=[], - hiddenimports=[], - hookspath=[], + hiddenimports=['runci.engine'], + hookspath=['.'], runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, diff --git a/runci/cli/main.py b/runci/cli/main.py index 8d1a1ca..82a9250 100644 --- a/runci/cli/main.py +++ b/runci/cli/main.py @@ -32,22 +32,22 @@ def main(targets, file): unknown_targets = [t for t in targets if t not in [t.name for t in project.targets]] if any(unknown_targets): print("Unkown targets: %s" % str.join(" ", unknown_targets), file=sys.stderr) - exit(1) + sys.exit(1) result = asyncio.run(run_project(context)) if result == JobStatus.SUCCEEDED: print("Pipeline has run succesfully.") - exit(0) + sys.exit(0) elif result == JobStatus.FAILED: print("Pipeline has failed.", file=sys.stderr) - exit(1) + sys.exit(1) elif result == JobStatus.CANCELED: print("Pipeline has been canceled.", file=sys.stderr) - exit(2) + sys.exit(2) else: print("Pipeline has been run but outcome is undetermined. Please report this as a bug.", file=sys.stderr) - exit(3) + sys.exit(3) async def run_project(context):