build: allow running image scripts from base directory (#71292)
This commit is contained in:
parent
8e61577d66
commit
5b4e750b7c
|
@ -23,7 +23,8 @@ import subprocess
|
|||
import sys
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
inkscape = os.path.abspath(os.path.join(os.path.dirname(__file__), 'inkscape_wrapper.py'))
|
||||
base_dir = os.path.dirname(__file__)
|
||||
inkscape = os.path.abspath(os.path.join(base_dir, 'inkscape_wrapper.py'))
|
||||
|
||||
names = {
|
||||
'02': 'famille',
|
||||
|
@ -103,7 +104,7 @@ for filename in filenames:
|
|||
|
||||
fd = open('tmp-%s.svg' % outname, 'w')
|
||||
fd.write(
|
||||
open(os.path.join('pictos', filename))
|
||||
open(os.path.join(base_dir, 'pictos', filename))
|
||||
.read()
|
||||
.replace('E0037A', args.primary)
|
||||
.replace('6D1F80', args.secondary)
|
||||
|
@ -123,7 +124,7 @@ for filename in filenames:
|
|||
]
|
||||
)
|
||||
|
||||
tree = ET.parse(open(os.path.join('pictos', filename)))
|
||||
tree = ET.parse(open(os.path.join(base_dir, 'pictos', filename)))
|
||||
parent_map = {c: p for p in tree.iter() for c in p}
|
||||
for i in range(10):
|
||||
for node in tree.iter():
|
||||
|
|
|
@ -24,6 +24,7 @@ import sys
|
|||
import tempfile
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
base_dir = os.path.dirname(__file__)
|
||||
inkscape = os.path.abspath(os.path.join(os.path.dirname(__file__), 'inkscape_wrapper.py'))
|
||||
|
||||
names = {
|
||||
|
@ -82,7 +83,7 @@ for filename in filenames:
|
|||
variant_colour = variant_data.get('colour')
|
||||
variant_height = variant_data.get('height')
|
||||
variant_width = variant_data.get('width')
|
||||
tree = ET.parse(open(os.path.join('pictos', filename)))
|
||||
tree = ET.parse(open(os.path.join(base_dir, 'pictos', filename)))
|
||||
if variant_name:
|
||||
out_filepath = os.path.join(path_out, '%s-%s.png' % (icon_name, variant_name))
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue