gimp-help-2 r2459 - in trunk: . tools



Author: ulfehlert
Date: Sat Apr 19 17:23:17 2008
New Revision: 2459
URL: http://svn.gnome.org/viewvc/gimp-help-2?rev=2459&view=rev

Log:
2008-04-19  Ulf-D. Ehlert  <ulfehlert svn gnome org>

	* tools/validate_references.py: fix to handle missing xml files
	(e.g. src/preface/authors.xml)


Modified:
   trunk/ChangeLog
   trunk/tools/validate_references.py

Modified: trunk/tools/validate_references.py
==============================================================================
--- trunk/tools/validate_references.py	(original)
+++ trunk/tools/validate_references.py	Sat Apr 19 17:23:17 2008
@@ -25,6 +25,9 @@
 import re
 import xml.sax
 
+# TODO: use the Python logging system(!?)
+#import logging
+
 
 # Nodes containing filereferences in a DocBook XML file
 IMAGE_NODES = ["imagedata", "graphic", "inlinegraphic"]
@@ -221,12 +224,19 @@
         if name == "xi:include" and attrs.has_key('href'):
             filename = os.path.join(os.path.dirname(self.owner.current_file()),
                                     attrs.getValue('href'))
-            if self.owner.verbose > 1:
-                sys.stderr.write("parsing " + str(filename) + "\n")
-            self.owner.push_file(filename)
-            parser = self.owner.make_parser()
-            parser.parse(filename)
-            self.owner.pop_file()
+            if os.path.isfile(filename):
+                if self.owner.verbose > 1:
+                    sys.stderr.write("parsing " + str(filename) + "\n")
+                self.owner.push_file(filename)
+                parser = self.owner.make_parser()
+                try:
+                    parser.parse(filename)
+                except:
+                    sys.stderr.write("ERROR reading " + str(filename) + "\n")
+                self.owner.pop_file()
+            else:
+                if self.owner.verbose > 1:
+                    sys.stderr.write("skipping " + str(filename) + "\n")
 
 
 def main():



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]