diff --git a/inkscape_wrapper.py b/inkscape_wrapper.py new file mode 100755 index 0000000..b3ecf4e --- /dev/null +++ b/inkscape_wrapper.py @@ -0,0 +1,15 @@ +#! /usr/bin/env python3 +# inkscape wrapper to support command-line parameters for <1.0 and 1.0 +# versions. + +import subprocess +import sys + +inkscape_version = subprocess.check_output('inkscape --version', shell=True) +args = sys.argv[1:] +if b'Inkscape 0' not in inkscape_version: + # --export-png replaced by --export-filename + # --without-gui and --file removed + args = [x.replace('--export-png', '--export-filename') for x in args if x not in ('--without-gui', '--file')] + +sys.exit(subprocess.call(['inkscape'] + args)) diff --git a/setup.py b/setup.py index f001f97..f4865cc 100644 --- a/setup.py +++ b/setup.py @@ -17,6 +17,8 @@ from distutils.command.build import build as _build from distutils.command.sdist import sdist from setuptools import setup, find_packages +inkscape = os.path.abspath(os.path.join(os.path.dirname(__file__), 'inkscape_wrapper.py')) + class eo_sdist(sdist): def run(self): @@ -181,7 +183,7 @@ class build_icons(Command): f.write(ET.tostring(tree)) f.close() - subprocess.call(['inkscape', '--without-gui', + subprocess.call([inkscape, '--without-gui', '--file', f.name, '--export-area-drawing', '--export-area-snap',