Fix Python build workflow to account for Linux/Windows

This commit is contained in:
thunderbiscuit
2023-02-28 14:24:51 -05:00
parent 90763d42a2
commit 488edf8bd2
6 changed files with 29 additions and 22 deletions

View File

@@ -1 +1,2 @@
include ./src/bdkpython/libbdkffi.dylib
include ./src/bdkpython/libbdkffi.so

View File

@@ -13,8 +13,7 @@ pip install bdkpython
```shell
pip3 install --requirement requirements.txt
bash ./generate.sh
python3 setup.py --verbose bdist_wheel
pip3 install ./dist/bdkpython-<yourversion>-py3-none-any.whl
pip3 install ./dist/bdkpython-<yourversion>-py3-none-any.whl --force-reinstall
python -m unittest --verbose tests/test_bdk.py
```

View File

@@ -1,17 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
OS=$(uname -s)
echo "Generating bdk.py..."
cd ../bdk-ffi/
cargo run --features uniffi/cli --bin uniffi-bindgen generate src/bdk.udl --language python --out-dir ../bdk-python/src/bdkpython/ --no-format
cargo build --features uniffi/cli --profile release-smaller
echo "Generating native binaries..."
mv ../target/release-smaller/libbdkffi.dylib ../bdk-python/src/bdkpython/libbdkffi.dylib
cargo build --features uniffi/cli --profile release-smaller
case $OS in
"Darwin")
echo "Copying macOS libbdkffi.dylib..."
cp ../target/release-smaller/libbdkffi.dylib ../bdk-python/src/bdkpython/libbdkffi.dylib
;;
"Linux")
echo "Copying linux libbdkffi.so..."
cp ../target/release-smaller/libbdkffi.so ../bdk-python/src/bdkpython/libbdkffi.so
;;
esac
echo "Bundling bdkpython..."
# echo "Bundling bdkpython..."
cd ../bdk-python/
python3 setup.py --verbose bdist_wheel
# python setup.py --verbose bdist_wheel
echo "All done!"

View File

@@ -1,3 +1,4 @@
semantic-version==2.9.0
setuptools-rust==1.1.2
typing_extensions==4.0.1
setuptools==67.4.0
wheel==0.38.4