[Bf-blender-cvs] [65c36dc5837] soc-2021-uv-editor-improvements: Icons: resolve various issues for generating icons

Campbell Barton noreply at git.blender.org
Mon Aug 9 03:24:37 CEST 2021


Commit: 65c36dc5837c84659955e77e844baf432cfc784b
Author: Campbell Barton
Date:   Wed Aug 4 11:31:28 2021 +1000
Branches: soc-2021-uv-editor-improvements
https://developer.blender.org/rB65c36dc5837c84659955e77e844baf432cfc784b

Icons: resolve various issues for generating icons

- INKSCAPE_BIN environment variable was ignored by
  alert_icons_update & prvicons_update.
- `make icons` wasn't regenerating alert icons.
- Updating SVG icons failed using blender built with ASAN.

===================================================================

M	GNUmakefile
M	release/datafiles/alert_icons_update.py
M	release/datafiles/blender_icons_geom_update.py
M	release/datafiles/blender_icons_update.py
M	release/datafiles/prvicons_update.py

===================================================================

diff --git a/GNUmakefile b/GNUmakefile
index 7df561ed34f..635cc321d03 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -528,8 +528,10 @@ INKSCAPE_BIN?="inkscape"
 icons: .FORCE
 	BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \
 		"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
-	BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \
+	INKSCAPE_BIN=$(INKSCAPE_BIN) \
 		"$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
+	INKSCAPE_BIN=$(INKSCAPE_BIN) \
+		"$(BLENDER_DIR)/release/datafiles/alert_icons_update.py"
 
 icons_geom: .FORCE
 	BLENDER_BIN=$(BLENDER_BIN) \
diff --git a/release/datafiles/alert_icons_update.py b/release/datafiles/alert_icons_update.py
old mode 100644
new mode 100755
index 95e4ee7afbb..a3951c114ae
--- a/release/datafiles/alert_icons_update.py
+++ b/release/datafiles/alert_icons_update.py
@@ -7,15 +7,15 @@ import sys
 
 BASEDIR = os.path.abspath(os.path.dirname(__file__))
 
-inkscape_path = 'inkscape'
+inkscape_bin = os.environ.get("INKSCAPE_BIN", "inkscape")
 
 if sys.platform == 'darwin':
     inkscape_app_path = '/Applications/Inkscape.app/Contents/MacOS/inkscape'
     if os.path.exists(inkscape_app_path):
-        inkscape_path = inkscape_app_path
+        inkscape_bin = inkscape_app_path
 
 cmd = (
-    inkscape_path,
+    inkscape_bin,
     os.path.join(BASEDIR, "alert_icons.svg"),
     "--export-width=1280",
     "--export-height=256",
diff --git a/release/datafiles/blender_icons_geom_update.py b/release/datafiles/blender_icons_geom_update.py
index 5b95961ae6b..d5373d6b2e9 100755
--- a/release/datafiles/blender_icons_geom_update.py
+++ b/release/datafiles/blender_icons_geom_update.py
@@ -6,10 +6,9 @@ import subprocess
 import sys
 
 
-def run(cmd):
+def run(cmd, *, env=None):
     print("   ", " ".join(cmd))
-    # Don't use check_call because asan causes nonzero exitcode :S
-    subprocess.call(cmd)
+    subprocess.check_call(cmd, env=env)
 
 
 def edit_text_file(filename, marker_begin, marker_end, content):
@@ -73,7 +72,12 @@ for blend in icons_blend:
         "--group", "Export",
         "--output-dir", output_dir,
     )
-    run(cmd)
+
+    env = {}
+    # Developers may have ASAN enabled, avoid non-zero exit codes.
+    env["ASAN_OPTIONS"] = "exitcode=0:" + os.environ.get("ASAN_OPTIONS", "")
+
+    run(cmd, env=env)
     files_new = set(names_and_time_from_path(output_dir))
 
     icon_files.extend([
diff --git a/release/datafiles/blender_icons_update.py b/release/datafiles/blender_icons_update.py
index 8167b8b25e6..ead74aac759 100755
--- a/release/datafiles/blender_icons_update.py
+++ b/release/datafiles/blender_icons_update.py
@@ -6,13 +6,17 @@ import subprocess
 import sys
 
 
-def run(cmd):
+def run(cmd, *, env=None):
     print("   ", " ".join(cmd))
-    subprocess.check_call(cmd)
+    subprocess.check_call(cmd, env=env)
 
 
 BASEDIR = os.path.abspath(os.path.dirname(__file__))
 
+env = {}
+# Developers may have ASAN enabled, avoid non-zero exit codes.
+env["ASAN_OPTIONS"] = "exitcode=0:" + os.environ.get("ASAN_OPTIONS", "")
+
 inkscape_bin = os.environ.get("INKSCAPE_BIN", "inkscape")
 blender_bin = os.environ.get("BLENDER_BIN", "blender")
 
@@ -32,7 +36,7 @@ cmd = (
     "--export-type=png",
     "--export-filename=" + os.path.join(BASEDIR, "blender_icons16.png"),
 )
-run(cmd)
+run(cmd, env=env)
 
 cmd = (
     inkscape_bin,
@@ -42,7 +46,7 @@ cmd = (
     "--export-type=png",
     "--export-filename=" + os.path.join(BASEDIR, "blender_icons32.png"),
 )
-run(cmd)
+run(cmd, env=env)
 
 
 # For testing it can be good to clear all old
@@ -64,7 +68,7 @@ cmd = (
     "--minx_icon", "2", "--maxx_icon", "2", "--miny_icon", "2", "--maxy_icon", "2",
     "--spacex_icon", "1", "--spacey_icon", "1",
 )
-run(cmd)
+run(cmd, env=env)
 
 cmd = (
     blender_bin, "--background", "--factory-startup", "-noaudio",
@@ -78,7 +82,7 @@ cmd = (
     "--minx_icon", "4", "--maxx_icon", "4", "--miny_icon", "4", "--maxy_icon", "4",
     "--spacex_icon", "2", "--spacey_icon", "2",
 )
-run(cmd)
+run(cmd, env=env)
 
 os.remove(os.path.join(BASEDIR, "blender_icons16.png"))
 os.remove(os.path.join(BASEDIR, "blender_icons32.png"))
diff --git a/release/datafiles/prvicons_update.py b/release/datafiles/prvicons_update.py
index fa526f88e96..c9bd8b44301 100755
--- a/release/datafiles/prvicons_update.py
+++ b/release/datafiles/prvicons_update.py
@@ -7,15 +7,15 @@ import sys
 
 BASEDIR = os.path.abspath(os.path.dirname(__file__))
 
-inkscape_path = 'inkscape'
+inkscape_bin = os.environ.get("INKSCAPE_BIN", "inkscape")
 
 if sys.platform == 'darwin':
     inkscape_app_path = '/Applications/Inkscape.app/Contents/MacOS/inkscape'
     if os.path.exists(inkscape_app_path):
-        inkscape_path = inkscape_app_path
+        inkscape_bin = inkscape_app_path
 
 cmd = (
-    inkscape_path,
+    inkscape_bin,
     os.path.join(BASEDIR, "prvicons.svg"),
     "--export-width=1792",
     "--export-height=256",



More information about the Bf-blender-cvs mailing list