summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeandro Guedes <leandroguedes@protonmail.com>2021-11-18 18:29:06 -0300
committerLeandro Guedes <leandroguedes@protonmail.com>2021-11-18 18:29:06 -0300
commit77b4c2eee26edbe5bbd486cc685662ff3099a6f8 (patch)
tree30f9d4c537beb529f14228a1e220d3eef26cf872
parent2b2f11291565455e3ac29c73933f7a88a41e9390 (diff)
downloadadwaita-icon-theme-77b4c2eee26edbe5bbd486cc685662ff3099a6f8.tar.gz
Use system inkscape if flatpak version is not available
-rwxr-xr-xrender-icon-theme.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/render-icon-theme.py b/render-icon-theme.py
index 51a75ba4d..987f94bb1 100755
--- a/render-icon-theme.py
+++ b/render-icon-theme.py
@@ -8,6 +8,7 @@ import subprocess
OPTIPNG = '/usr/bin/optipng'
ZOPFLIPNG = '/usr/bin/zopflipng'
SRC = os.path.join('.', 'src', 'fullcolor')
+INKSCAPE_PREFIX = ['flatpak','run','org.inkscape.Inkscape']
inkscape_process = None
@@ -36,7 +37,8 @@ def wait_for_prompt(process, command=None):
def inkscape_render_rect(icon_file, rect, output_file):
#print("flatpak run org.inkscape.Inkscape --batch-process -i %s --export-type=png -o %s %s" % (rect, output_file,icon_file));
- subprocess.run(['flatpak','run','org.inkscape.Inkscape', '--batch-process', '-i', rect, '--export-type=png', '-o', output_file, icon_file])
+ commandline_sulfix = ['--batch-process', '-i', rect, '--export-type=png', '-o', output_file, icon_file]
+ subprocess.run(INKSCAPE_PREFIX + commandline_sulfix)
optimize_png(output_file)
class ContentHandler(xml.sax.ContentHandler):
@@ -140,6 +142,15 @@ class ContentHandler(xml.sax.ContentHandler):
def characters(self, chars):
self.chars += chars.strip()
+if subprocess.run(['flatpak', 'info', '--show-ref', 'org.inkscape.Inkscape']).returncode != 0:
+ try:
+ subprocess.run(['inkscape', '--version'])
+ except FileNotFoundError:
+ print("Inkscape is required for this script")
+ exit()
+
+ INKSCAPE_PREFIX = ['inkscape']
+
if len(sys.argv) == 1:
if not os.path.exists('Adwaita'):
os.mkdir('Adwaita')