Skip to content

Commit 894bfc9

Browse files
committed
[GR-25397] Move pyc cache into mxbuild dir for C API build.
PullRequest: graalpython/1178
2 parents 88685eb + 420c655 commit 894bfc9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

mx.graalpython/mx_graalpython.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1690,14 +1690,24 @@ def build(self):
16901690
mx.ensure_dir_exists(os.path.join(self.subject.get_output_root(), "modules"))
16911691

16921692
cwd = os.path.join(self.subject.get_output_root(), "mxbuild_temp")
1693+
1694+
if os.path.exists("/dev/null"):
1695+
pycache_dir = "/dev/null"
1696+
else:
1697+
pycache_dir = os.path.join(self.subject.get_output_root(), "__pycache__")
1698+
16931699
args = []
16941700
if mx._opts.verbose:
16951701
args.append("-v")
16961702
else:
16971703
# always add "-q" if not verbose to suppress hello message
16981704
args.append("-q")
16991705

1700-
args += ["--python.WithThread", "-S", os.path.join(self.src_dir(), "setup.py"), self.subject.get_output_root()]
1706+
args += ["--python.WithThread",
1707+
"--python.PyCachePrefix=" + pycache_dir,
1708+
"-B",
1709+
"-S", os.path.join(self.src_dir() , "setup.py"),
1710+
self.subject.get_output_root()]
17011711
mx.ensure_dir_exists(cwd)
17021712
rc = self.run(args, cwd=cwd)
17031713
shutil.rmtree(cwd) # remove the temporary build files

0 commit comments

Comments
 (0)