modification to allow one to package boxes for Debian

This commit is contained in:
Georges Khaznadar 2019-10-31 15:05:10 +01:00 committed by Florian Festi
parent 715a2aca0b
commit b288f58057
1 changed files with 20 additions and 7 deletions

View File

@ -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)