Skip to content

Commit c246e1b

Browse files
committed
Also import HPy trace mode files
1 parent d88cea7 commit c246e1b

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

mx.graalpython/mx_graalpython.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2730,6 +2730,7 @@ def update_hpy_import_cmd(args):
27302730
hpy_repo_include_dir = join(hpy_repo_path, "hpy", "devel", "include")
27312731
hpy_repo_src_dir = join(hpy_repo_path, "hpy", "devel", "src")
27322732
hpy_repo_debug_dir = join(hpy_repo_path, "hpy", "debug")
2733+
hpy_repo_trace_dir = join(hpy_repo_path, "hpy", "trace")
27332734
hpy_repo_test_dir = join(hpy_repo_path, "test")
27342735
for d in [hpy_repo_path, hpy_repo_include_dir, hpy_repo_src_dir, hpy_repo_test_dir]:
27352736
if not os.path.isdir(d):
@@ -2843,7 +2844,8 @@ def exclude_files(*files):
28432844
tracker_file_src = join(hpy_repo_src_dir, "runtime", "ctx_tracker.c")
28442845
if not os.path.exists(tracker_file_src):
28452846
mx.abort("File '{}' is missing but required.".format(tracker_file_src))
2846-
tracker_file_dest = join(mx.project("com.oracle.graal.python.jni").dir, "src", "ctx_tracker.c")
2847+
jni_project_dir = mx.project("com.oracle.graal.python.jni").dir
2848+
tracker_file_dest = join(jni_project_dir, "src", "ctx_tracker.c")
28472849
import_file(tracker_file_src, tracker_file_dest)
28482850

28492851
# tests go to 'com.oracle.graal.python.hpy.test/src/test'
@@ -2858,12 +2860,24 @@ def exclude_files(*files):
28582860

28592861
# debug mode goes into 'com.oracle.graal.python.jni/src/debug'
28602862
debugctx_src = join(hpy_repo_debug_dir, "src")
2861-
debugctx_dest = join(mx.project("com.oracle.graal.python.jni").dir, "src", "debug")
2863+
debugctx_dest = join(jni_project_dir, "src", "debug")
28622864
debugctx_hdr = join(debugctx_src, "include", "hpy_debug.h")
28632865
import_files(debugctx_src, debugctx_dest, exclude_files(
28642866
"autogen_debug_ctx_call.i", "debug_ctx_cpython.c", debugctx_hdr))
28652867
import_file(debugctx_hdr, join(debugctx_dest, "hpy_debug.h"))
28662868

2869+
# trace Python sources go into 'lib-graalpython/module/hpy/trace'
2870+
trace_files_dest = join(_get_core_home(), "modules", "hpy", "trace")
2871+
import_files(hpy_repo_debug_dir, trace_files_dest, exclude_subdir("src"))
2872+
remove_inexistent_files(hpy_repo_trace_dir, trace_files_dest)
2873+
2874+
# trace mode goes into 'com.oracle.graal.python.jni/src/trace'
2875+
tracectx_src = join(hpy_repo_trace_dir, "src")
2876+
tracectx_dest = join(jni_project_dir, "src", "trace")
2877+
tracectx_hdr = join(tracectx_src, "include", "hpy_trace.h")
2878+
import_files(tracectx_src, tracectx_dest, exclude_files(tracectx_hdr))
2879+
import_file(tracectx_hdr, join(tracectx_dest, "hpy_trace.h"))
2880+
28672881
# import 'version.py' by path and read '__version__'
28682882
from importlib import util
28692883
spec = util.spec_from_file_location("version", dest_version_file)

0 commit comments

Comments
 (0)