mirror of
https://github.com/tree-sitter/tree-sitter.git
synced 2026-09-10 07:36:22 -04:00
fix(cli): init --update should not update setup.py after replacing it (#5760)
Co-authored-by: Philipp <philipp.zander@tweag.io>
This commit is contained in:
parent
f9b9b39075
commit
c02f32485a
|
|
@ -976,22 +976,23 @@ pub fn generate_grammar_files(
|
|||
if !contents.contains("build_ext") {
|
||||
info!("Replacing setup.py");
|
||||
generate_file(path, SETUP_PY_TEMPLATE, language_name, &generate_opts)?;
|
||||
}
|
||||
if !contents.contains(" and not get_config_var") {
|
||||
info!("Updating Python free-threading support in setup.py");
|
||||
contents = contents.replace(
|
||||
r#"startswith("cp"):"#,
|
||||
r#"startswith("cp") and not get_config_var("Py_GIL_DISABLED"):"#
|
||||
);
|
||||
write_file(path, &contents)?;
|
||||
}
|
||||
if !contents.contains("include(\"src/*.c\")") {
|
||||
info!("Updating sdist file list in setup.py");
|
||||
let contents = contents.replace(
|
||||
"include(\"src/tree_sitter/*.h\")",
|
||||
"include(\"src/tree_sitter/*.h\")\n self.filelist.include(\"src/*.c\")",
|
||||
);
|
||||
write_file(path, &contents)?;
|
||||
} else {
|
||||
if !contents.contains(" and not get_config_var") {
|
||||
info!("Updating Python free-threading support in setup.py");
|
||||
contents = contents.replace(
|
||||
r#"startswith("cp"):"#,
|
||||
r#"startswith("cp") and not get_config_var("Py_GIL_DISABLED"):"#
|
||||
);
|
||||
write_file(path, &contents)?;
|
||||
}
|
||||
if !contents.contains("include(\"src/*.c\")") {
|
||||
info!("Updating sdist file list in setup.py");
|
||||
let contents = contents.replace(
|
||||
"include(\"src/tree_sitter/*.h\")",
|
||||
"include(\"src/tree_sitter/*.h\")\n self.filelist.include(\"src/*.c\")",
|
||||
);
|
||||
write_file(path, &contents)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Reference in a new issue