diff --git a/.github/workflows/build-python-wheels.yaml b/.github/workflows/build-python-wheels.yaml index 75a15aa..184dc58 100644 --- a/.github/workflows/build-python-wheels.yaml +++ b/.github/workflows/build-python-wheels.yaml @@ -16,8 +16,8 @@ on: jobs: build-manylinux2014-x86_64-wheel: - name: 'Build Manylinux 2014 x86_64 wheel' - runs-on: ubuntu-latest + name: 'Build Manylinux 2014 x86_64 wheels' + runs-on: ubuntu-22.04 defaults: run: working-directory: bdk-python @@ -49,17 +49,15 @@ jobs: - name: generate bindings run: bash generate.sh - name: build wheel - run: ${PYBIN}/pip wheel . --no-deps -w /tmp/wheelhouse - - name: repair wheel - run: auditwheel repair /tmp/wheelhouse/* --plat "$PLAT" -w /tmp/wheelhouse-repaired + run: ${PYBIN}/python setup.py bdist_wheel --verbose - uses: actions/upload-artifact@v2 with: name: bdkpython-manylinux2014-x86_64-${{ matrix.python }} - path: /tmp/wheelhouse-repaired/*.whl + path: ./dist/*.whl build-macos-universal-wheel: - name: 'Build macOS universal wheel' - runs-on: macos-latest + name: 'Build macOS universal wheels' + runs-on: macos-12 defaults: run: working-directory: bdk-python @@ -81,20 +79,19 @@ jobs: - run: python3 --version - run: rustup target add aarch64-apple-darwin - run: pip3 install --user -r requirements.txt - - run: pip3 install --user wheel - run: bash generate.sh - name: build wheel env: ARCHFLAGS: "-arch x86_64 -arch arm64" - run: python3 setup.py -v bdist_wheel + run: python3 setup.py bdist_wheel --verbose - uses: actions/upload-artifact@v2 with: name: bdkpython-macos-${{ matrix.python }} path: /Users/runner/work/bdk-ffi/bdk-ffi/bdk-python/dist/*.whl build-windows-wheel: - name: 'Build windows wheel' - runs-on: windows-latest + name: 'Build Windows wheels' + runs-on: windows-2022 defaults: run: working-directory: bdk-python @@ -116,10 +113,8 @@ jobs: - run: python --version - run: pip install --user -r requirements.txt - run: bash generate.sh - shell: bash - - run: pip install --user wheel - name: build wheel - run: python setup.py -v bdist_wheel + run: python setup.py bdist_wheel --verbose - uses: actions/upload-artifact@v2 with: name: bdkpython-win-${{ matrix.python }} diff --git a/bdk-ffi/Cargo.toml b/bdk-ffi/Cargo.toml index c612219..7848668 100644 --- a/bdk-ffi/Cargo.toml +++ b/bdk-ffi/Cargo.toml @@ -8,6 +8,7 @@ license = "MIT OR Apache-2.0" [lib] crate-type = ["lib", "staticlib", "cdylib"] #crate-type = ["staticlib", "cdylib"] +#crate-type = ["cdylib"] name = "bdkffi" [[bin]] diff --git a/bdk-python/MANIFEST.in b/bdk-python/MANIFEST.in index f1c5a14..b3702f7 100644 --- a/bdk-python/MANIFEST.in +++ b/bdk-python/MANIFEST.in @@ -1 +1,2 @@ include ./src/bdkpython/libbdkffi.dylib +include ./src/bdkpython/libbdkffi.so diff --git a/bdk-python/README.md b/bdk-python/README.md index 4cc8ed9..33f2105 100644 --- a/bdk-python/README.md +++ b/bdk-python/README.md @@ -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--py3-none-any.whl +pip3 install ./dist/bdkpython--py3-none-any.whl --force-reinstall python -m unittest --verbose tests/test_bdk.py ``` diff --git a/bdk-python/generate.sh b/bdk-python/generate.sh index e93fa2e..d3dafca 100644 --- a/bdk-python/generate.sh +++ b/bdk-python/generate.sh @@ -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!" diff --git a/bdk-python/requirements.txt b/bdk-python/requirements.txt index d6ba728..959ed44 100644 --- a/bdk-python/requirements.txt +++ b/bdk-python/requirements.txt @@ -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