From a4277d19a60f1611658897c18d2548fedf52e8f5 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Fri, 6 Mar 2020 22:39:25 -0500 Subject: remove stub --- bin/build-python | 4 -- lib/inx/utils.py | 17 ++++++-- stub.py | 69 -------------------------------- templates/auto_satin.inx | 2 +- templates/convert_to_satin.inx | 2 +- templates/cut_satin.inx | 2 +- templates/embroider.inx | 2 +- templates/flip.inx | 2 +- templates/global_commands.inx | 2 +- templates/input.inx | 2 +- templates/install.inx | 2 +- templates/layer_commands.inx | 2 +- templates/lettering.inx | 2 +- templates/object_commands.inx | 2 +- templates/output.inx | 2 +- templates/params.inx | 2 +- templates/print.inx | 2 +- templates/remove_embroidery_settings.inx | 2 +- templates/simulate.inx | 2 +- templates/troubleshoot.inx | 2 +- templates/zip.inx | 2 +- 21 files changed, 32 insertions(+), 94 deletions(-) delete mode 100644 stub.py diff --git a/bin/build-python b/bin/build-python index 69058593..6c4810dc 100755 --- a/bin/build-python +++ b/bin/build-python @@ -55,7 +55,3 @@ mv dist/bin dist/inkstitch if [ "$BUILD" = "osx" ]; then rm -rf dist/inkstitch.app/ fi - -# 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/lib/inx/utils.py b/lib/inx/utils.py index 1dc96829..a7c98a60 100644 --- a/lib/inx/utils.py +++ b/lib/inx/utils.py @@ -1,11 +1,12 @@ import errno -import os import gettext +import os +import sys from os.path import dirname -from jinja2 import Environment, FileSystemLoader -from ..i18n import translation as default_translation, locale_dir, N_ +from jinja2 import Environment, FileSystemLoader +from ..i18n import N_, locale_dir, translation as default_translation _top_path = dirname(dirname(dirname(os.path.realpath(__file__)))) inx_path = os.path.join(_top_path, "inx") @@ -25,6 +26,16 @@ def build_environment(): env.install_gettext_translations(current_translation) env.globals["locale"] = current_locale + if "BUILD" in os.environ: + # building a ZIP release, with inkstitch packaged as a binary + if sys.platform == "win32": + env.globals["command_tag"] = 'inkstitch/bin/inkstitch.exe' + else: + env.globals["command_tag"] = 'inkstitch/bin/inkstitch' + else: + # user is running inkstitch.py directly as a developer + env.globals["command_tag"] = 'inkstitch.py' + return env diff --git a/stub.py b/stub.py deleted file mode 100644 index c4627891..00000000 --- a/stub.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env python - -import os -import subprocess -import sys -import traceback - -# 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.execve works here for Linux, but only this seems to get the -# extension output to Inkscape on Windows -try: - extension = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - stdout, stderr = extension.communicate() -except BaseException: - print >> sys.stderr, "Unexpected error launching Ink/Stitch." - print >> sys.stderr, "If you're having trouble, please file an issue here, including the text below:" - print >> sys.stderr, " https://github.com/inkstitch/inkstitch/issues\n" - print >> sys.stderr, "Tried to launch:", binary_path - print >> sys.stderr, "Arguments:", args - print >> sys.stderr, "Debugging information:\n" - print >> sys.stderr, traceback.format_exc() - sys.exit(1) - -if sys.platform == "win32": - import msvcrt - - msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) - -try: - # In Python 3, we need to use sys.stdout.buffer to write binary data to stdout. - sys.stdout.buffer.write(stdout) - sys.stdout.buffer.flush() -except AttributeError: - # Python 2 doesn't have sys.stdout.buffer but we can write binary data to stdout by default. - sys.stdout.write(stdout) - sys.stdout.flush() - -stderr = stderr.strip() -if stderr: - try: - sys.stderr.buffer.write(stderr) - sys.stderr.buffer.flush() - except AttributeError: - sys.stderr.write(stderr) - sys.stderr.flush() - -sys.exit(extension.returncode) diff --git a/templates/auto_satin.inx b/templates/auto_satin.inx index 60ca29cd..5830d599 100644 --- a/templates/auto_satin.inx +++ b/templates/auto_satin.inx @@ -16,6 +16,6 @@ diff --git a/templates/convert_to_satin.inx b/templates/convert_to_satin.inx index d0f87911..d09b2fc2 100644 --- a/templates/convert_to_satin.inx +++ b/templates/convert_to_satin.inx @@ -14,6 +14,6 @@ diff --git a/templates/cut_satin.inx b/templates/cut_satin.inx index c96d9092..8705e28a 100644 --- a/templates/cut_satin.inx +++ b/templates/cut_satin.inx @@ -14,6 +14,6 @@ diff --git a/templates/embroider.inx b/templates/embroider.inx index f030c8d6..7a7c0e59 100644 --- a/templates/embroider.inx +++ b/templates/embroider.inx @@ -23,6 +23,6 @@ diff --git a/templates/flip.inx b/templates/flip.inx index 763cf7cc..5440caa3 100644 --- a/templates/flip.inx +++ b/templates/flip.inx @@ -14,6 +14,6 @@ diff --git a/templates/global_commands.inx b/templates/global_commands.inx index 24d42c90..d55f77bd 100644 --- a/templates/global_commands.inx +++ b/templates/global_commands.inx @@ -19,6 +19,6 @@ diff --git a/templates/input.inx b/templates/input.inx index 6e810a70..b2db4563 100644 --- a/templates/input.inx +++ b/templates/input.inx @@ -12,6 +12,6 @@ input diff --git a/templates/install.inx b/templates/install.inx index adfffd9d..431bcb89 100644 --- a/templates/install.inx +++ b/templates/install.inx @@ -12,6 +12,6 @@ diff --git a/templates/layer_commands.inx b/templates/layer_commands.inx index 6b978e43..4f586363 100644 --- a/templates/layer_commands.inx +++ b/templates/layer_commands.inx @@ -18,6 +18,6 @@ diff --git a/templates/lettering.inx b/templates/lettering.inx index 96e90ca0..3b0c3049 100644 --- a/templates/lettering.inx +++ b/templates/lettering.inx @@ -12,6 +12,6 @@ diff --git a/templates/object_commands.inx b/templates/object_commands.inx index 1b1c40d9..2e973789 100644 --- a/templates/object_commands.inx +++ b/templates/object_commands.inx @@ -17,6 +17,6 @@ diff --git a/templates/output.inx b/templates/output.inx index 6899c5d3..9f92ef71 100644 --- a/templates/output.inx +++ b/templates/output.inx @@ -16,6 +16,6 @@ {% set params = "output_params_" + format + ".xml" %} {% include params ignore missing %} diff --git a/templates/params.inx b/templates/params.inx index 9f60f4ae..19e24cbe 100644 --- a/templates/params.inx +++ b/templates/params.inx @@ -12,6 +12,6 @@ diff --git a/templates/print.inx b/templates/print.inx index 61385129..d9d59ef3 100644 --- a/templates/print.inx +++ b/templates/print.inx @@ -12,6 +12,6 @@ diff --git a/templates/remove_embroidery_settings.inx b/templates/remove_embroidery_settings.inx index d070f34f..a68ba724 100644 --- a/templates/remove_embroidery_settings.inx +++ b/templates/remove_embroidery_settings.inx @@ -19,6 +19,6 @@ diff --git a/templates/simulate.inx b/templates/simulate.inx index 90f3717c..7cab9850 100644 --- a/templates/simulate.inx +++ b/templates/simulate.inx @@ -12,6 +12,6 @@ diff --git a/templates/troubleshoot.inx b/templates/troubleshoot.inx index 6931fb39..29b72a17 100644 --- a/templates/troubleshoot.inx +++ b/templates/troubleshoot.inx @@ -13,6 +13,6 @@ diff --git a/templates/zip.inx b/templates/zip.inx index 952123c9..4a24096d 100644 --- a/templates/zip.inx +++ b/templates/zip.inx @@ -16,6 +16,6 @@ {% endfor %} zip -- cgit v1.2.3 From 0c166e09bd6587728b87130ce5b611983745d2cc Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Fri, 6 Mar 2020 23:22:00 -0500 Subject: remove unnecessary dependency tags --- templates/auto_satin.inx | 2 -- templates/convert_to_satin.inx | 2 -- templates/cut_satin.inx | 2 -- templates/embroider.inx | 2 -- templates/flip.inx | 2 -- templates/global_commands.inx | 2 -- templates/input.inx | 2 -- templates/install.inx | 2 -- templates/layer_commands.inx | 2 -- templates/lettering.inx | 2 -- templates/object_commands.inx | 2 -- templates/output.inx | 2 -- templates/params.inx | 2 -- templates/print.inx | 2 -- templates/remove_embroidery_settings.inx | 2 -- templates/simulate.inx | 2 -- templates/troubleshoot.inx | 2 -- templates/zip.inx | 2 -- 18 files changed, 36 deletions(-) diff --git a/templates/auto_satin.inx b/templates/auto_satin.inx index 5830d599..673ac51e 100644 --- a/templates/auto_satin.inx +++ b/templates/auto_satin.inx @@ -2,8 +2,6 @@ {% trans %}Auto-Route Satin Columns{% endtrans %} org.inkstitch.auto_satin.{{ locale }} - inkstitch.py - inkex.py true false auto_satin diff --git a/templates/convert_to_satin.inx b/templates/convert_to_satin.inx index d09b2fc2..80f0b678 100644 --- a/templates/convert_to_satin.inx +++ b/templates/convert_to_satin.inx @@ -2,8 +2,6 @@ {% trans %}Convert Line to Satin{% endtrans %} org.inkstitch.convert_to_satin.{{ locale }} - inkstitch.py - inkex.py convert_to_satin all diff --git a/templates/cut_satin.inx b/templates/cut_satin.inx index 8705e28a..b780543a 100644 --- a/templates/cut_satin.inx +++ b/templates/cut_satin.inx @@ -2,8 +2,6 @@ {% trans %}Cut Satin Column{% endtrans %} org.inkstitch.cut_satin.{{ locale }} - inkstitch.py - inkex.py cut_satin all diff --git a/templates/embroider.inx b/templates/embroider.inx index 7a7c0e59..ea062aa4 100644 --- a/templates/embroider.inx +++ b/templates/embroider.inx @@ -2,8 +2,6 @@ {% trans %}Embroider{% endtrans %} org.inkstitch.embroider.{{ locale }} - inkstitch.py - inkex.py 3.0 true diff --git a/templates/flip.inx b/templates/flip.inx index 5440caa3..29b11457 100644 --- a/templates/flip.inx +++ b/templates/flip.inx @@ -2,8 +2,6 @@ {% trans %}Flip Satin Column Rails{% endtrans %} org.inkstitch.flip_satins.{{ locale }} - inkstitch.py - inkex.py flip all diff --git a/templates/global_commands.inx b/templates/global_commands.inx index d55f77bd..d37e2e41 100644 --- a/templates/global_commands.inx +++ b/templates/global_commands.inx @@ -2,8 +2,6 @@ {% trans %}Add Commands{% endtrans %} org.inkstitch.global_commands.{{ locale }} - inkstitch.py - inkex.py {% trans %}These commands affect the entire embroidery design.{% endtrans %} {% for command, description in global_commands %} false diff --git a/templates/input.inx b/templates/input.inx index b2db4563..5f4a4610 100644 --- a/templates/input.inx +++ b/templates/input.inx @@ -2,8 +2,6 @@ {{ format | upper }} file input org.inkstitch.input.{{ format }}.{{ locale }} - inkstitch.py - inkex.py .{{ format }} application/x-embroidery-{{ format }} diff --git a/templates/install.inx b/templates/install.inx index 431bcb89..0ab22b0b 100644 --- a/templates/install.inx +++ b/templates/install.inx @@ -2,8 +2,6 @@ {% trans %}Install add-ons for Inkscape{% endtrans %} org.inkstitch.install.{{ locale }} - inkstitch.py - inkex.py install all diff --git a/templates/layer_commands.inx b/templates/layer_commands.inx index 4f586363..249d536e 100644 --- a/templates/layer_commands.inx +++ b/templates/layer_commands.inx @@ -2,8 +2,6 @@ {% trans %}Add Layer Commands{% endtrans %} org.inkstitch.layer_commands.{{ locale }} - inkstitch.py - inkex.py {% trans %}Commands will be added to the currently-selected layer.{% endtrans %} {% for command, description in layer_commands %} false diff --git a/templates/lettering.inx b/templates/lettering.inx index 3b0c3049..65eee8a1 100644 --- a/templates/lettering.inx +++ b/templates/lettering.inx @@ -2,8 +2,6 @@ {% trans %}Lettering{% endtrans %} org.inkstitch.lettering.{{ locale }} - inkstitch.py - inkex.py lettering all diff --git a/templates/object_commands.inx b/templates/object_commands.inx index 2e973789..affe7584 100644 --- a/templates/object_commands.inx +++ b/templates/object_commands.inx @@ -2,8 +2,6 @@ {% trans %}Attach Commands to Selected Objects{% endtrans %} org.inkstitch.commands.{{ locale }} - inkstitch.py - inkex.py {% for command, description in object_commands %} false {% endfor %} diff --git a/templates/output.inx b/templates/output.inx index 9f92ef71..ffff4be9 100644 --- a/templates/output.inx +++ b/templates/output.inx @@ -2,8 +2,6 @@ {{ format | upper }} file output org.inkstitch.output.{{ format }}.{{ locale }} - inkstitch.py - inkex.py .{{ format }} application/x-embroidery-{{ format }} diff --git a/templates/params.inx b/templates/params.inx index 19e24cbe..a2dc89a3 100644 --- a/templates/params.inx +++ b/templates/params.inx @@ -2,8 +2,6 @@ {% trans %}Params{% endtrans %} org.inkstitch.params.{{ locale }} - inkstitch.py - inkex.py params all diff --git a/templates/print.inx b/templates/print.inx index d9d59ef3..2aec826b 100644 --- a/templates/print.inx +++ b/templates/print.inx @@ -2,8 +2,6 @@ {% trans %}Print / Realistic Preview{% endtrans %} org.inkstitch.print.{{ locale }} - inkstitch.py - inkex.py print all diff --git a/templates/remove_embroidery_settings.inx b/templates/remove_embroidery_settings.inx index a68ba724..44b34ded 100644 --- a/templates/remove_embroidery_settings.inx +++ b/templates/remove_embroidery_settings.inx @@ -2,8 +2,6 @@ {% trans %}Remove embroidery settings{% endtrans %} org.inkstitch.remove_embroidery_settings.{{ locale }} - inkstitch.py - inkex.py {% trans %}Use this extension to remove the information Ink/Stitch has stored in your document. This can be especially useful if you copy and paste objects from an embroidery design into another document.{% endtrans %} true diff --git a/templates/simulate.inx b/templates/simulate.inx index 7cab9850..09f29d38 100644 --- a/templates/simulate.inx +++ b/templates/simulate.inx @@ -2,8 +2,6 @@ {% trans %}Simulate{% endtrans %} org.inkstitch.simulate.{{ locale }} - inkstitch.py - inkex.py simulate all diff --git a/templates/troubleshoot.inx b/templates/troubleshoot.inx index 29b72a17..64f4ebb0 100644 --- a/templates/troubleshoot.inx +++ b/templates/troubleshoot.inx @@ -2,8 +2,6 @@ {% trans %}Troubleshoot Objects{% endtrans %} org.inkstitch.troubleshoot.{{ locale }} - inkstitch.py - inkex.py troubleshoot all diff --git a/templates/zip.inx b/templates/zip.inx index 4a24096d..485e3f1b 100644 --- a/templates/zip.inx +++ b/templates/zip.inx @@ -2,8 +2,6 @@ embroidery ZIP file output org.inkstitch.output.zip.{{ locale }} - inkstitch.py - inkex.py .zip application/zip -- cgit v1.2.3 From 07bb0dab98da3e06cb6bace27949dd291b0dd979 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sat, 14 Mar 2020 22:12:58 -0400 Subject: try no console window --- bin/build-python | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/build-python b/bin/build-python index 6c4810dc..6c4ad9ce 100755 --- a/bin/build-python +++ b/bin/build-python @@ -24,7 +24,7 @@ pyinstaller_args+="--hidden-import wx " # We need to use the precompiled bootloader linked with graphical Mac OS X # libraries if we develop a GUI application for Mac: -if [ "$BUILD" = "osx" ]; then +if [ "$BUILD" = "osx" -o "$BUILD" = "windows" ]; then pyinstaller_args+="--windowed " fi -- cgit v1.2.3