kopia lustrzana https://github.com/inkstitch/inkstitch
remove stub
rodzic
7cc8b0c14e
commit
a4277d19a6
|
@ -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
|
||||
|
|
|
@ -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 ..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"] = '<command reldir="extensions">inkstitch/bin/inkstitch.exe</command>'
|
||||
else:
|
||||
env.globals["command_tag"] = '<command reldir="extensions">inkstitch/bin/inkstitch</command>'
|
||||
else:
|
||||
# user is running inkstitch.py directly as a developer
|
||||
env.globals["command_tag"] = '<command reldir="extensions" interpreter="python">inkstitch.py</command>'
|
||||
|
||||
return env
|
||||
|
||||
|
||||
|
|
69
stub.py
69
stub.py
|
@ -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)
|
|
@ -16,6 +16,6 @@
|
|||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
<command reldir="extensions" interpreter="python">inkstitch.py</command>
|
||||
{{ command_tag | safe }}
|
||||
</script>
|
||||
</inkscape-extension>
|
||||
|
|
|
@ -14,6 +14,6 @@
|
|||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
<command reldir="extensions" interpreter="python">inkstitch.py</command>
|
||||
{{ command_tag | safe }}
|
||||
</script>
|
||||
</inkscape-extension>
|
||||
|
|
|
@ -14,6 +14,6 @@
|
|||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
<command reldir="extensions" interpreter="python">inkstitch.py</command>
|
||||
{{ command_tag | safe }}
|
||||
</script>
|
||||
</inkscape-extension>
|
||||
|
|
|
@ -23,6 +23,6 @@
|
|||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
<command reldir="extensions" interpreter="python">inkstitch.py</command>
|
||||
{{ command_tag | safe }}
|
||||
</script>
|
||||
</inkscape-extension>
|
||||
|
|
|
@ -14,6 +14,6 @@
|
|||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
<command reldir="extensions" interpreter="python">inkstitch.py</command>
|
||||
{{ command_tag | safe }}
|
||||
</script>
|
||||
</inkscape-extension>
|
||||
|
|
|
@ -19,6 +19,6 @@
|
|||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
<command reldir="extensions" interpreter="python">inkstitch.py</command>
|
||||
{{ command_tag | safe }}
|
||||
</script>
|
||||
</inkscape-extension>
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
</input>
|
||||
<param name="extension" type="string" gui-hidden="true">input</param>
|
||||
<script>
|
||||
<command reldir="extensions" interpreter="python">inkstitch.py</command>
|
||||
{{ command_tag | safe }}
|
||||
</script>
|
||||
</inkscape-extension>
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
<command reldir="extensions" interpreter="python">inkstitch.py</command>
|
||||
{{ command_tag | safe }}
|
||||
</script>
|
||||
</inkscape-extension>
|
||||
|
|
|
@ -18,6 +18,6 @@
|
|||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
<command reldir="extensions" interpreter="python">inkstitch.py</command>
|
||||
{{ command_tag | safe }}
|
||||
</script>
|
||||
</inkscape-extension>
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
<command reldir="extensions" interpreter="python">inkstitch.py</command>
|
||||
{{ command_tag | safe }}
|
||||
</script>
|
||||
</inkscape-extension>
|
||||
|
|
|
@ -17,6 +17,6 @@
|
|||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
<command reldir="extensions" interpreter="python">inkstitch.py</command>
|
||||
{{ command_tag | safe }}
|
||||
</script>
|
||||
</inkscape-extension>
|
||||
|
|
|
@ -16,6 +16,6 @@
|
|||
{% set params = "output_params_" + format + ".xml" %}
|
||||
{% include params ignore missing %}
|
||||
<script>
|
||||
<command reldir="extensions" interpreter="python">inkstitch.py</command>
|
||||
{{ command_tag | safe }}
|
||||
</script>
|
||||
</inkscape-extension>
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
<command reldir="extensions" interpreter="python">inkstitch.py</command>
|
||||
{{ command_tag | safe }}
|
||||
</script>
|
||||
</inkscape-extension>
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
<command reldir="extensions" interpreter="python">inkstitch.py</command>
|
||||
{{ command_tag | safe }}
|
||||
</script>
|
||||
</inkscape-extension>
|
||||
|
|
|
@ -19,6 +19,6 @@
|
|||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
<command reldir="extensions" interpreter="python">inkstitch.py</command>
|
||||
{{ command_tag | safe }}
|
||||
</script>
|
||||
</inkscape-extension>
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
<command reldir="extensions" interpreter="python">inkstitch.py</command>
|
||||
{{ command_tag | safe }}
|
||||
</script>
|
||||
</inkscape-extension>
|
||||
|
|
|
@ -13,6 +13,6 @@
|
|||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
<command reldir="extensions" interpreter="python">inkstitch.py</command>
|
||||
{{ command_tag | safe }}
|
||||
</script>
|
||||
</inkscape-extension>
|
||||
|
|
|
@ -16,6 +16,6 @@
|
|||
{% endfor %}
|
||||
<param name="extension" type="string" gui-hidden="true">zip</param>
|
||||
<script>
|
||||
<command reldir="extensions" interpreter="python">inkstitch.py</command>
|
||||
{{ command_tag | safe }}
|
||||
</script>
|
||||
</inkscape-extension>
|
||||
|
|
Ładowanie…
Reference in New Issue