From 8bab858be6699bf393694dfe05c2c49f01e5c27a Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sat, 13 Jan 2018 20:18:50 -0500 Subject: pyinstaller release method (#16) pyinstaller packages up all of a python script's dependencies and builds them into standalone executables. It can either do a directory (containing a single executable and a bunch of shared libraries) or a self-contained executable that effectively just contains a compressed version of the directory. The problem is, if you have several scripts like we do, you get several large directories or standalone binaries, and there's a ton of duplication between them. Fortunately it looks like using the directory method and just combining the directories works fine (for this project). This PR runs the above build on any tagged commit and publishes a release in github containing the pyinstall-ified tarball. If the tag is named like "v1.2.3" _and_ the tag is on the master branch, then the github release will be marked as "production". Otherwise, it will be marked as a "pre-release". This means that we can build testable tarballs of the extension in a pull request by tagging a commit. --- stub.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 stub.py (limited to 'stub.py') diff --git a/stub.py b/stub.py new file mode 100644 index 00000000..9fa33160 --- /dev/null +++ b/stub.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +import sys +import os + +# ink/stitch +# +# stub.py: pyinstaller execution stub +# +# pyinstaller packages the inkstitch extensions into nice tidy executables. +# That's great, but Inkscape can't execute a plain binary as an extension(!). +# +# This Python script exists only to execute the actual extension binary. It +# can be copied to, e.g., "embroider_params.py", in which case it will look +# for a binary at inkstitch/bin/embroider_params. + +script_name = os.path.basename(__file__) + +if script_name.endswith('.py'): + binary_name = script_name[:-3] +else: + # Probably not right, but we can at least try. + binary_name = script_name + +binary_path = os.path.join("inkstitch", "bin", binary_name) + +args = sys.argv[:] +args[0] = binary_path + +os.execv(binary_path, args) -- cgit v1.2.3