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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,7 +3,7 @@
# See README.md # See README.md
EXTRA_DEPS = [ 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: # If you get a message like the following during a build:
@ -25,6 +25,8 @@ COMMITS_SHALLOW_SINCE = {
"4ded4a98ef339da0b7babd4efee3fbe8adaf746b": "1598739849 -0700", "4ded4a98ef339da0b7babd4efee3fbe8adaf746b": "1598739849 -0700",
# coarsetime # coarsetime
"f9e2c86216f0f4803bc75404828318fc206dab29": "1594611111 +1000", "f9e2c86216f0f4803bc75404828318fc206dab29": "1594611111 +1000",
# pyo3
"3b3ba4e3abd57bc3b8f86444b3f61e6e2f4c5fc1": "1603809036 +0900",
} }
import os import os

View file

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

View file

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