mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Stop embedding build-time environment variables in _sysconfigdata (#8813)
crates/vm/build.rs wrote every environment variable of the build process into OUT_DIR/env_vars.rs, and _sysconfigdata included that file into build_time_vars. All build-machine environment variables ended up as string literals in the binary and were readable at runtime through sysconfig.get_config_vars(). Remove the dump and the include, and drop the now unused itertools build-dependency. build_time_vars keeps only the explicit entries. Fixes #8802 Assisted-by: Claude:claude-fable-5-1
This commit is contained in:
1 parent
d474353be5
commit
33182c444b
3 files changed
+1
-16
No files matched your search
@@ -91,7 +91,6 @@ wasm-bindgen = { workspace = true, optional = true }
|
||||
|
||||
[build-dependencies]
|
||||
glob = { workspace = true }
|
||||
itertools = { workspace = true }
|
||||
jiff = { workspace = true }
|
||||
|
||||
[lints]
|
||||
|
||||
+1
-14
@@ -3,12 +3,9 @@
|
||||
reason = "build scripts cannot use rustpython-host_env"
|
||||
)]
|
||||
|
||||
use itertools::Itertools;
|
||||
use jiff::{Timestamp, Zoned, tz::TimeZone};
|
||||
use std::{
|
||||
env,
|
||||
io::{self, prelude::*},
|
||||
path::PathBuf,
|
||||
env, io,
|
||||
process::Command,
|
||||
time::{SystemTime, UNIX_EPOCH},
|
||||
};
|
||||
@@ -53,16 +50,6 @@ fn main() {
|
||||
"cargo:rustc-env=RUSTPYTHON_TARGET_TRIPLE={}",
|
||||
env::var("TARGET").unwrap()
|
||||
);
|
||||
|
||||
let mut env_path = PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
||||
env_path.push("env_vars.rs");
|
||||
let mut f = std::fs::File::create(env_path).unwrap();
|
||||
write!(
|
||||
f,
|
||||
"sysvars! {{ {} }}",
|
||||
std::env::vars_os().format_with(", ", |(k, v), f| f(&format_args!("{k:?} => {v:?}")))
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
fn git_hash() -> String {
|
||||
|
||||
@@ -69,7 +69,6 @@ mod _sysconfigdata {
|
||||
"BASECFLAGS" => "",
|
||||
"BLDSHARED" => "cc -shared",
|
||||
}
|
||||
include!(concat!(env!("OUT_DIR"), "/env_vars.rs"));
|
||||
vars
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user