forked from RustPython/RustPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsysconfigdata.rs
More file actions
25 lines (22 loc) · 807 Bytes
/
sysconfigdata.rs
File metadata and controls
25 lines (22 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use crate::VirtualMachine;
use crate::{IntoPyObject, ItemProtocol, PyObjectRef};
use crate::sysmodule::MULTIARCH;
pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
let vars = vm.ctx.new_dict();
macro_rules! sysvars {
($($key:literal => $value:expr),*$(,)?) => {{
$(vars.set_item($key, $value.into_pyobject(vm), vm).unwrap();)*
}};
}
sysvars! {
// fake shared module extension
"EXT_SUFFIX" => format!(".rustpython-{}", MULTIARCH),
"MULTIARCH" => MULTIARCH,
// enough for tests to stop expecting urandom() to fail after restricting file resources
"HAVE_GETRANDOM" => 1,
}
include!(concat!(env!("OUT_DIR"), "/env_vars.rs"));
py_module!(vm, "_sysconfigdata", {
"build_time_vars" => vars,
})
}