mirror of
https://github.com/Magnus167/msyrs.git
synced 2025-08-20 04:20:00 +00:00
feat: add build and install scripts for maturin integration
This commit is contained in:
parent
ed9d5d01a2
commit
3d2afa01a8
33
scripts/unix/build.sh
Normal file
33
scripts/unix/build.sh
Normal file
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# Exit immediately if a command exits with a non-zero status
|
||||
set -e
|
||||
|
||||
# Run "maturin --help". If it fails, print an error message and exit.
|
||||
if ! maturin --help > /dev/null 2>&1; then
|
||||
echo "Failed to run maturin --help" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Delete any existing build directory and create a new one.
|
||||
rm -rf ./build
|
||||
mkdir -p ./build
|
||||
|
||||
# Copy ./src/msyrs.pyi to ./msyrs.pyi.
|
||||
cp ./src/msyrs.pyi ./msyrs.pyi
|
||||
|
||||
# Build using maturin.
|
||||
maturin build --release --sdist --out ./build/
|
||||
|
||||
# Get the first wheel file found in the build directory.
|
||||
whl_file=$(ls ./build/*.whl 2>/dev/null | head -n 1)
|
||||
if [ -z "$whl_file" ]; then
|
||||
echo "No wheel file found in ./build" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Rename the wheel file from .whl to .zip.
|
||||
base_name="${whl_file%.whl}"
|
||||
mv "$whl_file" "${base_name}.zip"
|
||||
|
||||
# Delete the temporary .pyi file.
|
||||
rm ./msyrs.pyi
|
20
scripts/unix/install.sh
Normal file
20
scripts/unix/install.sh
Normal file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Ensure maturin is installed. For example, you can install it via:
|
||||
# pip install maturin
|
||||
|
||||
# Run "maturin --help". If it fails, print an error message and exit.
|
||||
if ! maturin --help > /dev/null 2>&1; then
|
||||
echo "Failed to run maturin --help" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Copy ./src/msyrs.pyi to the current directory as msyrs.pyi
|
||||
cp ./src/msyrs.pyi ./msyrs.pyi
|
||||
|
||||
# Run maturin develop in release mode.
|
||||
maturin develop --release
|
||||
|
||||
# Delete the temporary msyrs.pyi file.
|
||||
rm ./msyrs.pyi
|
Loading…
x
Reference in New Issue
Block a user