Update to PyO3 0.12

+ cargo raze by Damien
This commit is contained in:
Alan Du 2020-10-27 19:57:14 -04:00 committed by Damien Elmes
parent a079bb1820
commit 562ea403b3
10 changed files with 43 additions and 38 deletions

View File

@ -248,7 +248,7 @@ alias(
alias(
name = "pyo3",
actual = "@raze__pyo3__0_11_1//:pyo3",
actual = "@raze__pyo3__0_12_3//:pyo3",
tags = [
"cargo-raze",
"manual",

12
cargo/Cargo.lock generated
View File

@ -1573,9 +1573,9 @@ dependencies = [
[[package]]
name = "pyo3"
version = "0.11.1"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ca8710ffa8211c9a62a8a3863c4267c710dc42a82a7fd29c97de465d7ea6b7d"
checksum = "a9b90d637542bbf29b140fdd38fa308424073fd2cdf641a5680aed8020145e3c"
dependencies = [
"ctor",
"indoc",
@ -1589,9 +1589,9 @@ dependencies = [
[[package]]
name = "pyo3-derive-backend"
version = "0.11.1"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58ad070bf6967b0d29ea74931ffcf9c6bbe8402a726e9afbeafadc0a287cc2b3"
checksum = "cee2c9fb095acb885ab7e85acc7c8e95da8c4bc7cc4b4ea64b566dfc8c91046a"
dependencies = [
"proc-macro2",
"quote",
@ -1600,9 +1600,9 @@ dependencies = [
[[package]]
name = "pyo3cls"
version = "0.11.1"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3fa17e1ea569d0bf3b7c00f2a9eea831ca05e55dd76f1794c541abba1c64baa"
checksum = "f12fdd8a2f217d003c93f9819e3db1717b2e89530171edea4c0deadd90206f50"
dependencies = [
"pyo3-derive-backend",
"quote",

View File

@ -1624,32 +1624,32 @@ def raze_fetch_remote_crates():
maybe(
http_archive,
name = "raze__pyo3__0_11_1",
url = "https://crates.io/api/v1/crates/pyo3/0.11.1/download",
name = "raze__pyo3__0_12_3",
url = "https://crates.io/api/v1/crates/pyo3/0.12.3/download",
type = "tar.gz",
sha256 = "9ca8710ffa8211c9a62a8a3863c4267c710dc42a82a7fd29c97de465d7ea6b7d",
strip_prefix = "pyo3-0.11.1",
build_file = Label("//cargo/remote:pyo3-0.11.1.BUILD.bazel"),
sha256 = "a9b90d637542bbf29b140fdd38fa308424073fd2cdf641a5680aed8020145e3c",
strip_prefix = "pyo3-0.12.3",
build_file = Label("//cargo/remote:pyo3-0.12.3.BUILD.bazel"),
)
maybe(
http_archive,
name = "raze__pyo3_derive_backend__0_11_1",
url = "https://crates.io/api/v1/crates/pyo3-derive-backend/0.11.1/download",
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 = "58ad070bf6967b0d29ea74931ffcf9c6bbe8402a726e9afbeafadc0a287cc2b3",
strip_prefix = "pyo3-derive-backend-0.11.1",
build_file = Label("//cargo/remote:pyo3-derive-backend-0.11.1.BUILD.bazel"),
sha256 = "cee2c9fb095acb885ab7e85acc7c8e95da8c4bc7cc4b4ea64b566dfc8c91046a",
strip_prefix = "pyo3-derive-backend-0.12.3",
build_file = Label("//cargo/remote:pyo3-derive-backend-0.12.3.BUILD.bazel"),
)
maybe(
http_archive,
name = "raze__pyo3cls__0_11_1",
url = "https://crates.io/api/v1/crates/pyo3cls/0.11.1/download",
name = "raze__pyo3cls__0_12_3",
url = "https://crates.io/api/v1/crates/pyo3cls/0.12.3/download",
type = "tar.gz",
sha256 = "c3fa17e1ea569d0bf3b7c00f2a9eea831ca05e55dd76f1794c541abba1c64baa",
strip_prefix = "pyo3cls-0.11.1",
build_file = Label("//cargo/remote:pyo3cls-0.11.1.BUILD.bazel"),
sha256 = "f12fdd8a2f217d003c93f9819e3db1717b2e89530171edea4c0deadd90206f50",
strip_prefix = "pyo3cls-0.12.3",
build_file = Label("//cargo/remote:pyo3cls-0.12.3.BUILD.bazel"),
)
maybe(

View File

@ -22,7 +22,7 @@ targets = [
genmode = "Remote"
default_gen_buildrs = true
[raze.crates.pyo3.'0.11.1']
[raze.crates.pyo3.'0.12.3']
data_attr = "glob([\"**\"])"
[raze.crates.ring.'0.16.15']

View File

@ -64,13 +64,14 @@ cargo_build_script(
"cargo-raze",
"manual",
],
version = "0.11.1",
version = "0.12.3",
visibility = ["//visibility:private"],
)
# Unsupported target "bench_dict" with type "bench" omitted
# Unsupported target "bench_list" with type "bench" omitted
# Unsupported target "bench_pyobject" with type "bench" omitted
# Unsupported target "bench_set" with type "bench" omitted
# Unsupported target "bench_tuple" with type "bench" omitted
# Unsupported target "common" with type "test" omitted
@ -92,13 +93,13 @@ rust_library(
edition = "2018",
proc_macro_deps = [
"@raze__ctor__0_1_16//:ctor",
"@raze__pyo3cls__0_11_1//:pyo3cls",
"@raze__pyo3cls__0_12_3//:pyo3cls",
],
rustc_flags = [
"--cap-lints=allow",
],
data = glob(["**"]),
version = "0.11.1",
version = "0.12.3",
tags = [
"cargo-raze",
"manual",
@ -127,6 +128,7 @@ rust_library(
# Unsupported target "test_dict_iter" with type "test" omitted
# Unsupported target "test_dunder" with type "test" omitted
# Unsupported target "test_exceptions" with type "test" omitted
# Unsupported target "test_frompyobject" with type "test" omitted
# Unsupported target "test_gc" with type "test" omitted
# Unsupported target "test_getter_setter" with type "test" omitted
# Unsupported target "test_inheritance" with type "test" omitted
@ -138,5 +140,6 @@ rust_library(
# Unsupported target "test_sequence" with type "test" omitted
# Unsupported target "test_string" with type "test" omitted
# Unsupported target "test_text_signature" with type "test" omitted
# Unsupported target "test_unsendable_dict" with type "test" omitted
# Unsupported target "test_variable_arguments" with type "test" omitted
# Unsupported target "test_various" with type "test" omitted

View File

@ -45,7 +45,7 @@ rust_library(
rustc_flags = [
"--cap-lints=allow",
],
version = "0.11.1",
version = "0.12.3",
tags = [
"cargo-raze",
"manual",

View File

@ -35,7 +35,7 @@ rust_library(
name = "pyo3cls",
crate_type = "proc-macro",
deps = [
"@raze__pyo3_derive_backend__0_11_1//:pyo3_derive_backend",
"@raze__pyo3_derive_backend__0_12_3//:pyo3_derive_backend",
"@raze__quote__1_0_7//:quote",
"@raze__syn__1_0_48//:syn",
],
@ -45,7 +45,7 @@ rust_library(
rustc_flags = [
"--cap-lints=allow",
],
version = "0.11.1",
version = "0.12.3",
tags = [
"cargo-raze",
"manual",

View File

@ -6,7 +6,8 @@
#
EXTRA_DEPS = [
'pyo3 = { version = "0.11.0", features = ["extension-module"] }'
# when updating, the version number in raze.toml will need updating too
'pyo3 = { version = "0.12.0", features = ["extension-module"] }'
]
import os
@ -39,6 +40,7 @@ with open("Cargo.toml", "w") as file:
file.write("\n".join(deps))
subprocess.run(["cargo", "update"], check=True)
shutil.rmtree("remote")
if os.path.exists("remote"):
shutil.rmtree("remote")
subprocess.run(["cargo-raze"], check=True)
os.remove("Cargo.toml")

View File

@ -12,7 +12,7 @@ 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.11.0"
version = "0.12.0"
features = ["extension-module"]
[lib]

View File

@ -2,10 +2,10 @@
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use anki::backend::{init_backend, Backend as RustBackend, BackendMethod};
use pyo3::exceptions::Exception;
use pyo3::exceptions::PyException;
use pyo3::prelude::*;
use pyo3::types::PyBytes;
use pyo3::{create_exception, exceptions, wrap_pyfunction};
use pyo3::{create_exception, wrap_pyfunction};
use std::convert::TryFrom;
// Regular backend
@ -16,7 +16,7 @@ struct Backend {
backend: RustBackend,
}
create_exception!(_rsbridge, BackendError, Exception);
create_exception!(_rsbridge, BackendError, PyException);
#[pyfunction]
fn buildhash() -> &'static str {
@ -27,7 +27,7 @@ fn buildhash() -> &'static str {
fn open_backend(init_msg: &PyBytes) -> PyResult<Backend> {
match init_backend(init_msg.as_bytes()) {
Ok(backend) => Ok(Backend { backend }),
Err(e) => Err(exceptions::Exception::py_err(e)),
Err(e) => Err(PyException::new_err(e)),
}
}
@ -72,7 +72,7 @@ impl Backend {
let out_obj = PyBytes::new(py, &out_bytes);
out_obj.into()
})
.map_err(BackendError::py_err)
.map_err(BackendError::new_err)
}
/// This takes and returns JSON, due to Python's slow protobuf
@ -82,7 +82,7 @@ impl Backend {
let out_res = py.allow_threads(|| {
self.backend
.run_db_command_bytes(in_bytes)
.map_err(BackendError::py_err)
.map_err(BackendError::new_err)
});
let out_bytes = out_res?;
let out_obj = PyBytes::new(py, &out_bytes);