summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2011-07-22 17:51:38 -0400
committerColin Walters <walters@verbum.org>2011-07-22 17:56:41 -0400
commitfcb89c77f1f9c2819ed3cf9e7bb66cf142d1080d (patch)
tree9ee30ab28c61401273504c3fa2ff763c9d15171c /misc
parenteda7d98cb70de1445239955a99b44e128802dcc9 (diff)
downloadgobject-introspection-fcb89c77f1f9c2819ed3cf9e7bb66cf142d1080d.tar.gz
update-glib-annotations.py: Attempt to make work for srcdir!=builddir
This doesn't quite work yet because we need to know from glib which files are in srcdir and which are in builddir. Also add some debugging prints.
Diffstat (limited to 'misc')
-rwxr-xr-xmisc/update-glib-annotations.py39
1 files changed, 24 insertions, 15 deletions
diff --git a/misc/update-glib-annotations.py b/misc/update-glib-annotations.py
index 97e5f9db..315b43ce 100755
--- a/misc/update-glib-annotations.py
+++ b/misc/update-glib-annotations.py
@@ -16,6 +16,17 @@ for d in possible_builddirs:
assert builddir is not None
annotation_tool_base_args = [os.path.join(builddir, 'g-ir-annotation-tool'), '--extract']
+def directory_includes(dirs, srcdir, builddir):
+ result = []
+ result.append('-I' + srcdir)
+ if srcdir != builddir:
+ result.append('-I' + builddir)
+ for name in dirs:
+ result.append('-I' + os.path.join(srcdir, name))
+ if srcdir != builddir:
+ result.append('-I' + os.path.join(builddir, name))
+ return result
+
def extract_glib_annotations(srcdir, builddir, outfile):
projname = 'glib'
headersfile = os.path.join(builddir, projname, projname + '-public-headers.txt')
@@ -33,10 +44,7 @@ def extract_glib_annotations(srcdir, builddir, outfile):
if sourcename.endswith('.c'):
sources.append(os.path.join(subdir, sourcename))
return subprocess.check_call(annotation_tool_base_args +
- ['-DGLIB_COMPILATION',
- '-I' + srcdir,
- '-I' + os.path.join(srcdir, 'glib'),
- '-I' + os.path.join(srcdir, 'gmodule')] + sources,
+ ['-DGLIB_COMPILATION'] + directory_includes(['glib', 'gmodule'], srcdir, builddir) + sources,
stdout=outfile)
def extract_gobject_annotations(srcdir, builddir, outfile):
@@ -54,11 +62,7 @@ def extract_gobject_annotations(srcdir, builddir, outfile):
if sourcename.endswith('.c'):
sources.append(os.path.join(subdir, sourcename))
return subprocess.check_call(annotation_tool_base_args +
- ['-DGOBJECT_COMPILATION',
- '-I' + srcdir,
- '-I' + os.path.join(srcdir, 'glib'),
- '-I' + os.path.join(srcdir, 'gobject'),
- '-I' + os.path.join(srcdir, 'gmodule')] + sources,
+ ['-DGOBJECT_COMPILATION'] + directory_includes(['glib', 'gobject', 'gmodule'], srcdir, builddir) + sources,
stdout=outfile)
def extract_gio_annotations(srcdir, builddir, outfile):
@@ -77,12 +81,7 @@ def extract_gio_annotations(srcdir, builddir, outfile):
sources.append(os.path.join(subdir, sourcename))
return subprocess.check_call(annotation_tool_base_args +
['-DGOBJECT_COMPILATION',
- '-DGIO_COMPILATION',
- '-I' + srcdir,
- '-I' + os.path.join(srcdir, 'glib'),
- '-I' + os.path.join(srcdir, 'gobject'),
- '-I' + os.path.join(srcdir, 'gio'),
- '-I' + os.path.join(srcdir, 'gmodule')] + sources,
+ '-DGIO_COMPILATION'] + directory_includes(['glib', 'gmodule', 'gobject', 'gio'], srcdir, builddir) + sources,
stdout=outfile)
if __name__ == '__main__':
@@ -92,21 +91,31 @@ if __name__ == '__main__':
else:
builddir = srcdir
+ print "Using source directory: %r build directory: %r" % (srcdir, builddir)
+
srcname = '../gir/glib-2.0.c'
srcfile = open(srcname + '.tmp', 'w')
extract_glib_annotations(srcdir, builddir, srcfile)
srcfile.close()
os.rename(srcname + '.tmp', srcname)
+ print "Updated %r" % (srcname, )
+
srcname = '../gir/gobject-2.0.c'
srcfile = open(srcname + '.tmp', 'w')
extract_gobject_annotations(srcdir, builddir, srcfile)
srcfile.close()
os.rename(srcname + '.tmp', srcname)
+ print "Updated %r" % (srcname, )
+
srcname = '../gir/gio-2.0.c'
srcfile = open(srcname + '.tmp', 'w')
extract_gio_annotations(srcdir, builddir, srcfile)
srcfile.close()
os.rename(srcname + '.tmp', srcname)
+ print "Updated %r" % (srcname, )
+
+ print "Done; run \"git diff\" to see any changes."
+