Update Python build scripts for uniffi-rs 0.23.0

This commit is contained in:
thunderbiscuit 2023-02-27 20:04:32 -05:00
parent c93f292b0e
commit d08317775b
No known key found for this signature in database
GPG Key ID: 88253696EB836462
4 changed files with 20 additions and 22 deletions

1
bdk-python/MANIFEST.in Normal file
View File

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

View File

@ -2,10 +2,16 @@
set -euo pipefail set -euo pipefail
SCRIPT_DIR=$(dirname "$(realpath $0)")
PY_SRC="${SCRIPT_DIR}/src/bdkpython/"
echo "Generating bdk.py..." echo "Generating bdk.py..."
# GENERATE_PYTHON_BINDINGS_OUT="$PY_SRC" GENERATE_PYTHON_BINDINGS_FIXUP_LIB_PATH=bdkffi cargo run --manifest-path ./bdk-ffi/Cargo.toml --release --bin generate --features generate-python cd ../bdk-ffi/
# BDKFFI_BINDGEN_PYTHON_FIXUP_PATH=bdkffi cargo run --manifest-path ./bdk-ffi/Cargo.toml --package bdk-ffi-bindgen -- --language python --udl-file ./bdk-ffi/src/bdk.udl --out-dir ./src/bdkpython/ cargo run --features uniffi/cli --bin uniffi-bindgen generate src/bdk.udl --language python --out-dir ../bdk-python/src/bdkpython/ --no-format
BDKFFI_BINDGEN_OUTPUT_DIR="$PY_SRC" BDKFFI_BINDGEN_PYTHON_FIXUP_PATH=bdkffi cargo run --manifest-path ../bdk-ffi/Cargo.toml --package bdk-ffi-bindgen -- --language python --udl-file ../bdk-ffi/src/bdk.udl cargo build --features uniffi/cli --profile release-smaller
echo "Generating native binaries..."
mv ../target/release-smaller/libbdkffi.dylib ../bdk-python/src/bdkpython/libbdkffi.dylib
echo "Bundling bdkpython..."
cd ../bdk-python/
python3 setup.py --verbose bdist_wheel
echo "All done!"

View File

@ -1,9 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
import os
from setuptools import setup from setuptools import setup
from setuptools_rust import Binding, RustExtension
LONG_DESCRIPTION = """# bdkpython LONG_DESCRIPTION = """# bdkpython
The Python language bindings for the [Bitcoin Dev Kit](https://github.com/bitcoindevkit). The Python language bindings for the [Bitcoin Dev Kit](https://github.com/bitcoindevkit).
@ -52,22 +49,16 @@ balance = wallet.get_balance()
print(f"Wallet balance is: {balance.total}") print(f"Wallet balance is: {balance.total}")
""" """
rust_ext = RustExtension(
target="bdkpython.bdkffi",
path="../bdk-ffi/Cargo.toml",
binding=Binding.NoBinding,
)
setup( setup(
name='bdkpython', name="bdkpython",
version='0.28.0.dev0', version="0.28.0.dev0",
description="The Python language bindings for the Bitcoin Development Kit", description="The Python language bindings for the Bitcoin Development Kit",
long_description=LONG_DESCRIPTION, long_description=LONG_DESCRIPTION,
long_description_content_type='text/markdown', long_description_content_type="text/markdown",
rust_extensions=[rust_ext], include_package_data = True,
zip_safe=False, zip_safe=False,
packages=['bdkpython'], packages=["bdkpython"],
package_dir={'bdkpython': './src/bdkpython'}, package_dir={"bdkpython": "./src/bdkpython"},
url="https://github.com/bitcoindevkit/bdk-ffi", url="https://github.com/bitcoindevkit/bdk-ffi",
author="Alekos Filini <alekos.filini@gmail.com>, Steve Myers <steve@notmandatory.org>", author="Alekos Filini <alekos.filini@gmail.com>, Steve Myers <steve@notmandatory.org>",
license="MIT or Apache 2.0", license="MIT or Apache 2.0",

View File

@ -1 +1 @@
from bdkpython.bdk import * from bdkpython.bdk import *