Fix build issues due to maturin & py03 versions (#37)

* bump maturin and pyo3 versions

* update to support MacOS dylib extentions

* update package config to use a build.rs and fix  linking issue on macOS see  https://pyo3.rs/master/building_and_distribution.html#macos
master
Nicolas Brousse 2022-01-03 05:50:19 -08:00 committed by GitHub
parent df205492b4
commit eba3f60346
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 7 deletions

View File

@ -10,6 +10,9 @@ license = "MIT"
name = "tantivy" name = "tantivy"
crate-type = ["cdylib"] crate-type = ["cdylib"]
[build-dependencies]
pyo3-build-config = "0.15.1"
[dependencies] [dependencies]
chrono = "0.4.19" chrono = "0.4.19"
tantivy = "0.13.2" tantivy = "0.13.2"
@ -17,7 +20,7 @@ itertools = "0.9.0"
futures = "0.3.5" futures = "0.3.5"
[dependencies.pyo3] [dependencies.pyo3]
version = "0.13.2" version = "0.14.5"
features = ["extension-module"] features = ["extension-module"]
[package.metadata.maturin] [package.metadata.maturin]

View File

@ -1,17 +1,23 @@
ifeq ($(shell UNAME),Darwin)
EXT := dylib
else
EXT := so
endif
source_files := $(wildcard src/*.rs) source_files := $(wildcard src/*.rs)
all: tantivy/tantivy.so all: tantivy/tantivy.$(EXT)
PHONY: test format PHONY: test format
test: tantivy/tantivy.so test: tantivy/tantivy.$(EXT)
python3 -m pytest python3 -m pytest
format: format:
rustfmt src/*.rs rustfmt src/*.rs
tantivy/tantivy.so: target/debug/libtantivy.so tantivy/tantivy.$(EXT): target/debug/libtantivy.$(EXT)
cp target/debug/libtantivy.so tantivy/tantivy.so cp target/debug/libtantivy.$(EXT) tantivy/tantivy.so
target/debug/libtantivy.so: $(source_files) target/debug/libtantivy.$(EXT): $(source_files)
cargo build cargo build

View File

@ -4,7 +4,7 @@ url = "https://pypi.org/simple"
verify_ssl = true verify_ssl = true
[dev-packages] [dev-packages]
maturin = ">=0.7.7" maturin = ">=0.12.0"
pytest = ">=4.0" pytest = ">=4.0"
e1839a8 = {path = "."} e1839a8 = {path = "."}

3
build.rs Normal file
View File

@ -0,0 +1,3 @@
fn main() {
pyo3_build_config::add_extension_module_link_args();
}