summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2010-09-24 15:41:24 -0300
committerJohan Dahlin <johan@gnome.org>2010-09-24 16:06:54 -0300
commit4fd326d0dc1935be6e5ecb293fd157f9349d53aa (patch)
tree37c1e01aa80b496681db448f14b4eb1bce3ff90f
parent7cc31be7753b124b7f17febbbe0607765b426fa0 (diff)
downloadgobject-introspection-4fd326d0dc1935be6e5ecb293fd157f9349d53aa.tar.gz
Add a script to extract gio annotations
-rw-r--r--giscanner/annotationmain.py23
-rw-r--r--giscanner/annotationparser.py8
-rw-r--r--giscanner/girparser.py3
-rwxr-xr-xmisc/extract-gio-sources.sh10
4 files changed, 27 insertions, 17 deletions
diff --git a/giscanner/annotationmain.py b/giscanner/annotationmain.py
index d6e2eef5..b69577e9 100644
--- a/giscanner/annotationmain.py
+++ b/giscanner/annotationmain.py
@@ -56,23 +56,16 @@ def annotation_main(args):
if options.extract:
ap = AnnotationParser()
blocks = ap.parse(ss.get_comments())
+ print '/' + ('*' * 60) + '/'
+ print '/* THIS FILE IS GENERATED DO NOT EDIT */'
+ print '/' + ('*' * 60) + '/'
+ print
for block in blocks.values():
print block.to_gtk_doc()
print
- elif options.validate:
- transformer = create_transformer(namespace, options)
- transformer.parse(ss.get_symbols())
-
- shlibs = create_binary(transformer, options, args)
-
- ap = AnnotationParser()
- blocks = ap.parse(ss.get_comments())
-
- main = MainTransformer(transformer, blocks)
- main.transform()
-
- final = IntrospectablePass(transformer)
- final.validate()
-
+ print
+ print '/' + ('*' * 60) + '/'
+ print '/* THIS FILE IS GENERATED DO NOT EDIT */'
+ print '/' + ('*' * 60) + '/'
return 0
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index 282ea550..673d0a0a 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -138,7 +138,11 @@ class DocBlock(object):
comment = '/**\n'
for line in lines:
- comment += ' * %s\n' % (line, )
+ line = line.rstrip()
+ if line:
+ comment += ' * %s\n' % (line, )
+ else:
+ comment += ' *\n'
comment += ' */\n'
return comment
@@ -200,7 +204,7 @@ class DocTag(object):
if value:
if type(value) != str:
value = ' '.join((serialize_one(k, v, '%s=%s', '%s')
- for k,v in value.all().iteritems()))
+ for k, v in value.all().iteritems()))
return fmt % (option, value)
else:
return fmt2 % (option, )
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
index 06901dcb..6ba6c2a2 100644
--- a/giscanner/girparser.py
+++ b/giscanner/girparser.py
@@ -201,6 +201,9 @@ class GIRParser(object):
deprecated = node.attrib.get('deprecated')
if deprecated:
obj.deprecated = deprecated
+ deprecated_version = node.attrib.get('deprecated-version')
+ if deprecated_version:
+ obj.deprecated_version = deprecated_version
def _parse_object_interface(self, node):
parent = node.attrib.get('parent')
diff --git a/misc/extract-gio-sources.sh b/misc/extract-gio-sources.sh
new file mode 100755
index 00000000..ed1b8c1f
--- /dev/null
+++ b/misc/extract-gio-sources.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+GLIBDIR=$1
+tools/g-ir-annotation-tool --extract \
+ -DGIO_COMPILATION \
+ -I$GLIBDIR \
+ -I$GLIBDIR/glib \
+ -I$GLIBDIR/gobject \
+ -I$GLIBDIR/gmodule \
+ -I$GLIBDIR/gio \
+ $GLIBDIR/gio/*.c $GLIBDIR/gio/*.h