Skip to content

Commit

Permalink
chore: fixed missing parsers in package data
Browse files Browse the repository at this point in the history
  • Loading branch information
Goldziher committed Jul 1, 2024
1 parent 8e5d02e commit 1023d83
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from itertools import chain
from os import environ, getcwd, listdir
from pathlib import Path
from platform import system
Expand Down Expand Up @@ -61,9 +62,16 @@ def create_extension(*, language_name: str) -> Extension:
)


# Get the mapped parsers
mapped_parsers = get_mapped_parsers()
# Create extensions for all languages defined in the JSON file
extensions = [create_extension(language_name=language_name) for language_name in mapped_parsers]
# Add the data files for the parsers
data_files = [
str(value)
for value in chain.from_iterable(list(parser_dir.iterdir()) for parser_dir in mapped_parsers.values())
if value.is_file()
]


class BuildExt(build_ext): # type: ignore[misc]
Expand Down Expand Up @@ -103,7 +111,8 @@ def get_tag(self) -> tuple[Any, Any, Any]:

setup(
packages=find_packages(include=["tree_sitter_language_pack", "tree_sitter_language_pack.bindings"]),
package_data={"tree_sitter_language_pack": ["py.typed"], "tree_sitter_language_pack.bindings": ["*.so"]},
package_data={"tree_sitter_language_pack": ["py.typed"]},
data_files=[("parsers", data_files)],
ext_modules=extensions,
include_package_data=True,
cmdclass={
Expand Down

0 comments on commit 1023d83

Please sign in to comment.