mirror of
https://github.com/tree-sitter/tree-sitter.git
synced 2026-09-10 07:26:23 -04:00
fix(cli): init --update should not update setup.py after replacing it (#5760)
This commit is contained in:
parent
8b7c213443
commit
8fe4f218fb
|
|
@ -1215,22 +1215,23 @@ fn update_python_setup_py(path: &Path, language_name: &str, opts: &GenerateOpts)
|
|||
if !contents.contains("build_ext") {
|
||||
info!("Replacing setup.py");
|
||||
generate_file(path, SETUP_PY_TEMPLATE, language_name, 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