From b288f58057c7eed8af9e4a137b1c40d8b034aa00 Mon Sep 17 00:00:00 2001 From: Georges Khaznadar Date: Thu, 31 Oct 2019 15:05:10 +0100 Subject: [PATCH] modification to allow one to package boxes for Debian --- setup.py | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index 8523a45..680468d 100755 --- a/setup.py +++ b/setup.py @@ -45,17 +45,30 @@ class CustomBuildExtCommand(build_py): self.execute(self.updatePOT, ()) self.execute(self.generate_mo_files, ()) self.execute(self.buildInkscapeExt, ()) - try: - path = check_output(["inkscape", "-x"]).decode().strip() - if not os.access(path, os.W_OK): # Can we install globaly - # Not tested on Windows and Mac - path = os.path.expanduser("~/.config/inkscape/extensions") + + if 'FAKEROOTKEY' in os.environ: + # we are probably running under fakeroot + # so we are probably building a Debian package + # let us define a simple path! + path="/usr/share/inkscape/extensions" self.distribution.data_files.append( (path, [i for i in glob.glob(os.path.join("inkex", "*.inx"))])) self.distribution.data_files.append((path, ['scripts/boxes'])) - except CalledProcessError: - pass # Inkscape is not installed + else: + # we are surely not building a Debian package + # then here is the default behavior: + try: + path = check_output(["inkscape", "-x"]).decode().strip() + if not os.access(path, os.W_OK): # Can we install globaly + # Not tested on Windows and Mac + path = os.path.expanduser("~/.config/inkscape/extensions") + self.distribution.data_files.append( + (path, + [i for i in glob.glob(os.path.join("inkex", "*.inx"))])) + self.distribution.data_files.append((path, ['scripts/boxes'])) + except CalledProcessError: + pass # Inkscape is not installed build_py.run(self)