build: do not recreate images in install phase (#88254)
gitea/publik-base-theme/pipeline/head This commit looks good
Details
gitea/publik-base-theme/pipeline/head This commit looks good
Details
This commit is contained in:
parent
98aaf3925f
commit
2cb381c814
3
setup.py
3
setup.py
|
@ -162,6 +162,9 @@ class build_icons(Command):
|
|||
'python3 src/render-imgs-dashboard.py static/somme-cd80/img/ --normal 4D4D4D '
|
||||
'--selected 87A738 --title FFFFFF --title-width 80',
|
||||
]
|
||||
if self.distribution.commands == ['install']:
|
||||
cmds = [f'{x} --skip-existing' for x in cmds]
|
||||
|
||||
if not os.path.exists('static/tournai/img'):
|
||||
os.mkdir('static/tournai/img')
|
||||
for image in glob.glob('static/tournai/assets/*.svg'):
|
||||
|
|
|
@ -92,6 +92,7 @@ parser = argparse.ArgumentParser()
|
|||
parser.add_argument('path', help='out path')
|
||||
parser.add_argument('--primary', default='E0037A')
|
||||
parser.add_argument('--secondary', default='6D1F80')
|
||||
parser.add_argument('--skip-existing', action='store_true')
|
||||
|
||||
args = parser.parse_args()
|
||||
path_out = args.path
|
||||
|
@ -100,6 +101,12 @@ os.makedirs(path_out, exist_ok=True)
|
|||
|
||||
for filename in filenames:
|
||||
outname = names.get(re.search(r'\d+', filename).group())
|
||||
if (
|
||||
args.skip_existing
|
||||
and os.path.exists(os.path.join(path_out, '%s.png' % outname))
|
||||
and os.path.exists(os.path.join(path_out, '%s-on.png' % outname))
|
||||
):
|
||||
continue
|
||||
|
||||
fd = open('tmp-%s.svg' % outname, 'w')
|
||||
fd.write(
|
||||
|
|
|
@ -56,6 +56,7 @@ parser.add_argument('--selected-width')
|
|||
parser.add_argument('--title')
|
||||
parser.add_argument('--title-height')
|
||||
parser.add_argument('--title-width')
|
||||
parser.add_argument('--skip-existing', action='store_true')
|
||||
|
||||
args = parser.parse_args()
|
||||
path_out = args.path
|
||||
|
@ -88,6 +89,9 @@ for filename in filenames:
|
|||
else:
|
||||
out_filepath = os.path.join(path_out, '%s.png' % icon_name)
|
||||
|
||||
if args.skip_existing and os.path.exists(out_filepath):
|
||||
continue
|
||||
|
||||
for node in tree.iter():
|
||||
tag_name = node.tag.split('}')[-1]
|
||||
if tag_name == 'path':
|
||||
|
|
Loading…
Reference in New Issue