fix: include src/scanner.c in the source distribution - #345
Open
SidoJain wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #325
Bug
setup.py'sExtension(...)only listssrc/parser.cas a source.src/scanner.cgets appended dynamically at build time (if path.exists("src/scanner.c"): ext.sources.append(...)inBuildExt), which works from a git checkout but never tells setuptools' sdist file-collection thatscanner.cneeds to be packaged. There's noMANIFEST.ineither. So the sdist ships without it, the build succeeds silently (missing symbols only get caught at link time on import, not at compile time), and the only visible symptom is anImportErrorfor anyone installing from source.Fix
One line in
setup.py'sEggInfo.find_sources, matching the existing conditional style already used inBuildExtright above it:Note on CI
ci.yml's Python step runspip install -e .[core], an editable install straight from the checkout - it never builds or installs from an actual sdist, so it can't and won't catch this bug either way. I verified this manually instead (below), since there's no automated check to rely on.Verification (before)
ImportError: .../_binding.abi3.so: undefined symbol: tree_sitter_python_external_scanner_create
Verification (after)
Same steps, fresh venv, after the fix:
tree_sitter_python-0.25.0/src/scanner.c now present in the tarball