Code

Use Python script instead of shell script for .fig import (fixes bug 240889).
authorsasilver <sasilver@users.sourceforge.net>
Fri, 27 Jun 2008 20:43:58 +0000 (20:43 +0000)
committersasilver <sasilver@users.sourceforge.net>
Fri, 27 Jun 2008 20:43:58 +0000 (20:43 +0000)
share/extensions/Makefile.am
share/extensions/fig2dev-ext.py [new file with mode: 0644]
share/extensions/fig2svg.sh [deleted file]
share/extensions/fig_input.inx

index 92a52847cf32ed4d84df65084a4bcbc4ea7f9f4b..24289b5bbbf597ad31c7279b009aa485f9c75879 100644 (file)
@@ -50,7 +50,7 @@ extensions = \
        export_gimp_palette.py \
        extractimage.py \
        ffgeom.py\
-       fig2svg.sh \
+       fig2dev-ext.py \
        flatten.py \
        fractalize.py \
        funcplot.py \
diff --git a/share/extensions/fig2dev-ext.py b/share/extensions/fig2dev-ext.py
new file mode 100644 (file)
index 0000000..0e32a94
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+"""
+fig2dev-ext.py
+Python script for running fig2dev in Inkscape extensions
+
+Copyright (C) 2008 Stephen Silver
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+"""
+
+import sys
+from run_command import run
+
+run('fig2dev -L svg "%s" "%%s"' % sys.argv[1].replace("%","%%"), "fig2dev")
+
+
+# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
diff --git a/share/extensions/fig2svg.sh b/share/extensions/fig2svg.sh
deleted file mode 100755 (executable)
index 81c6bc8..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#! /bin/sh
-rc=0
-TMPDIR="${TMPDIR-/tmp}"
-TEMPFILENAME=`mktemp 2>/dev/null || echo "$TMPDIR/tmp-fig$$.svg"`
-
-fig2dev -L svg "$1" "${TEMPFILENAME}" > /dev/null 2>&1 || rc=1
-
-cat < "${TEMPFILENAME}" || rc=1
-rm -f "${TEMPFILENAME}"
-exit $rc
index 5ef749bc6dfa2b610aeaaa925cdc594ef10f8aeb..8f0410221fe67059f3d95bfadc039d50d09baf20 100644 (file)
@@ -3,7 +3,7 @@
     <_name>XFIG Input</_name>
     <id>org.inkscape.input.fig</id>
     <dependency type="executable" location="path">fig2dev</dependency>
-    <dependency type="executable" location="extensions">fig2svg.sh</dependency>
+    <dependency type="executable" location="extensions">fig2dev-ext.py</dependency>
     <input>
         <extension>.fig</extension>
         <mimetype>image/x-xfig</mimetype>
@@ -12,6 +12,6 @@
         <output_extension>org.inkscape.output.fig</output_extension>
     </input>
     <script>
-        <command reldir="extensions">fig2svg.sh</command>
+        <command reldir="extensions" interpreter="python">fig2dev-ext.py</command>
     </script>
 </inkscape-extension>