Use gtk-doc to find required package version
Usually I am quite unsettled when adding package requirements to README files and configure scripts. AI never really know if the version I specified is correct.
This morning I had enough of this uncertainness and hacked a short Python script to extract that information from our find gtk-doc manuals: gtkdoc-check-symbol-versions.
Libxml2 cannot parse the HTML gtk-doc generates, so the script reads the gtk-doc manuals line by line, throws regular expressions at them and puts the matches into a hash table. When finished it reads the files it shall check, strips comments, splits the tails into words and looks up the minimum package version for every word.
Maybe the gtk-doc guys can bundle this (or a polished version of the script) with their package.
Usage is like this:
$ gtkdoc-check-symbol-versions \
-p glib -p gobject -p libsoup -p gnutls -p gtk */*.[ch]
gtk-2.6 required for gtk_combo_box_get_active_text in examples/consumer-ui.c
glib-2.4 required for g_markup_printf_escaped in examples/consumer-ui.c
glib-2.6 required for g_option_context_new in examples/list-resources.c
gobject-2.4 required for G_DEFINE_TYPE in libepc/consumer.c
glib-2.10 required for g_slice_new0 in libepc/dispatcher.c
glib-2.12 required for g_hash_table_remove_all in libepc/dispatcher.c
gtk-2.10 required for gtk_window_set_deletable in libepc-ui/entropy-window.c
glib-2.14 required for g_timeout_add_seconds in tests/framework.c
$
What!? I need glib-2.14 just for g_timeout_add_seconds in the regression tests? Crap, I better change this.
Many people (such as myself) have gzip'd index.sgml files. I've hacked it to do this instead, it needs a cleanup but it works:
def _get_index(self):
if not self.__index:
self.__index = dict()
if os.path.exists(self.build_filename('index.sgml')):
f = file(self.build_filename('index.sgml'))
elif os.path.exists(self.build_filename('index.sgml.gz')):
import gzip
f = gzip.open(self.build_filename('index.sgml.gz'))
for line in f:
Hi Ross, merged your suggestion. The tool in the repository has gzip support now.