mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-30 20:33:08 +02:00
This reduces the build-time dependencies of glib to only Python 3, Meson, and git. Git is also optional if you provide a tarball in which the subproject directories already exist. The Python port was done by Jussi Pakkanen on bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=779332 This version contains some fixes from that and also changes all instances of `@` to `\u0040` because Meson does not yet provide a configure_file() mode that ignores unknown @MACRO@ values.
26 lines
757 B
Python
Executable File
26 lines
757 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
# This is in its own file rather than inside meson.build
|
|
# because a) mixing the two is ugly and b) trying to
|
|
# make special characters such as \n go through all
|
|
# backends is a fool's errand.
|
|
|
|
import sys, os, shutil, subprocess
|
|
|
|
python = sys.argv[1]
|
|
glib_mkenums = sys.argv[2]
|
|
ofilename = sys.argv[3]
|
|
ofile_rel = os.path.basename(ofilename)
|
|
template_file_dir = sys.argv[4]
|
|
template_file_path = template_file_dir + '/' + ofile_rel + '.template'
|
|
headers = sys.argv[5:]
|
|
|
|
arg_array = ['--template', template_file_path]
|
|
|
|
cmd = [python, glib_mkenums]
|
|
pc = subprocess.Popen(cmd + arg_array + headers, stdout=subprocess.PIPE)
|
|
(stdo, _) = pc.communicate()
|
|
if pc.returncode != 0:
|
|
sys.exit(pc.returncode)
|
|
open(ofilename, 'wb').write(stdo)
|