@@ -167,6 +167,8 @@ pub struct InterpreterConfig {
167
167
///
168
168
/// Serialized to multiple `extra_build_script_line` values.
169
169
pub extra_build_script_lines : Vec < String > ,
170
+ /// macOS Python3.framework requires special rpath handling
171
+ pub python_framework_prefix : Option < String > ,
170
172
}
171
173
172
174
impl InterpreterConfig {
@@ -245,6 +247,7 @@ WINDOWS = platform.system() == "Windows"
245
247
246
248
# macOS framework packages use shared linking
247
249
FRAMEWORK = bool(get_config_var("PYTHONFRAMEWORK"))
250
+ FRAMEWORK_PREFIX = get_config_var("PYTHONFRAMEWORKPREFIX")
248
251
249
252
# unix-style shared library enabled
250
253
SHARED = bool(get_config_var("Py_ENABLE_SHARED"))
@@ -253,6 +256,7 @@ print("implementation", platform.python_implementation())
253
256
print("version_major", sys.version_info[0])
254
257
print("version_minor", sys.version_info[1])
255
258
print("shared", PYPY or GRAALPY or ANACONDA or WINDOWS or FRAMEWORK or SHARED)
259
+ print("python_framework_prefix", FRAMEWORK_PREFIX)
256
260
print_if_set("ld_version", get_config_var("LDVERSION"))
257
261
print_if_set("libdir", get_config_var("LIBDIR"))
258
262
print_if_set("base_prefix", base_prefix)
@@ -289,6 +293,7 @@ print("gil_disabled", get_config_var("Py_GIL_DISABLED"))
289
293
} ;
290
294
291
295
let shared = map[ "shared" ] . as_str ( ) == "True" ;
296
+ let python_framework_prefix = map. get ( "python_framework_prefix" ) . cloned ( ) ;
292
297
293
298
let version = PythonVersion {
294
299
major : map[ "version_major" ]
@@ -359,6 +364,7 @@ print("gil_disabled", get_config_var("Py_GIL_DISABLED"))
359
364
build_flags : BuildFlags :: from_interpreter ( interpreter) ?,
360
365
suppress_build_script_link_lines : false ,
361
366
extra_build_script_lines : vec ! [ ] ,
367
+ python_framework_prefix,
362
368
} )
363
369
}
364
370
@@ -396,6 +402,9 @@ print("gil_disabled", get_config_var("Py_GIL_DISABLED"))
396
402
Some ( s) => !s. is_empty ( ) ,
397
403
_ => false ,
398
404
} ;
405
+ let python_framework_prefix = sysconfigdata
406
+ . get_value ( "PYTHONFRAMEWORKPREFIX" )
407
+ . map ( str:: to_string) ;
399
408
let lib_dir = get_key ! ( sysconfigdata, "LIBDIR" ) . ok ( ) . map ( str:: to_string) ;
400
409
let gil_disabled = match sysconfigdata. get_value ( "Py_GIL_DISABLED" ) {
401
410
Some ( value) => value == "1" ,
@@ -424,6 +433,7 @@ print("gil_disabled", get_config_var("Py_GIL_DISABLED"))
424
433
build_flags,
425
434
suppress_build_script_link_lines : false ,
426
435
extra_build_script_lines : vec ! [ ] ,
436
+ python_framework_prefix,
427
437
} )
428
438
}
429
439
@@ -500,6 +510,7 @@ print("gil_disabled", get_config_var("Py_GIL_DISABLED"))
500
510
let mut build_flags: Option < BuildFlags > = None ;
501
511
let mut suppress_build_script_link_lines = None ;
502
512
let mut extra_build_script_lines = vec ! [ ] ;
513
+ let mut python_framework_prefix = None ;
503
514
504
515
for ( i, line) in lines. enumerate ( ) {
505
516
let line = line. context ( "failed to read line from config" ) ?;
@@ -528,6 +539,7 @@ print("gil_disabled", get_config_var("Py_GIL_DISABLED"))
528
539
"extra_build_script_line" => {
529
540
extra_build_script_lines. push ( value. to_string ( ) ) ;
530
541
}
542
+ "python_framework_prefix" => parse_value ! ( python_framework_prefix, value) ,
531
543
unknown => warn ! ( "unknown config key `{}`" , unknown) ,
532
544
}
533
545
}
@@ -558,6 +570,7 @@ print("gil_disabled", get_config_var("Py_GIL_DISABLED"))
558
570
build_flags,
559
571
suppress_build_script_link_lines : suppress_build_script_link_lines. unwrap_or ( false ) ,
560
572
extra_build_script_lines,
573
+ python_framework_prefix,
561
574
} )
562
575
}
563
576
@@ -650,6 +663,7 @@ print("gil_disabled", get_config_var("Py_GIL_DISABLED"))
650
663
write_option_line ! ( executable) ?;
651
664
write_option_line ! ( pointer_width) ?;
652
665
write_line ! ( build_flags) ?;
666
+ write_option_line ! ( python_framework_prefix) ?;
653
667
write_line ! ( suppress_build_script_link_lines) ?;
654
668
for line in & self . extra_build_script_lines {
655
669
writeln ! ( writer, "extra_build_script_line={}" , line)
@@ -1587,6 +1601,7 @@ fn default_cross_compile(cross_compile_config: &CrossCompileConfig) -> Result<In
1587
1601
build_flags : BuildFlags :: default ( ) ,
1588
1602
suppress_build_script_link_lines : false ,
1589
1603
extra_build_script_lines : vec ! [ ] ,
1604
+ python_framework_prefix : None ,
1590
1605
} )
1591
1606
}
1592
1607
@@ -1629,6 +1644,7 @@ fn default_abi3_config(host: &Triple, version: PythonVersion) -> Result<Interpre
1629
1644
build_flags : BuildFlags :: default ( ) ,
1630
1645
suppress_build_script_link_lines : false ,
1631
1646
extra_build_script_lines : vec ! [ ] ,
1647
+ python_framework_prefix : None ,
1632
1648
} )
1633
1649
}
1634
1650
@@ -2011,6 +2027,7 @@ mod tests {
2011
2027
version : MINIMUM_SUPPORTED_VERSION ,
2012
2028
suppress_build_script_link_lines : true ,
2013
2029
extra_build_script_lines : vec ! [ "cargo:test1" . to_string( ) , "cargo:test2" . to_string( ) ] ,
2030
+ python_framework_prefix : None ,
2014
2031
} ;
2015
2032
let mut buf: Vec < u8 > = Vec :: new ( ) ;
2016
2033
config. to_writer ( & mut buf) . unwrap ( ) ;
@@ -2039,6 +2056,7 @@ mod tests {
2039
2056
} ,
2040
2057
suppress_build_script_link_lines : false ,
2041
2058
extra_build_script_lines : vec ! [ ] ,
2059
+ python_framework_prefix : None ,
2042
2060
} ;
2043
2061
let mut buf: Vec < u8 > = Vec :: new ( ) ;
2044
2062
config. to_writer ( & mut buf) . unwrap ( ) ;
@@ -2060,6 +2078,7 @@ mod tests {
2060
2078
version : MINIMUM_SUPPORTED_VERSION ,
2061
2079
suppress_build_script_link_lines : true ,
2062
2080
extra_build_script_lines : vec ! [ "cargo:test1" . to_string( ) , "cargo:test2" . to_string( ) ] ,
2081
+ python_framework_prefix : None ,
2063
2082
} ;
2064
2083
let mut buf: Vec < u8 > = Vec :: new ( ) ;
2065
2084
config. to_writer ( & mut buf) . unwrap ( ) ;
@@ -2086,6 +2105,7 @@ mod tests {
2086
2105
build_flags: BuildFlags :: default ( ) ,
2087
2106
suppress_build_script_link_lines: false ,
2088
2107
extra_build_script_lines: vec![ ] ,
2108
+ python_framework_prefix: None ,
2089
2109
}
2090
2110
)
2091
2111
}
@@ -2108,6 +2128,7 @@ mod tests {
2108
2128
build_flags: BuildFlags :: default ( ) ,
2109
2129
suppress_build_script_link_lines: false ,
2110
2130
extra_build_script_lines: vec![ ] ,
2131
+ python_framework_prefix: None ,
2111
2132
}
2112
2133
)
2113
2134
}
@@ -2210,6 +2231,7 @@ mod tests {
2210
2231
version: PythonVersion :: PY37 ,
2211
2232
suppress_build_script_link_lines: false ,
2212
2233
extra_build_script_lines: vec![ ] ,
2234
+ python_framework_prefix: None ,
2213
2235
}
2214
2236
) ;
2215
2237
}
@@ -2239,6 +2261,7 @@ mod tests {
2239
2261
version: PythonVersion :: PY37 ,
2240
2262
suppress_build_script_link_lines: false ,
2241
2263
extra_build_script_lines: vec![ ] ,
2264
+ python_framework_prefix: None ,
2242
2265
}
2243
2266
) ;
2244
2267
@@ -2265,6 +2288,7 @@ mod tests {
2265
2288
version: PythonVersion :: PY37 ,
2266
2289
suppress_build_script_link_lines: false ,
2267
2290
extra_build_script_lines: vec![ ] ,
2291
+ python_framework_prefix: None ,
2268
2292
}
2269
2293
) ;
2270
2294
}
@@ -2288,6 +2312,7 @@ mod tests {
2288
2312
build_flags: BuildFlags :: default ( ) ,
2289
2313
suppress_build_script_link_lines: false ,
2290
2314
extra_build_script_lines: vec![ ] ,
2315
+ python_framework_prefix: None ,
2291
2316
}
2292
2317
) ;
2293
2318
}
@@ -2311,6 +2336,7 @@ mod tests {
2311
2336
build_flags: BuildFlags :: default ( ) ,
2312
2337
suppress_build_script_link_lines: false ,
2313
2338
extra_build_script_lines: vec![ ] ,
2339
+ python_framework_prefix: None ,
2314
2340
}
2315
2341
) ;
2316
2342
}
@@ -2345,6 +2371,7 @@ mod tests {
2345
2371
build_flags: BuildFlags :: default ( ) ,
2346
2372
suppress_build_script_link_lines: false ,
2347
2373
extra_build_script_lines: vec![ ] ,
2374
+ python_framework_prefix: None ,
2348
2375
}
2349
2376
) ;
2350
2377
}
@@ -2379,6 +2406,7 @@ mod tests {
2379
2406
build_flags: BuildFlags :: default ( ) ,
2380
2407
suppress_build_script_link_lines: false ,
2381
2408
extra_build_script_lines: vec![ ] ,
2409
+ python_framework_prefix: None ,
2382
2410
}
2383
2411
) ;
2384
2412
}
@@ -2413,6 +2441,7 @@ mod tests {
2413
2441
build_flags: BuildFlags :: default ( ) ,
2414
2442
suppress_build_script_link_lines: false ,
2415
2443
extra_build_script_lines: vec![ ] ,
2444
+ python_framework_prefix: None ,
2416
2445
}
2417
2446
) ;
2418
2447
}
@@ -2449,6 +2478,7 @@ mod tests {
2449
2478
build_flags: BuildFlags :: default ( ) ,
2450
2479
suppress_build_script_link_lines: false ,
2451
2480
extra_build_script_lines: vec![ ] ,
2481
+ python_framework_prefix: None ,
2452
2482
}
2453
2483
) ;
2454
2484
}
@@ -2796,6 +2826,7 @@ mod tests {
2796
2826
version : PythonVersion { major : 3 , minor : 7 } ,
2797
2827
suppress_build_script_link_lines : false ,
2798
2828
extra_build_script_lines : vec ! [ ] ,
2829
+ python_framework_prefix : None ,
2799
2830
} ;
2800
2831
2801
2832
config
@@ -2818,6 +2849,7 @@ mod tests {
2818
2849
version : PythonVersion { major : 3 , minor : 7 } ,
2819
2850
suppress_build_script_link_lines : false ,
2820
2851
extra_build_script_lines : vec ! [ ] ,
2852
+ python_framework_prefix : None ,
2821
2853
} ;
2822
2854
2823
2855
assert ! ( config
@@ -2882,6 +2914,7 @@ mod tests {
2882
2914
version: interpreter_config. version,
2883
2915
suppress_build_script_link_lines: false ,
2884
2916
extra_build_script_lines: vec![ ] ,
2917
+ python_framework_prefix: None ,
2885
2918
}
2886
2919
)
2887
2920
}
@@ -3006,6 +3039,7 @@ mod tests {
3006
3039
build_flags : BuildFlags :: default ( ) ,
3007
3040
suppress_build_script_link_lines : false ,
3008
3041
extra_build_script_lines : vec ! [ ] ,
3042
+ python_framework_prefix : None ,
3009
3043
} ;
3010
3044
assert_eq ! (
3011
3045
interpreter_config. build_script_outputs( ) ,
@@ -3045,6 +3079,7 @@ mod tests {
3045
3079
build_flags : BuildFlags :: default ( ) ,
3046
3080
suppress_build_script_link_lines : false ,
3047
3081
extra_build_script_lines : vec ! [ ] ,
3082
+ python_framework_prefix : None ,
3048
3083
} ;
3049
3084
3050
3085
assert_eq ! (
@@ -3092,6 +3127,7 @@ mod tests {
3092
3127
build_flags,
3093
3128
suppress_build_script_link_lines : false ,
3094
3129
extra_build_script_lines : vec ! [ ] ,
3130
+ python_framework_prefix : None ,
3095
3131
} ;
3096
3132
3097
3133
assert_eq ! (
@@ -3125,6 +3161,7 @@ mod tests {
3125
3161
build_flags,
3126
3162
suppress_build_script_link_lines : false ,
3127
3163
extra_build_script_lines : vec ! [ ] ,
3164
+ python_framework_prefix : None ,
3128
3165
} ;
3129
3166
3130
3167
assert_eq ! (
0 commit comments