fix(bindings): improve python platform detection
(cherry picked from commit 99988b7081)
This commit is contained in:
parent
e920009d60
commit
3c0088f037
2 changed files with 8 additions and 4 deletions
|
|
@ -624,10 +624,15 @@ pub fn generate_grammar_files(
|
|||
allow_update,
|
||||
|path| generate_file(path, SETUP_PY_TEMPLATE, language_name, &generate_opts),
|
||||
|path| {
|
||||
let contents = fs::read_to_string(path)?;
|
||||
let mut contents = fs::read_to_string(path)?;
|
||||
if !contents.contains("egg_info") || !contents.contains("Py_GIL_DISABLED") {
|
||||
eprintln!("Replacing setup.py");
|
||||
generate_file(path, SETUP_PY_TEMPLATE, language_name, &generate_opts)?;
|
||||
} else {
|
||||
contents = contents
|
||||
.replace("path\nfrom platform import system", "name as os_name, path")
|
||||
.replace("system() != \"Windows\"", "os_name != \"nt\"");
|
||||
write_file(path, contents)?;
|
||||
}
|
||||
Ok(())
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue