forked from PyYoshi/cChardet
-
Notifications
You must be signed in to change notification settings - Fork 7
Make system-uchardet a Meson feature option (auto/enabled/disabled) #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d89a156
Support building against a system uchardet library
mgorny c8bc48b
meson: make system-uchardet a feature option (auto/enabled/disabled)
wbarnha 10f3edd
ci: test building against a system uchardet
wbarnha 2f6b609
Merge pull request #65 from faust-streaming/claude/cchardet-ci-system…
wbarnha f45a26c
ci: set least-privilege permissions on system-uchardet workflow
wbarnha 7daf400
docs: warn packagers that a system uchardet detects non-UTF-8 less ac…
wbarnha 715b71b
Merge remote-tracking branch 'origin/master' into pr64work
claude b85755f
chore: bump version to 3.1.0
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| name: Test (system uchardet) | ||
|
|
||
| # Exercises the `system-uchardet` feature option (see meson.options): build | ||
| # cChardet against a system uchardet built from git and confirm the resulting | ||
| # extension links the shared library instead of the bundled sources. The | ||
| # regular Tests workflow only covers the bundled default. | ||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - master | ||
|
|
||
| # Least-privilege GITHUB_TOKEN: this workflow only checks out and builds the | ||
| # repository, so read access to its contents is all it needs. | ||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| system-uchardet: | ||
| name: Build against system uchardet (from git) | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| # meson's files() validates the vendored uchardet sources exist at | ||
| # configure time even for a system build, so the submodule still has | ||
| # to be checked out. | ||
| submodules: recursive | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Build and install uchardet from git | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y --no-install-recommends cmake ninja-build pkg-config | ||
| git clone --depth 1 \ | ||
| https://gitlab.freedesktop.org/uchardet/uchardet.git /tmp/uchardet-src | ||
| cmake -S /tmp/uchardet-src -B /tmp/uchardet-build \ | ||
| -G Ninja \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DCMAKE_INSTALL_PREFIX=/usr \ | ||
| -DBUILD_BINARY=OFF | ||
| sudo cmake --build /tmp/uchardet-build --target install | ||
| sudo ldconfig | ||
|
|
||
| - name: Confirm the system uchardet exposes the candidate API | ||
| run: | | ||
| pkg-config --exists uchardet | ||
| echo "system uchardet version: $(pkg-config --modversion uchardet)" | ||
| # `enabled`/`auto` reject a uchardet without this symbol; the last | ||
| # tagged release still reports 0.0.8 but only the git build ships it. | ||
| grep -q uchardet_get_n_candidates /usr/include/uchardet/uchardet.h | ||
|
|
||
| - name: Build cChardet against the system uchardet | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m pip install pytest | ||
| python -m pip install . \ | ||
| --config-settings=setup-args=-Dsystem-uchardet=enabled | ||
|
|
||
| - name: Verify the extension links the system libuchardet | ||
| run: | | ||
| so=$(python -c "import cchardet._cchardet as m; print(m.__file__)") | ||
| echo "built extension: $so" | ||
| ldd "$so" | ||
| # Fail if it did not link the shared system library -- i.e. it | ||
| # silently fell back to compiling the bundled sources. | ||
| ldd "$so" | grep -q libuchardet | ||
|
|
||
| - name: Run tests | ||
| run: python -m pytest src/tests | ||
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| option('system-uchardet', type: 'feature', value: 'disabled', | ||
| description: 'Build against the system uchardet library instead of the bundled copy. enabled: require the system library (hard fail if missing or too old); disabled: always use the bundled copy (the wheel default); auto: use the system library if it is new enough, else fall back to the bundled copy. Requires uchardet from git until upstream tags a release exposing uchardet_get_n_candidates.') |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| __version__ = '3.0.1' | ||
| __version__ = '3.1.0' |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.