Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Gnome/gtk/   (Gnome Linux Desktop Version 4.23.2©)  Datei vom 30.5.2026 mit Größe 2 kB image not shown  

Quelle  gen-gtk-gresources-xml.py

  Sprache: Python
 

#!/usr/bin/env python3
#
# Generate gtk.gresources.xml
#
# Usage: gen-gtk-gresources-xml SRCDIR_GTK ENDIAN
#
# Endian can be 'big' or 'little'

import os, sys
import filecmp

def replace_if_changed(new, old):
  '''
  Compare contents and only replace if changed to avoid triggering a rebuild.
  '''
  try:
    changed = not filecmp.cmp(new, old, shallow=False)
  except FileNotFoundError:
    changed = True
  if changed:
    os.replace(new, old)
  else:
    os.remove(new)

srcdir = sys.argv[1]
endian = sys.argv[2]

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/Default/gtk.css</file>
'''
for f in {'light''dark''hc''hc-dark'}:
  xml += '    <file alias=\'theme/Default/gtk-{0}.css\'>theme/Default/gtk.css</file>\n'.format(f)
  xml += '    <file>theme/Default/Default-{0}.css</file>\n'.format(f)

for f in get_files('theme/Default/assets''.png'):
  xml += '    <file>theme/Default/assets/{0}</file>\n'.format(f)

xml += '\n'

for f in get_files('theme/Default/assets''.svg'):
  xml += '    <file preprocess=\'xml-stripblanks\'>theme/Default/assets/{0}</file>\n'.format(f)


xml += '\n'


for f in get_files('ui''.ui'):
  xml += '    <file>ui/{0}</file>\n'.format(f)

for f in get_files('print/ui''.ui'):
  xml += '    <file>print/ui/{0}</file>\n'.format(f)

xml += '\n'

xml += '''
    <file compressed="true">icons/hicolor.index.theme</file>
'''

xml += '    <file>icons/16x16/status/image-missing.png</file>\n'

for f in get_files('icons''.svg'):
  xml += '    <file preprocess=\'xml-stripblanks\'>icons/{0}</file>\n'.format(f)

for f in get_files('icons''.gpa'):
  xml += '    <file preprocess=\'xml-stripblanks\'>icons/{0}</file>\n'.format(f)

for f in get_files('inspector''.ui'):
  xml += '    <file preprocess=\'xml-stripblanks\'>inspector/{0}</file>\n'.format(f)

xml += '''
    <file>inspector/inspector.css</file>
    <file>emoji/en.data</file>
    <file alias="compose/sequences">compose/sequences-{0}-endian</file>
    <file>compose/chars</file>
  </gresource>
</gresources>'''.format(endian)

if len(sys.argv) > 3:
  outfile = sys.argv[3]
  tmpfile = outfile + '~'
  with open(tmpfile, 'w'as f:
    f.write(xml)
  replace_if_changed(tmpfile, outfile)
else:
  print(xml)

Messung V0.5 in Prozent
C=94 H=71 G=83

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-07-03) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.