Skip to content

Commit 0a2c027

Browse files
author
Dan Liew
committed
Fixed import errors for "as" caused by trying to import
driver.popenwrapper
1 parent e3cb283 commit 0a2c027

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

driver/utils.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,27 @@
77
import re
88
import sys
99
import tempfile
10-
from driver.popenwrapper import Popen
1110

1211
fullSelfPath = os.path.realpath(__file__)
1312
prefix = os.path.dirname(fullSelfPath)
1413
driverDir = prefix
1514

15+
# This is a bit hacky.
16+
# We cannot do
17+
# from .popenwrapper import Popen
18+
# OR
19+
# from driver.popenwrapper import Popen
20+
# because then 'as' will not succesfully import us (wllvm/wllvm++ can
21+
# successfully import however).
22+
#
23+
# Using
24+
# from popenwrapper import Popen
25+
# will allow 'as' to import us but then wllvm/wllvm++ will not be able to.
26+
#
27+
# The work around is to put this directory in the search path for modules.
28+
sys.path.insert(0,driverDir)
29+
from popenwrapper import Popen
30+
1631
# Environmental variable for path to compiler tools (clang/llvm-link etc..)
1732
llvmCompilerPathEnv = 'LLVM_COMPILER_PATH'
1833

0 commit comments

Comments
 (0)