forked from AuroraMiddleware/gtk
2ab9be54fb
It seems that Meson's gnome.compile_resources() cannot deal with two files with the same name under different directories, which breaks the build parallelism because the GResource file ends up not depending on either the Adwaita or the HighContrast gtk-contained.css file. This commit only changes the on-disk names of the Adwaita and HighContrast SCSS files, and the corresponding generated CSS files; the files in the GResource are going to be aliased to the old file names, to minimise the breakage. We might want to change the theme entry points at some later date, if we decide to commit to this naming scheme. Fixes: #2423 See Meson bug: https://github.com/mesonbuild/meson/issues/6615
86 lines
2.7 KiB
Python
86 lines
2.7 KiB
Python
#!/usr/bin/env python3
|
|
#
|
|
# Generate gtk.gresources.xml
|
|
#
|
|
# Usage: gen-gtk-gresources-xml SRCDIR_GTK [OUTPUT-FILE]
|
|
|
|
import os, sys
|
|
|
|
srcdir = sys.argv[1]
|
|
|
|
xml = '''<?xml version='1.0' encoding='UTF-8'?>
|
|
<gresources>
|
|
<gresource prefix='/org/gtk/libgtk'>
|
|
'''
|
|
|
|
def get_files(subdir,extension):
|
|
return sorted(filter(lambda x: x.endswith((extension)), os.listdir(os.path.join(srcdir,subdir))))
|
|
|
|
xml += '''
|
|
<file>theme/Empty/gtk.css</file>
|
|
<file>theme/Adwaita/gtk.css</file>
|
|
<file>theme/Adwaita/gtk-dark.css</file>
|
|
<file alias='theme/Adwaita/gtk-contained.css'>theme/Adwaita/Adwaita.css</file>
|
|
<file alias='theme/Adwaita/gtk-contained-dark.css'>theme/Adwaita/Adwaita-dark.css</file>
|
|
'''
|
|
|
|
for f in get_files('theme/Adwaita/assets', '.png'):
|
|
xml += ' <file>theme/Adwaita/assets/{0}</file>\n'.format(f)
|
|
|
|
xml += '\n'
|
|
|
|
for f in get_files('theme/Adwaita/assets', '.svg'):
|
|
xml += ' <file>theme/Adwaita/assets/{0}</file>\n'.format(f)
|
|
|
|
xml += '''
|
|
<file>theme/HighContrast/gtk.css</file>
|
|
<file alias='theme/HighContrastInverse/gtk.css'>theme/HighContrast/gtk-inverse.css</file>
|
|
<file alias='theme/HighContrast/gtk-contained.css'>theme/HighContrast/HighContrast.css</file>
|
|
<file alias='theme/HighContrast/gtk-contained-inverse.css'>theme/HighContrast/HighContrast-inverse.css</file>
|
|
'''
|
|
|
|
for f in get_files('theme/HighContrast/assets', '.png'):
|
|
xml += ' <file>theme/HighContrast/assets/{0}</file>\n'.format(f)
|
|
|
|
xml += '\n'
|
|
|
|
for f in get_files('theme/HighContrast/assets', '.svg'):
|
|
xml += ' <file>theme/HighContrast/assets/{0}</file>\n'.format(f)
|
|
|
|
for f in get_files('gesture', '.symbolic.png'):
|
|
xml += ' <file alias=\'icons/64x64/actions/{0}\'>gesture/{0}</file>\n'.format(f)
|
|
|
|
xml += '\n'
|
|
|
|
for f in get_files('ui', '.ui'):
|
|
xml += ' <file preprocess=\'xml-stripblanks\'>ui/{0}</file>\n'.format(f)
|
|
|
|
xml += '\n'
|
|
|
|
for s in ['16x16', '24x24', '32x32', '48x48', 'scalable']:
|
|
for c in ['actions', 'categories', 'emblems', 'emotes', 'devices', 'mimetypes', 'places', 'status']:
|
|
icons_dir = 'icons/{0}/{1}'.format(s,c)
|
|
if os.path.exists(os.path.join(srcdir,icons_dir)):
|
|
for f in get_files(icons_dir, '.png'):
|
|
xml += ' <file>icons/{0}/{1}/{2}</file>\n'.format(s,c,f)
|
|
for f in get_files(icons_dir, '.svg'):
|
|
xml += ' <file>icons/{0}/{1}/{2}</file>\n'.format(s,c,f)
|
|
|
|
for f in get_files('inspector', '.ui'):
|
|
xml += ' <file preprocess=\'xml-stripblanks\'>inspector/{0}</file>\n'.format(f)
|
|
|
|
xml += '''
|
|
<file>inspector/logo.png</file>
|
|
<file>inspector/inspector.css</file>
|
|
<file>emoji/emoji.data</file>
|
|
</gresource>
|
|
</gresources>'''
|
|
|
|
if len(sys.argv) > 2:
|
|
outfile = sys.argv[2]
|
|
f = open(outfile, 'w')
|
|
f.write(xml)
|
|
f.close()
|
|
else:
|
|
print(xml)
|