icon update: replace os.system w/ subprocess.check_call
[blender.git] / release / datafiles / prvicons_update.py
index ecc466aab72275f4cc03bec5f193a8bd7cccbba0..bc170b9854532202d53c4c24ac630f44917a3bf0 100755 (executable)
@@ -2,9 +2,22 @@
 
 # This script updates icons from the SVG file
 import os
+import subprocess
+import sys
 
-BASEDIR = os.path.abspath(os.path.dirname(__file__)) + os.sep
+BASEDIR = os.path.abspath(os.path.dirname(__file__))
 
-cmd = 'inkscape "%sprvicons.svg" --without-gui --export-png="%sprvicons.png"' % (BASEDIR, BASEDIR)
-os.system(cmd)
+inkscape_path = 'inkscape'
 
+if sys.platform == 'darwin':
+    inkscape_app_path = '/Applications/Inkscape.app/Contents/Resources/script'
+    if os.path.exists(inkscape_app_path):
+        inkscape_path = inkscape_app_path
+
+cmd = (
+    inkscape_path,
+    os.path.join(BASEDIR, "prvicons.svg"),
+    "--without-gui",
+    "--export-png=" + os.path.join(BASEDIR, "prvicons.png"),
+)
+subprocess.check_call(cmd)