fix(bindings): include headers & queries in python sdist

This commit is contained in:
ObserverOfTime 2024-11-18 17:23:35 +02:00 committed by Amaan Qureshi
parent 8eb4407200
commit a08c4b58ab

View file

@ -3,6 +3,7 @@ from platform import system
from setuptools import Extension, find_packages, setup
from setuptools.command.build import build
from setuptools.command.egg_info import egg_info
from wheel.bdist_wheel import bdist_wheel
sources = [
@ -10,7 +11,7 @@ sources = [
"src/parser.c",
]
if path.exists("src/scanner.c"):
sources.extend("src/scanner.c")
sources.append("src/scanner.c")
if system() != "Windows":
cflags = ["-std=c11", "-fvisibility=hidden"]
@ -34,6 +35,13 @@ class BdistWheel(bdist_wheel):
return python, abi, platform
class EggInfo(egg_info):
def find_sources(self):
super().find_sources()
self.filelist.recursive_include("queries", "*.scm")
self.filelist.include("src/tree_sitter/*.h")
setup(
packages=find_packages("bindings/python"),
package_dir={"": "bindings/python"},
@ -58,7 +66,8 @@ setup(
],
cmdclass={
"build": Build,
"bdist_wheel": BdistWheel
"bdist_wheel": BdistWheel,
"egg_info": EggInfo,
},
zip_safe=False
)