jhbuild r1860 - in trunk: . jhbuild/modtypes



Author: fpeters
Date: Sun Jan 20 15:01:03 2008
New Revision: 1860
URL: http://svn.gnome.org/viewvc/jhbuild?rev=1860&view=rev

Log:
* jhbuild/modtypes/__init__.py: abort on dependency node missing a
package attribute.



Modified:
   trunk/ChangeLog
   trunk/jhbuild/modtypes/__init__.py

Modified: trunk/jhbuild/modtypes/__init__.py
==============================================================================
--- trunk/jhbuild/modtypes/__init__.py	(original)
+++ trunk/jhbuild/modtypes/__init__.py	Sun Jan 20 15:01:03 2008
@@ -61,20 +61,25 @@
     dependencies = []
     after = []
     suggests = []
+
+    def add_to_list(list, childnode):
+        for dep in childnode.childNodes:
+            if dep.nodeType == dep.ELEMENT_NODE and dep.nodeName == 'dep':
+                package = dep.getAttribute('package')
+                if not package:
+                    raise FatalError('dep node for module %s is missing package attribute' % \
+                            node.getAttribute('id'))
+                list.append(package)
+
     for childnode in node.childNodes:
         if childnode.nodeType != childnode.ELEMENT_NODE: continue
         if childnode.nodeName == 'dependencies':
-            for dep in childnode.childNodes:
-                if dep.nodeType == dep.ELEMENT_NODE and dep.nodeName == 'dep':
-                    dependencies.append(dep.getAttribute('package'))
+            add_to_list(dependencies, childnode)
         elif childnode.nodeName == 'suggests':
-            for dep in childnode.childNodes:
-                if dep.nodeType == dep.ELEMENT_NODE and dep.nodeName == 'dep':
-                    suggests.append(dep.getAttribute('package'))
+            add_to_list(suggests, childnode)
         elif childnode.nodeName == 'after':
-            for dep in childnode.childNodes:
-                if dep.nodeType == dep.ELEMENT_NODE and dep.nodeName == 'dep':
-                    after.append(dep.getAttribute('package'))
+            add_to_list(after, childnode)
+
     return dependencies, after, suggests
 
 def get_branch(node, repositories, default_repo):



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