summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/build-dist43
-rwxr-xr-xbin/gen-input-inx6
-rwxr-xr-xbin/gen-output-inx45
-rwxr-xr-xbin/gen-zip-inx44
4 files changed, 112 insertions, 26 deletions
diff --git a/bin/build-dist b/bin/build-dist
index a1fa82d9..4d73313a 100755
--- a/bin/build-dist
+++ b/bin/build-dist
@@ -34,26 +34,23 @@ pyinstaller_args+="-p inkscape-0.92.2/share/extensions "
# output useful debugging info that helps us trace library dependency issues
pyinstaller_args+="--log-level DEBUG "
-mkdir -p dist/inkstitch/bin
-for extension in "$@"; do
- if [ "$BUILD" = "windows" ]; then
- wine c:\\Python\\scripts\\pyinstaller.exe $pyinstaller_args ${extension}.py
- else
- # without the LD_LIBRARY_PATH, it seems that pyinstaller can't find all of
- # wxpython's shared libraries
- LD_LIBRARY_PATH="${site_packages}/wx" pyinstaller $pyinstaller_args ${extension}.py;
- fi
-
- # By default, pyinstaller will treat each of ink/stitch's extensions
- # separately. This means it packages a lot of the same shared libraries (like
- # wxPython) multiple times. Turns out that we can just copy the contents of
- # the directories pyinstaller creates into one and it works fine, eliminating
- # the duplication. This significantly decreases the size of the inkstitch
- # tarball/zip.
- cp -a dist/${extension}/* dist/inkstitch/bin
- rm -rf dist/${extension}
-
- # Inkscape doesn't let us run native binaries as extensions(?!). Instead we
- # add this stub script which executes the binaries that pyinstaller creates.
- cp stub.py dist/${extension}.py
-done
+if [ "$BUILD" = "windows" ]; then
+ wine c:\\Python\\scripts\\pyinstaller.exe $pyinstaller_args inkstitch.py
+else
+ # without the LD_LIBRARY_PATH, it seems that pyinstaller can't find all of
+ # wxpython's shared libraries
+ LD_LIBRARY_PATH="${site_packages}/wx" pyinstaller $pyinstaller_args --strip inkstitch.py;
+fi
+
+# pyinstaller put a whole mess of libraries under dist/inkstitch. We'd like
+# to put some more user-accessible stuff like examples and palettes in
+# folders under inkstitch/ (see ../Makefile) so let's move the pyinstaller
+# stuff into its own dir.
+shopt -s dotglob
+mkdir dist/bin
+mv dist/inkstitch/* dist/bin
+mv dist/bin dist/inkstitch
+
+# Inkscape doesn't let us run native binaries as extensions(?!). Instead we
+# add this stub script which executes the binary that pyinstaller creates.
+cp stub.py dist/inkstitch.py
diff --git a/bin/gen-input-inx b/bin/gen-input-inx
index 918adfb9..6351d062 100755
--- a/bin/gen-input-inx
+++ b/bin/gen-input-inx
@@ -21,9 +21,9 @@ def libembroidery_input_formats():
while(curFormat):
extension = embFormat_extension(curFormat)
description = embFormat_description(curFormat)
- writerState = embFormat_readerState(curFormat)
+ reader_state = embFormat_readerState(curFormat)
- if writerState.strip() and embFormat_type(curFormat) != EMBFORMAT_OBJECTONLY:
+ if reader_state.strip() and embFormat_type(curFormat) != EMBFORMAT_OBJECTONLY:
# extension includes the dot, so we'll remove it
yield extension[1:], description
@@ -37,7 +37,7 @@ def main():
for format, description in libembroidery_input_formats():
inx = template.render(format=format, description=description)
- with open("inx/embroider_input_%s.inx" % format.upper(), 'w') as inx_file:
+ with open("inx/inkstitch_input_%s.inx" % format.upper(), 'w') as inx_file:
inx_file.write(inx)
diff --git a/bin/gen-output-inx b/bin/gen-output-inx
new file mode 100755
index 00000000..f167dbee
--- /dev/null
+++ b/bin/gen-output-inx
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+
+import sys, os
+from os.path import dirname
+from libembroidery import *
+from jinja2 import Environment, FileSystemLoader, select_autoescape
+
+
+def build_environment():
+ template_dir = os.path.join(dirname(dirname(os.path.realpath(__file__))), "templates")
+
+ return Environment(
+ loader = FileSystemLoader(template_dir),
+ autoescape = True
+ )
+
+
+def libembroidery_output_formats():
+ formatList = embFormatList_create()
+ curFormat = formatList
+ while(curFormat):
+ extension = embFormat_extension(curFormat)
+ description = embFormat_description(curFormat)
+ writer_state = embFormat_writerState(curFormat)
+
+ if writer_state.strip() and embFormat_type(curFormat) != EMBFORMAT_OBJECTONLY:
+ # extension includes the dot, so we'll remove it
+ yield extension[1:], description
+
+ curFormat = curFormat.next
+
+
+def main():
+ env = build_environment()
+ template = env.get_template('embroider_output.inx')
+
+ for format, description in libembroidery_output_formats():
+ inx = template.render(format=format, description=description)
+
+ with open("inx/inkstitch_output_%s.inx" % format.upper(), 'w') as inx_file:
+ inx_file.write(inx)
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/bin/gen-zip-inx b/bin/gen-zip-inx
new file mode 100755
index 00000000..5fbc8f1e
--- /dev/null
+++ b/bin/gen-zip-inx
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+
+import sys, os
+from os.path import dirname
+from libembroidery import *
+from jinja2 import Environment, FileSystemLoader, select_autoescape
+
+
+def build_environment():
+ template_dir = os.path.join(dirname(dirname(os.path.realpath(__file__))), "templates")
+
+ return Environment(
+ loader = FileSystemLoader(template_dir),
+ autoescape = True
+ )
+
+
+def libembroidery_output_formats():
+ formatList = embFormatList_create()
+ curFormat = formatList
+ while(curFormat):
+ extension = embFormat_extension(curFormat)
+ description = embFormat_description(curFormat)
+ writer_state = embFormat_writerState(curFormat)
+
+ if writer_state.strip() and embFormat_type(curFormat) != EMBFORMAT_OBJECTONLY:
+ # extension includes the dot, so we'll remove it
+ yield extension[1:], description
+
+ curFormat = curFormat.next
+
+
+def main():
+ env = build_environment()
+ template = env.get_template('embroider_zip_output.inx')
+
+ inx = template.render(formats=libembroidery_output_formats())
+
+ with open("inx/inkstitch_output_ZIP.inx", 'w') as inx_file:
+ inx_file.write(inx)
+
+
+if __name__ == "__main__":
+ sys.exit(main())