File tree Expand file tree Collapse file tree 4 files changed +23
-3
lines changed
Expand file tree Collapse file tree 4 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ fn main() {
88 . header ( "wrapper.h" )
99 . clang_arg ( format ! ( "-I{}" , srcdir. as_os_str( ) . to_str( ) . unwrap( ) ) )
1010 . clang_arg ( format ! ( "-I{}/Include" , srcdir. as_os_str( ) . to_str( ) . unwrap( ) ) )
11+ . clang_arg ( format ! ( "-I{}/Include/internal" , srcdir. as_os_str( ) . to_str( ) . unwrap( ) ) )
1112 . allowlist_function ( "Py.*" )
1213 . allowlist_function ( "_Py.*" )
1314 . allowlist_type ( "Py.*" )
@@ -24,4 +25,4 @@ fn main() {
2425 bindings
2526 . write_to_file ( out_path. join ( "bindings.rs" ) )
2627 . expect ( "Couldn't write bindings!" ) ;
27- }
28+ }
Original file line number Diff line number Diff line change @@ -83,6 +83,8 @@ case $makepre in
8383' ' ) makepre=Makefile.pre;;
8484esac
8585
86+ UNAME_SYSTEM=` uname -s 2> /dev/null || echo unknown`
87+
8688# Newline for sed i and a commands
8789NL=' \
8890'
@@ -289,7 +291,14 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
289291 echo " $rule " >> $rulesf
290292 for mod in $mods
291293 do
292- custom_ldflags=" -Wl,--defsym=PyInit_$mod =PyInit_$mod "
294+ case $UNAME_SYSTEM in
295+ Darwin* )
296+ custom_ldflags=" $custom_ldflags -Wl,-u,_PyInit_$mod "
297+ ;;
298+ * )
299+ custom_ldflags=" $custom_ldflags -Wl,--defsym=PyInit_$mod =PyInit_$mod "
300+ ;;
301+ esac
293302 done
294303 fi
295304 case $doconfig in
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ extern "C" {
2929
3030#include "pyconfig.h"
3131#include "internal/pycore_ceval.h"
32+ #include "internal/pycore_debug_offsets.h"
3233
3334#ifdef __linux__
3435# include <elf.h>
Original file line number Diff line number Diff line change 33from pathlib import Path
44
55ROOT = Path (__file__ ).resolve ().parents [2 ]
6- INCLUDE = ROOT / "Include"
76WRAPPER_H = ROOT / "Modules" / "cpython-sys" / "wrapper.h"
7+ SKIP_PREFIXES = ("cpython/" ,)
8+ SKIP_EXACT = {
9+ "internal/pycore_crossinterp_data_registry.h" ,
10+ }
811
912def normalize_path (header : str ) -> str :
1013 return re .sub (r'(:?\.\/)(:?Include\/)?' , '' , header )
@@ -18,7 +21,13 @@ def main(output: str = WRAPPER_H) -> None:
1821 f .write ("#include \" Modules/expat/expat.h\" \n " )
1922 for header in headers .split ():
2023 normalized_path = normalize_path (header )
24+ if normalized_path .startswith (SKIP_PREFIXES ):
25+ continue
26+ if normalized_path in SKIP_EXACT :
27+ continue
2128 f .write (f"#include \" { normalized_path } \" \n " )
29+ if normalized_path == "Python/remote_debug.h" :
30+ f .write ("#undef UNUSED\n " )
2231
2332if __name__ == "__main__" :
2433 import sys
You can’t perform that action at this time.
0 commit comments