From 7c9c916b025a6f799a5c4525c5d21d551e27db58 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 24 Jan 2024 18:45:42 +0100 Subject: [PATCH] Build: improve make icons detection of Inkscape and Blender on macOS Respect INKSCAPE_BIN and BLENDER_BIN environment variables if set, make expected Inkscape path show when missing, simplify code. --- GNUmakefile | 10 +++------- release/datafiles/alert_icons_update.py | 9 ++++----- release/datafiles/blender_icons_update.py | 17 +++++------------ release/datafiles/prvicons_update.py | 9 ++++----- 4 files changed, 16 insertions(+), 29 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 9492275a32d..814396f91b1 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -570,14 +570,10 @@ source_archive_complete: .FORCE # This assumes CMake is still using a default `PACKAGE_DIR` variable: @$(PYTHON) ./build_files/utils/make_source_archive.py --include-packages "$(BUILD_DIR)/source_archive/packages" -INKSCAPE_BIN?="inkscape" icons: .FORCE - @BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \ - "$(BLENDER_DIR)/release/datafiles/blender_icons_update.py" - @INKSCAPE_BIN=$(INKSCAPE_BIN) \ - "$(BLENDER_DIR)/release/datafiles/prvicons_update.py" - @INKSCAPE_BIN=$(INKSCAPE_BIN) \ - "$(BLENDER_DIR)/release/datafiles/alert_icons_update.py" + @BLENDER_BIN=$(BLENDER_BIN) "$(BLENDER_DIR)/release/datafiles/blender_icons_update.py" + "$(BLENDER_DIR)/release/datafiles/prvicons_update.py" + "$(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 index 22db0e38637..29286cb01b7 100755 --- a/release/datafiles/alert_icons_update.py +++ b/release/datafiles/alert_icons_update.py @@ -10,12 +10,11 @@ import sys BASEDIR = os.path.abspath(os.path.dirname(__file__)) -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_bin = inkscape_app_path + inkscape_bin = '/Applications/Inkscape.app/Contents/MacOS/inkscape' +else: + inkscape_bin = "inkscape" +inkscape_bin = os.environ.get("INKSCAPE_BIN", inkscape_bin) cmd = ( inkscape_bin, diff --git a/release/datafiles/blender_icons_update.py b/release/datafiles/blender_icons_update.py index f8a7aa914b7..7961d60beb8 100755 --- a/release/datafiles/blender_icons_update.py +++ b/release/datafiles/blender_icons_update.py @@ -26,19 +26,12 @@ if sys.platform[:3] == "win": env["SystemDrive"] = os.environ.get("SystemDrive", "") env["SystemRoot"] = os.environ.get("SystemRoot", "") -inkscape_bin = os.environ.get("INKSCAPE_BIN", "inkscape") -blender_bin = os.environ.get("BLENDER_BIN", "blender") - if sys.platform == 'darwin': - inkscape_app_path = '/Applications/Inkscape.app/Contents/MacOS/inkscape' - if os.path.exists(inkscape_app_path): - inkscape_bin = inkscape_app_path - blender_app_path = '/Applications/Blender.app/Contents/MacOS/Blender' - if os.path.exists(blender_app_path): - blender_bin = blender_app_path - else: - blender_bin = "Blender" - + inkscape_bin = '/Applications/Inkscape.app/Contents/MacOS/inkscape' +else: + inkscape_bin = "inkscape" +inkscape_bin = os.environ.get("INKSCAPE_BIN", inkscape_bin) +blender_bin = os.environ.get("BLENDER_BIN", "blender") cmd = ( inkscape_bin, diff --git a/release/datafiles/prvicons_update.py b/release/datafiles/prvicons_update.py index 42fef9c1f1e..762b06bbcf2 100755 --- a/release/datafiles/prvicons_update.py +++ b/release/datafiles/prvicons_update.py @@ -10,12 +10,11 @@ import sys BASEDIR = os.path.abspath(os.path.dirname(__file__)) -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_bin = inkscape_app_path + inkscape_bin = '/Applications/Inkscape.app/Contents/MacOS/inkscape' +else: + inkscape_bin = "inkscape" +inkscape_bin = os.environ.get("INKSCAPE_BIN", inkscape_bin) cmd = ( inkscape_bin,