fix(templates): add C source files to Python sdist

This commit is contained in:
ObserverOfTime 2026-07-07 18:19:03 +03:00 committed by Will Lillis
parent d2193f4dba
commit 805a7cd0ae
2 changed files with 10 additions and 1 deletions

View file

@ -1220,7 +1220,15 @@ fn update_python_setup_py(path: &Path, language_name: &str, opts: &GenerateOpts)
r#"startswith("cp"):"#,
r#"startswith("cp") and not get_config_var("Py_GIL_DISABLED"):"#,
);
write_file(path, contents)?;
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(())
}

View file

@ -42,6 +42,7 @@ class EggInfo(egg_info):
super().find_sources()
self.filelist.recursive_include("queries", "*.scm")
self.filelist.include("src/tree_sitter/*.h")
self.filelist.include("src/*.c")
setup(