46
46
CONFIGURATION_DEFAULT , CONFIGURATION_SANDBOXED , CONFIGURATION_NATIVE , \
47
47
CONFIGURATION_DEFAULT_MULTI , CONFIGURATION_SANDBOXED_MULTI , CONFIGURATION_NATIVE_MULTI
48
48
49
+
49
50
try :
50
51
import __main__ # workaround for pdb++
51
52
except ImportError :
52
- sys .modules ["__main__" ] = mx
53
+ sys .modules ["__main__" ] = type (sys )("<empty>" )
54
+
53
55
54
56
SUITE = mx .suite ('graalpython' )
55
57
SUITE_COMPILER = mx .suite ("compiler" , fatalIfMissing = False )
@@ -1142,6 +1144,9 @@ def __init__(self, args, project):
1142
1144
def __str__ (self ):
1143
1145
return 'Building C API project {} with setuptools' .format (self .subject .name )
1144
1146
1147
+ def run (self , args , env , cwd ):
1148
+ return do_run_python (args , env = env , cwd = cwd )
1149
+
1145
1150
def build (self ):
1146
1151
env = os .environ .copy ()
1147
1152
cwd = os .path .join (self .subject .get_output_root (), "mxbuild_temp" )
@@ -1153,13 +1158,8 @@ def build(self):
1153
1158
args += ["-S" , os .path .join (self .subject .dir , "setup.py" ), self .subject .get_output_root ()]
1154
1159
mx .ensure_dir_exists (cwd )
1155
1160
home = os .path .join (SUITE .dir , "graalpython" )
1156
- rc = do_run_python (args , env = env , cwd = cwd )
1157
- shutil .rmtree (cwd )
1158
- if mx .suite ("sulong-managed" , fatalIfMissing = False ):
1159
- args = ["--llvm.managed" ] + args
1160
- mx .ensure_dir_exists (cwd )
1161
- rc += do_run_python (args , env = env , cwd = cwd )
1162
- shutil .rmtree (cwd )
1161
+ rc = self .run (args , env = env , cwd = cwd )
1162
+ shutil .rmtree (cwd ) # remove the temporary build files
1163
1163
return min (rc , 1 )
1164
1164
1165
1165
def needsBuild (self , newestInput ):
@@ -1181,10 +1181,6 @@ def needsBuild(self, newestInput):
1181
1181
oldestFile = f
1182
1182
if tsOldest == sys .maxsize :
1183
1183
tsOldest = 0
1184
- if mx .suite ("sulong-managed" , fatalIfMissing = False ):
1185
- # ensure that we have both libpythons built
1186
- if len (list (filter (lambda n : n .startswith ("libpython" ), os .listdir (self .subject .get_output_root ())))) < 2 :
1187
- tsOldest = 0
1188
1184
if tsOldest < tsNewest :
1189
1185
self .clean () # we clean here, because setuptools doesn't check timestamps
1190
1186
if newestFile and oldestFile :
0 commit comments