scanner: Deprecate using identifier prefixes in GINames
authorColin Walters <walters@verbum.org>
Sat, 20 Oct 2012 19:10:45 +0000 (21:10 +0200)
committerColin Walters <walters@verbum.org>
Tue, 23 Oct 2012 14:50:43 +0000 (10:50 -0400)
Instead of crashing.  For more details, see the attached bug.

Based on a patch by Stef Walter <stefw@gnome.org>.

https://bugzilla.gnome.org/show_bug.cgi?id=684370

giscanner/transformer.py

index 6afad88..dfd2550 100644 (file)
@@ -151,11 +151,15 @@ namespaces."""
         if '.' not in name:
             return self._namespace.get(name)
         else:
-            (ns, name) = name.split('.', 1)
+            (ns, giname) = name.split('.', 1)
             if ns == self._namespace.name:
-                return self._namespace.get(name)
+                return self._namespace.get(giname)
+            if ns in self._namespace.identifier_prefixes:
+                message.warn(("Deprecated reference to identifier " +
+                              "prefix %s in GIName %s") % (ns, name))
+                return self._namespace.get(giname)
             include = self._includes[ns]
-            return include.get(name)
+            return include.get(giname)
 
     def lookup_typenode(self, typeobj):
         """Given a Type object, if it points to a giname,