summaryrefslogtreecommitdiff
path: root/render-icon-theme.py
diff options
context:
space:
mode:
authorJakub Steiner <jimmac@gmail.com>2021-11-23 22:28:13 +0000
committerJakub Steiner <jimmac@gmail.com>2021-11-23 22:28:13 +0000
commit320b0efff2e1681159a2835047ac164b2cac040c (patch)
tree8fb48ecec0d0b00d7ac6d1871fe32ca49be92fbd /render-icon-theme.py
parentaf58eb1167e9ce57b43749590f5321e1372aaa16 (diff)
parentbcc99dd2a883c5d22f7580ff166a3dd23a3cf0b6 (diff)
downloadadwaita-icon-theme-320b0efff2e1681159a2835047ac164b2cac040c.tar.gz
Merge branch 'render-script' into 'master'
Use system inkscape if flatpak version is not available See merge request GNOME/adwaita-icon-theme!35
Diffstat (limited to 'render-icon-theme.py')
-rwxr-xr-xrender-icon-theme.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/render-icon-theme.py b/render-icon-theme.py
index 51a75ba4d..d9e8e5a96 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_CMD = ['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])
+ inkscape_args = ['--batch-process', '-i', rect, '--export-type=png', '-o', output_file, icon_file]
+ subprocess.run(INKSCAPE_CMD + inkscape_args)
optimize_png(output_file)
class ContentHandler(xml.sax.ContentHandler):
@@ -140,6 +142,14 @@ 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:
+ sys.exit("Inkscape is required for this script")
+
+ INKSCAPE_CMD = ['inkscape']
+
if len(sys.argv) == 1:
if not os.path.exists('Adwaita'):
os.mkdir('Adwaita')