kopia lustrzana https://github.com/inkstitch/inkstitch
pyinstaller build method
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).pull/16/head
rodzic
530aba9d8d
commit
03bcf51219
|
@ -1,2 +1,7 @@
|
|||
.*.swp
|
||||
*.pyc
|
||||
*.pyc
|
||||
*.spec
|
||||
*.zip
|
||||
*.tar.gz
|
||||
dist/
|
||||
build/
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
EXTENSIONS:=embroider embroider_params embroider_simulate embroider_update
|
||||
VERSION:=$(shell git tag -l | grep ^v | tail -n 1)
|
||||
TARBALL:=inkstitch-$(VERSION)-$(shell uname)-$(shell uname -m).tar.gz
|
||||
|
||||
dist: distclean
|
||||
mkdir -p dist/inkstitch/bin
|
||||
for extension in $(EXTENSIONS); do \
|
||||
pyinstaller -p /usr/share/inkscape/extensions $${extension}.py; \
|
||||
cp -a dist/$${extension}/* dist/inkstitch/bin; \
|
||||
rm -rf dist/$${extension}; \
|
||||
cp stub.py dist/$${extension}.py; \
|
||||
done;
|
||||
cp *.inx dist
|
||||
cd dist; tar zcf ../$(TARBALL) *
|
||||
|
||||
distclean:
|
||||
rm -rf build dist *.spec *.tar.gz
|
|
@ -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)
|
Ładowanie…
Reference in New Issue