Icons: Update script to generate icons from SVGs for Inkscape 1.0

The command line syntax for Inkscape changed quite a bit for the 1.0 release,
see https://wiki.inkscape.org/wiki/index.php/Release_notes/1.0#Command_Line.
Think it's reasonable to expect Inkscape 1.0 or later be installed if you want
to generate the icons with the script. It's easy to get via the website, if the
distribution doesn't provide new enough packages. Only few people would use the
script anyway.

I also had to change the path for command line access on macOS which apparently
changed (https://stackoverflow.com/a/60068607). Although I didn't find a
mention of this change in the Inkscape release notes.
This commit is contained in:
Julian Eisel 2021-01-08 14:58:29 +01:00
parent c66f00dc26
commit c549d736cf
2 changed files with 8 additions and 8 deletions

@ -17,7 +17,7 @@ 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/Resources/script'
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'
@ -29,8 +29,8 @@ cmd = (
os.path.join(BASEDIR, "blender_icons.svg"),
"--export-width=602",
"--export-height=640",
"--without-gui",
"--export-png=" + os.path.join(BASEDIR, "blender_icons16.png"),
"--export-type=png",
"--export-filename=" + os.path.join(BASEDIR, "blender_icons16.png"),
)
run(cmd)
@ -39,8 +39,8 @@ cmd = (
os.path.join(BASEDIR, "blender_icons.svg"),
"--export-width=1204",
"--export-height=1280",
"--without-gui",
"--export-png=" + os.path.join(BASEDIR, "blender_icons32.png"),
"--export-type=png",
"--export-filename=" + os.path.join(BASEDIR, "blender_icons32.png"),
)
run(cmd)

@ -10,7 +10,7 @@ BASEDIR = os.path.abspath(os.path.dirname(__file__))
inkscape_path = 'inkscape'
if sys.platform == 'darwin':
inkscape_app_path = '/Applications/Inkscape.app/Contents/Resources/script'
inkscape_app_path = '/Applications/Inkscape.app/Contents/MacOS/inkscape'
if os.path.exists(inkscape_app_path):
inkscape_path = inkscape_app_path
@ -19,7 +19,7 @@ cmd = (
os.path.join(BASEDIR, "prvicons.svg"),
"--export-width=1792",
"--export-height=256",
"--without-gui",
"--export-png=" + os.path.join(BASEDIR, "prvicons.png"),
"--export-type=png",
"--export-filename=" + os.path.join(BASEDIR, "prvicons.png"),
)
subprocess.check_call(cmd)