Adding build script for lingua-rs#8181
Conversation
Signed-off-by: Vijayv <vijay.vinnakota@ibm.com>
|
Here are last few lines from running the build script showing it as success along with test results.
tests/python/test_builder.py ........... [ 14%] =============================================================== 74 passed in 0.34s ================================================================
[root@onprem133723021 lingua-ubi-build]# |
| set -e | ||
|
|
||
| # Variables | ||
| PKG_NAME="lingua-language-detector" |
There was a problem hiding this comment.
| PKG_NAME="lingua-language-detector" | |
| PACKAGE_NAME="lingua-language-detector" |
| PKG_NAME="lingua-language-detector" | ||
| PKG_VERSION="2.2.0" | ||
| PKG_ORG="pemistahl" | ||
| PKG_REPO="lingua-rs" |
There was a problem hiding this comment.
Lets keep the variable name as per: https://github.com/ppc64le/build-scripts/blob/master/templates/build_script_python.sh#L23
| ln -sf /usr/bin/python3.12 /usr/bin/python3 | ||
| ln -sf /usr/bin/pip-3.12 /usr/bin/pip3 | ||
| ln -sf /usr/bin/python3.12 /usr/bin/python | ||
| ln -sf /usr/bin/pip-3.12 /usr/bin/pip |
There was a problem hiding this comment.
Normalize Python commands block not required, python version will be managed GHA.
| # ------------------------------------------------------------------------------ | ||
|
|
||
| sed -i \ | ||
| "s/^version = .*/version = \"${PKG_VERSION}+${IBM_SUFFIX}\"/" \ |
There was a problem hiding this comment.
We can skip this line, as we don't apply suffix in front of version.
|
|
||
| echo "Running upstream Python tests with pytest..." | ||
| pytest tests/python | ||
| if [ $? -ne 0 ]; then |
There was a problem hiding this comment.
Take a look here, this is how we execute test cases
There was a problem hiding this comment.
Done. Modified the script according to the template.
| fi | ||
|
|
||
| echo "" | ||
| echo "SUCCESS: ${PKG_NAME} ${PKG_VERSION} built and validated" |
There was a problem hiding this comment.
Generally we don't have this kind of messages at the end.
There was a problem hiding this comment.
Done. Removed the echo statement.
| { | ||
| "maintainer": "vijay-vinnakota", | ||
| "package_name": "lingua-language-detector", | ||
| "github_url": "https://github.com/pemistahl/lingua-rs", |
There was a problem hiding this comment.
Where we not able to build pkg from lingua-py?
There was a problem hiding this comment.
From version 2 on, the repo is lingua-rs
| # ------------------------------------------------------------------------------ | ||
| echo "Building wheel using maturin..." | ||
|
|
||
| maturin build --release --strip |
There was a problem hiding this comment.
You can build the pkg using pip as well
reference here
There was a problem hiding this comment.
While pip can invoke the build, lingua-rs is a PyO3‑based Rust extension package and the build configuration explicitly uses maturin as build backend as defined in repo's pyproject.toml file.
There was a problem hiding this comment.
Please ignore my above comment. I misunderstood your comment.
I have now changed the build command to use pip per the template.
|
|
||
| WHEEL_FILE="$(ls target/wheels/${PKG_NAME//-/_}-*.whl | head -n 1)" | ||
|
|
||
| if [[ ! -f "${WHEEL_FILE}" ]]; then |
There was a problem hiding this comment.
No need to locate wheel
There was a problem hiding this comment.
The wheel check is intentional—it resolves and validates the exact wheel filename produced by maturin before installation. Since the install step depends on this variable, the check helps fail early with clearer diagnostics. Essentially, treating the generated wheel filename validated before input for the installation step.
There was a problem hiding this comment.
Please ignore my above comment. I have removed all those lines now as they are not needed in my new updated script where i am using pip and not maturin.
Signed-off-by: Vijayv <vijay.vinnakota@ibm.com>
Signed-off-by: Vijayv <vijay.vinnakota@ibm.com>
Signed-off-by: Vijayv <vijay.vinnakota@ibm.com>
|
@cdeepali can you please help review this PR once as this is for a new package addition ? cc : @prachikurade1 |
|
@yussufsh PTAL |
|
@cdeepali can you please review the PR, as we want to merge PR |
Checklist
set -eoption enabled and observe success ?