-
-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathbuild.rs
More file actions
21 lines (20 loc) · 625 Bytes
/
build.rs
File metadata and controls
21 lines (20 loc) · 625 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use erg_common::python_util::{env_magic_number, env_python_version};
fn main() -> std::io::Result<()> {
let Some(version) = env_python_version() else {
panic!("Failed to get python version");
};
if version.major != 3 {
panic!("Python 3 is required");
}
println!(
"cargo:rustc-env=PYTHON_VERSION_MINOR={}",
version.minor.unwrap_or(11)
);
println!(
"cargo:rustc-env=PYTHON_VERSION_MICRO={}",
version.micro.unwrap_or(0)
);
let magic_number = env_magic_number();
println!("cargo:rustc-env=PYTHON_MAGIC_NUMBER={magic_number}");
Ok(())
}