File tree Expand file tree Collapse file tree 2 files changed +4
-23
lines changed Expand file tree Collapse file tree 2 files changed +4
-23
lines changed Original file line number Diff line number Diff line change 22
33import contextlib
44import os
5- import string
65import sysconfig
76import tempfile
87from collections .abc import Generator , MutableMapping
98from pathlib import Path
109
1110from .._logging import logger
12- from ..resources import resources
1311
1412__all__ = ["set_cross_compile_env" ]
1513
@@ -47,25 +45,15 @@ def set_cross_compile_env(
4745 yield
4846 return
4947
50- sysconf_name = getattr (sysconfig , "_get_sysconfigdata_name" , lambda : None )()
51- if not sysconf_name :
52- logger .warning (
53- "Cross-compiling is not supported due to sysconfig._get_sysconfigdata_name missing."
54- )
55- yield
56- return
57-
5848 with tempfile .TemporaryDirectory () as tmpdir :
5949 tmp_dir = Path (tmpdir ).resolve ()
6050 cross_compile_file = (
6151 tmp_dir / f"_cross_compile_{ ext_suffix .replace ('.' , '_' )} .py"
6252 )
63- input_txt = resources .joinpath ("_cross_compile.py" ).read_text (encoding = "utf-8" )
64- output_text = string .Template (input_txt ).substitute (
65- host_name = sysconf_name ,
66- SOABI = ext_suffix .rsplit (maxsplit = 1 )[0 ],
67- EXT_SUFFIX = ext_suffix ,
68- )
53+ build_time_vars = sysconfig .get_config_vars ()
54+ build_time_vars ["EXT_SUFFIX" ] = ext_suffix
55+ build_time_vars ["SOABI" ] = ext_suffix .rsplit (maxsplit = 1 )[0 ]
56+ output_text = f"build_time_vars = { build_time_vars !r} \n "
6957 cross_compile_file .write_text (output_text )
7058 current_path = env .get ("PYTHONPATH" , "" )
7159 env ["PYTHONPATH" ] = (
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments