From 42ab40da86363a673874039a6be3088a7d573716 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Sat, 25 Feb 2017 20:01:03 +0100 Subject: [PATCH] Build and ship inkscape inx files --- MANIFEST.in | 1 + inkex/inkscape.txt | 1 + setup.py | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 inkex/inkscape.txt diff --git a/MANIFEST.in b/MANIFEST.in index 9a626c4d9..f6a3044b9 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,4 @@ include README.txt LICENSE.txt include examples/*.svg include documentation/presentation.odp documentation/TODO.txt +include inkex/*.txt diff --git a/inkex/inkscape.txt b/inkex/inkscape.txt new file mode 100644 index 000000000..c4e47c504 --- /dev/null +++ b/inkex/inkscape.txt @@ -0,0 +1 @@ +Inkscape .inx files get generated here. diff --git a/setup.py b/setup.py index 8e084f7df..ad051f83f 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,24 @@ #!/usr/bin/env python3 from setuptools import setup, find_packages +from setuptools.command.build_py import build_py +import os +import glob + +class CustomBuildExtCommand(build_py): + """Customized setuptools install command - prints a friendly greeting.""" + + def buildInkscapeExt(self): + os.system("%s %s" % (os.path.join("scripts", "boxes2inkscape"), "inkex")) + + def run(self): + self.execute(self.buildInkscapeExt, ()) + if os.name == "posix": + if self.distribution.data_files is None: + self.distribution.data_files = [] + self.distribution.data_files.append( + ("/usr/share/inkscape/extensions/", [i for i in glob.glob(os.path.join("inkex", "*.inx"))])) + build_py.run(self) setup(name='boxes', version='0.1', @@ -11,6 +29,9 @@ packages=find_packages(), install_requires=['cairocffi'], scripts=['scripts/boxes', 'scripts/boxesserver'], + cmdclass={ + 'build_py': CustomBuildExtCommand, + }, classifiers=[ "Development Status :: 4 - Beta", "Environment :: Console",