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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#[macro_export]
macro_rules! pyo3_built {
($py: ident, $info: ident) => {{
use ::pyo3::types::PyDict;
use ::pyo3::types::PyString;
let info = PyDict::new($py);
let build = PyDict::new($py);
build.set_item("rustc", $info::RUSTC)?;
build.set_item("rustc-version", $info::RUSTC_VERSION)?;
build.set_item("opt-level", $info::OPT_LEVEL)?;
build.set_item("debug", $info::DEBUG)?;
build.set_item("jobs", $info::NUM_JOBS)?;
info.set_item("build", build)?;
let dt = $py
.import("email.utils")?
.call1("parsedate_to_datetime", ($info::BUILT_TIME_UTC,))?;
info.set_item("info-time", dt)?;
let deps = PyDict::new($py);
for (name, version) in $info::DEPENDENCIES.iter() {
deps.set_item(name, version)?;
}
info.set_item("dependencies", deps)?;
let features = $info::FEATURES
.iter()
.map(|feat| PyString::new($py, feat)).collect::<Vec<_>>();
info.set_item("features", features)?;
let host = PyDict::new($py);
host.set_item("triple", $info::HOST)?;
info.set_item("host", host)?;
let target = PyDict::new($py);
target.set_item("arch", $info::CFG_TARGET_ARCH)?;
target.set_item("os", $info::CFG_OS)?;
target.set_item("family", $info::CFG_FAMILY)?;
target.set_item("env", $info::CFG_ENV)?;
target.set_item("triple", $info::TARGET)?;
target.set_item("endianness", $info::CFG_ENDIAN)?;
target.set_item("pointer-width", $info::CFG_POINTER_WIDTH)?;
target.set_item("profile", $info::PROFILE)?;
info.set_item("target", target)?;
info
}};
}