summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/scanner/test_transformer.py8
-rw-r--r--tests/warn/warningtester.py8
-rw-r--r--tools/g-ir-tool-template.in8
3 files changed, 18 insertions, 6 deletions
diff --git a/tests/scanner/test_transformer.py b/tests/scanner/test_transformer.py
index bd85c8c3..e766d61c 100644
--- a/tests/scanner/test_transformer.py
+++ b/tests/scanner/test_transformer.py
@@ -7,7 +7,11 @@ import unittest
import tempfile
import os
import sys
-import __builtin__
+
+if sys.version_info.major < 3:
+ import __builtin__ as builtins
+else:
+ import builtins
os.environ['GI_SCANNER_DISABLE_CACHE'] = '1'
@@ -16,7 +20,7 @@ assert path is not None
sys.path.insert(0, path)
# Not correct, but enough to get the tests going uninstalled
-__builtin__.__dict__['DATADIR'] = path
+builtins.__dict__['DATADIR'] = path
from giscanner import ast
from giscanner.sourcescanner import SourceScanner
diff --git a/tests/warn/warningtester.py b/tests/warn/warningtester.py
index d223de09..1f7f91ec 100644
--- a/tests/warn/warningtester.py
+++ b/tests/warn/warningtester.py
@@ -3,17 +3,21 @@ from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
-import __builtin__
import os
import sys
import difflib
+if sys.version_info.major < 3:
+ import __builtin__ as builtins
+else:
+ import builtins
+
path = os.getenv('UNINSTALLED_INTROSPECTION_SRCDIR', None)
assert path is not None
sys.path.insert(0, path)
# Not correct, but enough to get the tests going uninstalled
-__builtin__.__dict__['DATADIR'] = path
+builtins.__dict__['DATADIR'] = path
from giscanner.annotationparser import GtkDocCommentBlockParser
from giscanner.ast import Include, Namespace
diff --git a/tools/g-ir-tool-template.in b/tools/g-ir-tool-template.in
index c9234c28..59f3ff47 100644
--- a/tools/g-ir-tool-template.in
+++ b/tools/g-ir-tool-template.in
@@ -25,8 +25,13 @@ from __future__ import unicode_literals
import os
import sys
-import __builtin__
+if sys.version_info.major < 3:
+ import __builtin__ as builtins
+else:
+ import builtins
+
+builtins.__dict__['DATADIR'] = "@datarootdir@"
debug = os.getenv('GI_SCANNER_DEBUG', '').split(',')
if debug:
@@ -55,7 +60,6 @@ srcdir = os.getenv('UNINSTALLED_INTROSPECTION_SRCDIR', None)
if srcdir is not None:
pylibdir = srcdir
-__builtin__.__dict__['DATADIR'] = datadir
sys.path.insert(0, pylibdir)
from giscanner.@TOOL_MODULE@ import @TOOL_FUNCTION@