File tree 2 files changed +4
-23
lines changed
2 files changed +4
-23
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import contextlib
4
4
import os
5
- import string
6
5
import sysconfig
7
6
import tempfile
8
7
from collections .abc import Generator , MutableMapping
9
8
from pathlib import Path
10
9
11
10
from .._logging import logger
12
- from ..resources import resources
13
11
14
12
__all__ = ["set_cross_compile_env" ]
15
13
@@ -47,25 +45,15 @@ def set_cross_compile_env(
47
45
yield
48
46
return
49
47
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
-
58
48
with tempfile .TemporaryDirectory () as tmpdir :
59
49
tmp_dir = Path (tmpdir ).resolve ()
60
50
cross_compile_file = (
61
51
tmp_dir / f"_cross_compile_{ ext_suffix .replace ('.' , '_' )} .py"
62
52
)
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 "
69
57
cross_compile_file .write_text (output_text )
70
58
current_path = env .get ("PYTHONPATH" , "" )
71
59
env ["PYTHONPATH" ] = (
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments