Add generated file warning comment
authorColin Walters <walters@src.gnome.org>
Wed, 14 Jan 2009 17:39:36 +0000 (17:39 +0000)
committerColin Walters <walters@src.gnome.org>
Wed, 14 Jan 2009 17:39:36 +0000 (17:39 +0000)
We don't want people manually editing .gir files.

svn path=/trunk/; revision=1034

giscanner/girwriter.py
giscanner/xmlwriter.py

index a5d1637a569f7b99290b9b3431295c68bb5f7194..54fac87aeb2db55ba2bb0207548a4db7530257e5 100644 (file)
@@ -35,6 +35,8 @@ class GIRWriter(XMLWriter):
 
     def __init__(self, namespace, shlibs, includes):
         super(GIRWriter, self).__init__()
+        self.write_comment('''This file was automatically generated from C sources - DO NOT EDIT!
+     To affect the contents of this file, edit the original C definitions, and/or use gtk-doc annotations. ''')
         self._write_repository(namespace, shlibs, includes)
 
     def _write_repository(self, namespace, shlibs, includes=set()):
index bed3f9914de1ddbd323bc382311040821a664cdb..3c1416211c4f8ba6689617e5f064de790fce3c0e 100644 (file)
@@ -101,6 +101,9 @@ class XMLWriter(object):
     def write_line(self, line=''):
         self._data.write('%s%s\n' % (self._indent_char * self._indent, line))
 
+    def write_comment(self, text):
+        self.write_line('<!-- %s -->' % (text, ))
+
     def write_tag(self, tag_name, attributes, data=None):
         if attributes is None:
             attributes = []