MCPcopy Index your code
hub / github.com/RustPython/RustPython / build_time_vars

Function build_time_vars

crates/vm/src/stdlib/_sysconfigdata.rs:37–74  ·  view source on GitHub ↗
(vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

35
36 #[pyattr]
37 fn build_time_vars(vm: &VirtualMachine) -> PyDictRef {
38 let vars = vm.ctx.new_dict();
39 let multiarch = multiarch();
40 macro_rules! sysvars {
41 ($($key:literal => $value:expr),*$(,)?) => {{
42 $(vars.set_item($key, $value.to_pyobject(vm), vm).unwrap();)*
43 }};
44 }
45 sysvars! {
46 // Extension module suffix in CPython-compatible format
47 "EXT_SUFFIX" => format!(".rustpython313-{multiarch}.so"),
48 "MULTIARCH" => multiarch.clone(),
49 "RUST_MULTIARCH" => RUST_MULTIARCH,
50 // enough for tests to stop expecting urandom() to fail after restricting file resources
51 "HAVE_GETRANDOM" => 1,
52 // RustPython has no GIL (like free-threaded Python)
53 "Py_GIL_DISABLED" => 1,
54 "Py_DEBUG" => 0,
55 "ABIFLAGS" => "t",
56 // Compiler configuration for native extension builds
57 "CC" => "cc",
58 "CXX" => "c++",
59 "CFLAGS" => "",
60 "CPPFLAGS" => "",
61 "LDFLAGS" => "",
62 "LDSHARED" => "cc -shared",
63 "CCSHARED" => "",
64 "SHLIB_SUFFIX" => ".so",
65 "SO" => ".so",
66 "AR" => "ar",
67 "ARFLAGS" => "rcs",
68 "OPT" => "",
69 "BASECFLAGS" => "",
70 "BLDSHARED" => "cc -shared",
71 }
72 include!(concat!(env!("OUT_DIR"), "/env_vars.rs"));
73 vars
74 }
75}

Callers 1

module_execFunction · 0.85

Calls 2

multiarchFunction · 0.85
new_dictMethod · 0.80

Tested by

no test coverage detected