[scanner] Move namespace out of Transformer
authorJohan Dahlin <johan@gnome.org>
Thu, 2 Sep 2010 11:59:51 +0000 (08:59 -0300)
committerJohan Dahlin <johan@gnome.org>
Thu, 2 Sep 2010 11:59:51 +0000 (08:59 -0300)
giscanner/scannermain.py
giscanner/transformer.py

index 3d2768420e596125e1862f4a99a6852fd501b71d..cc010320d7ab1dd9f80754bc131d873caa3c9ae1 100644 (file)
@@ -29,7 +29,7 @@ import sys
 import tempfile
 
 from giscanner.annotationparser import AnnotationParser
-from giscanner.ast import Include
+from giscanner.ast import Include, Namespace
 from giscanner.dumper import compile_introspection_binary
 from giscanner.gdumpparser import GDumpParser, IntrospectionBinary
 from giscanner.maintransformer import MainTransformer
@@ -260,10 +260,11 @@ def scanner_main(args):
     else:
         symbol_prefixes = None
 
-    transformer = Transformer(options.namespace_name,
-                              options.namespace_version,
-                              identifier_prefixes=identifier_prefixes,
-                              symbol_prefixes=symbol_prefixes,
+    namespace = Namespace(options.namespace_name,
+                          options.namespace_version,
+                          identifier_prefixes=identifier_prefixes,
+                          symbol_prefixes=symbol_prefixes)
+    transformer = Transformer(namespace,
                               accept_unprefixed=options.accept_unprefixed)
     if options.warn_all:
         transformer.enable_warnings(True)
index ed6dce82c55e27ba4af96cdcd866afab637bebc2..690cbab17fcf371289f4578e94a9887099cc2acd 100644 (file)
@@ -47,15 +47,11 @@ class Transformer(object):
 
     UCASE_CONSTANT_RE = re.compile(r'[_A-Z0-9]+')
 
-    def __init__(self, namespace_name, namespace_version,
-                 identifier_prefixes=None, symbol_prefixes=None,
-                 accept_unprefixed=False):
+    def __init__(self, namespace, accept_unprefixed=False):
         self._cwd = os.getcwd() + os.sep
         self._cachestore = CacheStore()
         self._accept_unprefixed = accept_unprefixed
-        self._namespace = ast.Namespace(namespace_name, namespace_version,
-                                    identifier_prefixes=identifier_prefixes,
-                                    symbol_prefixes=symbol_prefixes)
+        self._namespace = namespace
         self._pkg_config_packages = set()
         self._typedefs_ns = {}
         self._enable_warnings = False