Skip to content

Commit 8beed5f

Browse files
committed
build the managed C API as part of the EE build
1 parent 51e66f6 commit 8beed5f

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

mx.graalpython/mx_graalpython.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@
4646
CONFIGURATION_DEFAULT, CONFIGURATION_SANDBOXED, CONFIGURATION_NATIVE, \
4747
CONFIGURATION_DEFAULT_MULTI, CONFIGURATION_SANDBOXED_MULTI, CONFIGURATION_NATIVE_MULTI
4848

49+
4950
try:
5051
import __main__ # workaround for pdb++
5152
except ImportError:
52-
sys.modules["__main__"] = mx
53+
sys.modules["__main__"] = type(sys)("<empty>")
54+
5355

5456
SUITE = mx.suite('graalpython')
5557
SUITE_COMPILER = mx.suite("compiler", fatalIfMissing=False)
@@ -1142,6 +1144,9 @@ def __init__(self, args, project):
11421144
def __str__(self):
11431145
return 'Building C API project {} with setuptools'.format(self.subject.name)
11441146

1147+
def run(self, args, env, cwd):
1148+
return do_run_python(args, env=env, cwd=cwd)
1149+
11451150
def build(self):
11461151
env = os.environ.copy()
11471152
cwd = os.path.join(self.subject.get_output_root(), "mxbuild_temp")
@@ -1153,13 +1158,8 @@ def build(self):
11531158
args += ["-S", os.path.join(self.subject.dir, "setup.py"), self.subject.get_output_root()]
11541159
mx.ensure_dir_exists(cwd)
11551160
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
11631163
return min(rc, 1)
11641164

11651165
def needsBuild(self, newestInput):
@@ -1181,10 +1181,6 @@ def needsBuild(self, newestInput):
11811181
oldestFile = f
11821182
if tsOldest == sys.maxsize:
11831183
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
11881184
if tsOldest < tsNewest:
11891185
self.clean() # we clean here, because setuptools doesn't check timestamps
11901186
if newestFile and oldestFile:

0 commit comments

Comments
 (0)