Merge branch '1544-gtester-report' into 'master'

Generate gtester-report from .in file

Closes #1544

See merge request GNOME/glib!352
This commit is contained in:
Xavier Claessens 2018-09-25 18:00:13 +00:00
commit af9e67c776
4 changed files with 21 additions and 24 deletions

View File

@ -3,7 +3,6 @@
#GTESTER = gtester # for non-GLIB packages #GTESTER = gtester # for non-GLIB packages
#GTESTER_REPORT = gtester-report # for non-GLIB packages #GTESTER_REPORT = gtester-report # for non-GLIB packages
GTESTER = $(top_builddir)/glib/gtester # for the GLIB package GTESTER = $(top_builddir)/glib/gtester # for the GLIB package
GTESTER_REPORT = $(top_builddir)/glib/gtester-report # for the GLIB package
NULL = NULL =
# initialize variables for unconditional += appending # initialize variables for unconditional += appending

View File

@ -454,24 +454,17 @@ bin_PROGRAMS += gtester
gtester_SOURCES = gtester.c gtester_SOURCES = gtester.c
gtester_LDADD = libglib-2.0.la gtester_LDADD = libglib-2.0.la
auto_config_binscripts = gtester-report bin_SCRIPTS = gtester-report
bin_SCRIPTS = ${auto_config_binscripts} EXTRA_DIST += gtester-report.in
EXTRA_DIST += ${auto_config_binscripts}
CONFIGVARS = \ gtester-report: gtester-report.in Makefile
"bindir" : "${bindir}", \ $(AM_V_GEN) set -e ; \
"glib-version" : "${GLIB_VERSION}" sed < $< > $@.tmp \
-e '1,1s|#!.*|#!${PYTHON}|' \
install-exec-hook: -e 's|[@]GLIB_VERSION[@]|${GLIB_VERSION}|' \
for sf in ${auto_config_binscripts} ; do \
mv -f "$(DESTDIR)$(bindir)/$$sf" "$(DESTDIR)$(bindir)/$$sf".tmp \
&& sed < "$(DESTDIR)$(bindir)/$$sf".tmp > "$(DESTDIR)$(bindir)/$$sf" \
-e '1,24s|^ *#@PKGINSTALL_CONFIGVARS_IN24LINES@| ${CONFIGVARS}|' \
-e '1,1s|#! /usr/bin/env python.*|#!${PYTHON}|' \
|| exit $$? ; \ || exit $$? ; \
chmod a+x $(DESTDIR)$(bindir)/$$sf ; \ chmod +x $@.tmp ; \
rm -f "$(DESTDIR)$(bindir)/$$sf".tmp ; \ mv $@.tmp $@
done
endif endif

8
glib/gtester-report → glib/gtester-report.in Executable file → Normal file
View File

@ -1,4 +1,4 @@
#! /usr/bin/env python #! /usr/bin/env @PYTHON@
# GLib Testing Framework Utility -*- Mode: python; -*- # GLib Testing Framework Utility -*- Mode: python; -*-
# Copyright (C) 2007 Imendio AB # Copyright (C) 2007 Imendio AB
# Authors: Tim Janik # Authors: Tim Janik
@ -28,10 +28,6 @@ except ImportError:
subunit = None subunit = None
pkginstall_configvars = {
#@PKGINSTALL_CONFIGVARS_IN24LINES@ # configvars are substituted upon script installation
}
# xml utilities # xml utilities
def find_child (node, child_name): def find_child (node, child_name):
for child in node.childNodes: for child in node.childNodes:
@ -454,7 +450,7 @@ def parse_opts():
:return: An options object and the program arguments. :return: An options object and the program arguments.
""" """
parser = optparse.OptionParser() parser = optparse.OptionParser()
parser.version = pkginstall_configvars.get ('glib-version', '0.0-uninstalled') parser.version = '@GLIB_VERSION@'
parser.usage = "%prog [OPTIONS] <gtester-log.xml>" parser.usage = "%prog [OPTIONS] <gtester-log.xml>"
parser.description = "Generate HTML reports from the XML log files generated by gtester." parser.description = "Generate HTML reports from the XML log files generated by gtester."
parser.epilog = "gtester-report (GLib utils) version %s."% (parser.version,) parser.epilog = "gtester-report (GLib utils) version %s."% (parser.version,)

View File

@ -303,7 +303,16 @@ else
dependencies : [libglib_dep]) dependencies : [libglib_dep])
endif endif
install_data('gtester-report', install_dir : get_option('bindir')) report_conf = configuration_data()
report_conf.set('GLIB_VERSION', glib_version)
report_conf.set('PYTHON', python_name)
configure_file(
input: 'gtester-report.in',
output: 'gtester-report',
install_dir: get_option('bindir'),
configuration: report_conf,
install_mode: 'rwxr-xr-x'
)
install_data('glib_gdb.py', install_dir : join_paths(glib_pkgdatadir, 'gdb')) install_data('glib_gdb.py', install_dir : join_paths(glib_pkgdatadir, 'gdb'))