switch to the stable Python ABI

Should allow the library to be imported in both Python 3.8+3.9.
This commit is contained in:
Damien Elmes 2020-11-03 15:31:58 +10:00
parent 3c12cb1600
commit 9fe53ff549
8 changed files with 29 additions and 27 deletions

9
cargo/Cargo.lock generated
View file

@ -1495,8 +1495,7 @@ dependencies = [
[[package]]
name = "pyo3"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9b90d637542bbf29b140fdd38fa308424073fd2cdf641a5680aed8020145e3c"
source = "git+https://github.com/PyO3/pyo3.git?rev=3b3ba4e3abd57bc3b8f86444b3f61e6e2f4c5fc1#3b3ba4e3abd57bc3b8f86444b3f61e6e2f4c5fc1"
dependencies = [
"ctor",
"indoc",
@ -1511,8 +1510,7 @@ dependencies = [
[[package]]
name = "pyo3-derive-backend"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cee2c9fb095acb885ab7e85acc7c8e95da8c4bc7cc4b4ea64b566dfc8c91046a"
source = "git+https://github.com/PyO3/pyo3.git?rev=3b3ba4e3abd57bc3b8f86444b3f61e6e2f4c5fc1#3b3ba4e3abd57bc3b8f86444b3f61e6e2f4c5fc1"
dependencies = [
"proc-macro2",
"quote",
@ -1522,8 +1520,7 @@ dependencies = [
[[package]]
name = "pyo3cls"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f12fdd8a2f217d003c93f9819e3db1717b2e89530171edea4c0deadd90206f50"
source = "git+https://github.com/PyO3/pyo3.git?rev=3b3ba4e3abd57bc3b8f86444b3f61e6e2f4c5fc1#3b3ba4e3abd57bc3b8f86444b3f61e6e2f4c5fc1"
dependencies = [
"pyo3-derive-backend",
"quote",

View file

@ -1572,33 +1572,33 @@ def raze_fetch_remote_crates():
)
maybe(
http_archive,
new_git_repository,
name = "raze__pyo3__0_12_3",
url = "https://crates.io/api/v1/crates/pyo3/0.12.3/download",
type = "tar.gz",
sha256 = "a9b90d637542bbf29b140fdd38fa308424073fd2cdf641a5680aed8020145e3c",
strip_prefix = "pyo3-0.12.3",
remote = "https://github.com/PyO3/pyo3.git",
shallow_since = "1603809036 +0900",
commit = "3b3ba4e3abd57bc3b8f86444b3f61e6e2f4c5fc1",
build_file = Label("//cargo/remote:pyo3-0.12.3.BUILD.bazel"),
init_submodules = True,
)
maybe(
http_archive,
new_git_repository,
name = "raze__pyo3_derive_backend__0_12_3",
url = "https://crates.io/api/v1/crates/pyo3-derive-backend/0.12.3/download",
type = "tar.gz",
sha256 = "cee2c9fb095acb885ab7e85acc7c8e95da8c4bc7cc4b4ea64b566dfc8c91046a",
strip_prefix = "pyo3-derive-backend-0.12.3",
remote = "https://github.com/PyO3/pyo3.git",
shallow_since = "1603809036 +0900",
commit = "3b3ba4e3abd57bc3b8f86444b3f61e6e2f4c5fc1",
build_file = Label("//cargo/remote:pyo3-derive-backend-0.12.3.BUILD.bazel"),
init_submodules = True,
)
maybe(
http_archive,
new_git_repository,
name = "raze__pyo3cls__0_12_3",
url = "https://crates.io/api/v1/crates/pyo3cls/0.12.3/download",
type = "tar.gz",
sha256 = "f12fdd8a2f217d003c93f9819e3db1717b2e89530171edea4c0deadd90206f50",
strip_prefix = "pyo3cls-0.12.3",
remote = "https://github.com/PyO3/pyo3.git",
shallow_since = "1603809036 +0900",
commit = "3b3ba4e3abd57bc3b8f86444b3f61e6e2f4c5fc1",
build_file = Label("//cargo/remote:pyo3cls-0.12.3.BUILD.bazel"),
init_submodules = True,
)
maybe(

View file

@ -47,6 +47,7 @@ cargo_build_script(
"--cap-lints=allow",
],
crate_features = [
"abi3",
"ctor",
"default",
"extension-module",
@ -105,6 +106,7 @@ rust_library(
"manual",
],
crate_features = [
"abi3",
"ctor",
"default",
"extension-module",

View file

@ -40,7 +40,7 @@ rust_library(
"@raze__syn__1_0_48//:syn",
],
srcs = glob(["**/*.rs"]),
crate_root = "src/lib.rs",
crate_root = "pyo3-derive-backend/src/lib.rs",
edition = "2018",
rustc_flags = [
"--cap-lints=allow",

View file

@ -40,7 +40,7 @@ rust_library(
"@raze__syn__1_0_48//:syn",
],
srcs = glob(["**/*.rs"]),
crate_root = "src/lib.rs",
crate_root = "pyo3cls/src/lib.rs",
edition = "2018",
rustc_flags = [
"--cap-lints=allow",

View file

@ -3,7 +3,7 @@
# See README.md
EXTRA_DEPS = [
'pyo3 = { version = "0.12.3", features = ["extension-module"] }'
'pyo3 = { git = "https://github.com/PyO3/pyo3.git", rev = "3b3ba4e3abd57bc3b8f86444b3f61e6e2f4c5fc1", features = ["extension-module", "abi3"] }'
]
# If you get a message like the following during a build:
@ -25,6 +25,8 @@ COMMITS_SHALLOW_SINCE = {
"4ded4a98ef339da0b7babd4efee3fbe8adaf746b": "1598739849 -0700",
# coarsetime
"f9e2c86216f0f4803bc75404828318fc206dab29": "1594611111 +1000",
# pyo3
"3b3ba4e3abd57bc3b8f86444b3f61e6e2f4c5fc1": "1603809036 +0900",
}
import os

View file

@ -12,8 +12,9 @@ anki = { path = "../../rslib" }
# WARNING: if changing the version number here, the version in ../../cargo/update.py
# needs to be updated as well
[dependencies.pyo3]
version = "0.12.0"
features = ["extension-module"]
git = "https://github.com/PyO3/pyo3.git"
rev = "3b3ba4e3abd57bc3b8f86444b3f61e6e2f4c5fc1"
features = ["extension-module", "abi3"]
[lib]
name = "rsbridge"

View file

@ -11,7 +11,7 @@ use std::convert::TryFrom;
// Regular backend
//////////////////////////////////
#[pyclass]
#[pyclass(module = "_rsbridge")]
struct Backend {
backend: RustBackend,
}