mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 15:32:23 -04:00
Update to PyO3 0.12
+ cargo raze by Damien
This commit is contained in:
parent
a079bb1820
commit
562ea403b3
10 changed files with 43 additions and 38 deletions
|
@ -248,7 +248,7 @@ alias(
|
||||||
|
|
||||||
alias(
|
alias(
|
||||||
name = "pyo3",
|
name = "pyo3",
|
||||||
actual = "@raze__pyo3__0_11_1//:pyo3",
|
actual = "@raze__pyo3__0_12_3//:pyo3",
|
||||||
tags = [
|
tags = [
|
||||||
"cargo-raze",
|
"cargo-raze",
|
||||||
"manual",
|
"manual",
|
||||||
|
|
12
cargo/Cargo.lock
generated
12
cargo/Cargo.lock
generated
|
@ -1573,9 +1573,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyo3"
|
name = "pyo3"
|
||||||
version = "0.11.1"
|
version = "0.12.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9ca8710ffa8211c9a62a8a3863c4267c710dc42a82a7fd29c97de465d7ea6b7d"
|
checksum = "a9b90d637542bbf29b140fdd38fa308424073fd2cdf641a5680aed8020145e3c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ctor",
|
"ctor",
|
||||||
"indoc",
|
"indoc",
|
||||||
|
@ -1589,9 +1589,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyo3-derive-backend"
|
name = "pyo3-derive-backend"
|
||||||
version = "0.11.1"
|
version = "0.12.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "58ad070bf6967b0d29ea74931ffcf9c6bbe8402a726e9afbeafadc0a287cc2b3"
|
checksum = "cee2c9fb095acb885ab7e85acc7c8e95da8c4bc7cc4b4ea64b566dfc8c91046a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -1600,9 +1600,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyo3cls"
|
name = "pyo3cls"
|
||||||
version = "0.11.1"
|
version = "0.12.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c3fa17e1ea569d0bf3b7c00f2a9eea831ca05e55dd76f1794c541abba1c64baa"
|
checksum = "f12fdd8a2f217d003c93f9819e3db1717b2e89530171edea4c0deadd90206f50"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pyo3-derive-backend",
|
"pyo3-derive-backend",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
|
@ -1624,32 +1624,32 @@ def raze_fetch_remote_crates():
|
||||||
|
|
||||||
maybe(
|
maybe(
|
||||||
http_archive,
|
http_archive,
|
||||||
name = "raze__pyo3__0_11_1",
|
name = "raze__pyo3__0_12_3",
|
||||||
url = "https://crates.io/api/v1/crates/pyo3/0.11.1/download",
|
url = "https://crates.io/api/v1/crates/pyo3/0.12.3/download",
|
||||||
type = "tar.gz",
|
type = "tar.gz",
|
||||||
sha256 = "9ca8710ffa8211c9a62a8a3863c4267c710dc42a82a7fd29c97de465d7ea6b7d",
|
sha256 = "a9b90d637542bbf29b140fdd38fa308424073fd2cdf641a5680aed8020145e3c",
|
||||||
strip_prefix = "pyo3-0.11.1",
|
strip_prefix = "pyo3-0.12.3",
|
||||||
build_file = Label("//cargo/remote:pyo3-0.11.1.BUILD.bazel"),
|
build_file = Label("//cargo/remote:pyo3-0.12.3.BUILD.bazel"),
|
||||||
)
|
)
|
||||||
|
|
||||||
maybe(
|
maybe(
|
||||||
http_archive,
|
http_archive,
|
||||||
name = "raze__pyo3_derive_backend__0_11_1",
|
name = "raze__pyo3_derive_backend__0_12_3",
|
||||||
url = "https://crates.io/api/v1/crates/pyo3-derive-backend/0.11.1/download",
|
url = "https://crates.io/api/v1/crates/pyo3-derive-backend/0.12.3/download",
|
||||||
type = "tar.gz",
|
type = "tar.gz",
|
||||||
sha256 = "58ad070bf6967b0d29ea74931ffcf9c6bbe8402a726e9afbeafadc0a287cc2b3",
|
sha256 = "cee2c9fb095acb885ab7e85acc7c8e95da8c4bc7cc4b4ea64b566dfc8c91046a",
|
||||||
strip_prefix = "pyo3-derive-backend-0.11.1",
|
strip_prefix = "pyo3-derive-backend-0.12.3",
|
||||||
build_file = Label("//cargo/remote:pyo3-derive-backend-0.11.1.BUILD.bazel"),
|
build_file = Label("//cargo/remote:pyo3-derive-backend-0.12.3.BUILD.bazel"),
|
||||||
)
|
)
|
||||||
|
|
||||||
maybe(
|
maybe(
|
||||||
http_archive,
|
http_archive,
|
||||||
name = "raze__pyo3cls__0_11_1",
|
name = "raze__pyo3cls__0_12_3",
|
||||||
url = "https://crates.io/api/v1/crates/pyo3cls/0.11.1/download",
|
url = "https://crates.io/api/v1/crates/pyo3cls/0.12.3/download",
|
||||||
type = "tar.gz",
|
type = "tar.gz",
|
||||||
sha256 = "c3fa17e1ea569d0bf3b7c00f2a9eea831ca05e55dd76f1794c541abba1c64baa",
|
sha256 = "f12fdd8a2f217d003c93f9819e3db1717b2e89530171edea4c0deadd90206f50",
|
||||||
strip_prefix = "pyo3cls-0.11.1",
|
strip_prefix = "pyo3cls-0.12.3",
|
||||||
build_file = Label("//cargo/remote:pyo3cls-0.11.1.BUILD.bazel"),
|
build_file = Label("//cargo/remote:pyo3cls-0.12.3.BUILD.bazel"),
|
||||||
)
|
)
|
||||||
|
|
||||||
maybe(
|
maybe(
|
||||||
|
|
|
@ -22,7 +22,7 @@ targets = [
|
||||||
genmode = "Remote"
|
genmode = "Remote"
|
||||||
default_gen_buildrs = true
|
default_gen_buildrs = true
|
||||||
|
|
||||||
[raze.crates.pyo3.'0.11.1']
|
[raze.crates.pyo3.'0.12.3']
|
||||||
data_attr = "glob([\"**\"])"
|
data_attr = "glob([\"**\"])"
|
||||||
|
|
||||||
[raze.crates.ring.'0.16.15']
|
[raze.crates.ring.'0.16.15']
|
||||||
|
|
|
@ -64,13 +64,14 @@ cargo_build_script(
|
||||||
"cargo-raze",
|
"cargo-raze",
|
||||||
"manual",
|
"manual",
|
||||||
],
|
],
|
||||||
version = "0.11.1",
|
version = "0.12.3",
|
||||||
visibility = ["//visibility:private"],
|
visibility = ["//visibility:private"],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Unsupported target "bench_dict" with type "bench" omitted
|
# Unsupported target "bench_dict" with type "bench" omitted
|
||||||
# Unsupported target "bench_list" with type "bench" omitted
|
# Unsupported target "bench_list" with type "bench" omitted
|
||||||
# Unsupported target "bench_pyobject" 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 "bench_tuple" with type "bench" omitted
|
||||||
# Unsupported target "common" with type "test" omitted
|
# Unsupported target "common" with type "test" omitted
|
||||||
|
|
||||||
|
@ -92,13 +93,13 @@ rust_library(
|
||||||
edition = "2018",
|
edition = "2018",
|
||||||
proc_macro_deps = [
|
proc_macro_deps = [
|
||||||
"@raze__ctor__0_1_16//:ctor",
|
"@raze__ctor__0_1_16//:ctor",
|
||||||
"@raze__pyo3cls__0_11_1//:pyo3cls",
|
"@raze__pyo3cls__0_12_3//:pyo3cls",
|
||||||
],
|
],
|
||||||
rustc_flags = [
|
rustc_flags = [
|
||||||
"--cap-lints=allow",
|
"--cap-lints=allow",
|
||||||
],
|
],
|
||||||
data = glob(["**"]),
|
data = glob(["**"]),
|
||||||
version = "0.11.1",
|
version = "0.12.3",
|
||||||
tags = [
|
tags = [
|
||||||
"cargo-raze",
|
"cargo-raze",
|
||||||
"manual",
|
"manual",
|
||||||
|
@ -127,6 +128,7 @@ rust_library(
|
||||||
# Unsupported target "test_dict_iter" with type "test" omitted
|
# Unsupported target "test_dict_iter" with type "test" omitted
|
||||||
# Unsupported target "test_dunder" with type "test" omitted
|
# Unsupported target "test_dunder" with type "test" omitted
|
||||||
# Unsupported target "test_exceptions" 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_gc" with type "test" omitted
|
||||||
# Unsupported target "test_getter_setter" with type "test" omitted
|
# Unsupported target "test_getter_setter" with type "test" omitted
|
||||||
# Unsupported target "test_inheritance" 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_sequence" with type "test" omitted
|
||||||
# Unsupported target "test_string" with type "test" omitted
|
# Unsupported target "test_string" with type "test" omitted
|
||||||
# Unsupported target "test_text_signature" 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_variable_arguments" with type "test" omitted
|
||||||
# Unsupported target "test_various" with type "test" omitted
|
# Unsupported target "test_various" with type "test" omitted
|
|
@ -45,7 +45,7 @@ rust_library(
|
||||||
rustc_flags = [
|
rustc_flags = [
|
||||||
"--cap-lints=allow",
|
"--cap-lints=allow",
|
||||||
],
|
],
|
||||||
version = "0.11.1",
|
version = "0.12.3",
|
||||||
tags = [
|
tags = [
|
||||||
"cargo-raze",
|
"cargo-raze",
|
||||||
"manual",
|
"manual",
|
|
@ -35,7 +35,7 @@ rust_library(
|
||||||
name = "pyo3cls",
|
name = "pyo3cls",
|
||||||
crate_type = "proc-macro",
|
crate_type = "proc-macro",
|
||||||
deps = [
|
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__quote__1_0_7//:quote",
|
||||||
"@raze__syn__1_0_48//:syn",
|
"@raze__syn__1_0_48//:syn",
|
||||||
],
|
],
|
||||||
|
@ -45,7 +45,7 @@ rust_library(
|
||||||
rustc_flags = [
|
rustc_flags = [
|
||||||
"--cap-lints=allow",
|
"--cap-lints=allow",
|
||||||
],
|
],
|
||||||
version = "0.11.1",
|
version = "0.12.3",
|
||||||
tags = [
|
tags = [
|
||||||
"cargo-raze",
|
"cargo-raze",
|
||||||
"manual",
|
"manual",
|
|
@ -6,7 +6,8 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
EXTRA_DEPS = [
|
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
|
import os
|
||||||
|
@ -39,6 +40,7 @@ with open("Cargo.toml", "w") as file:
|
||||||
file.write("\n".join(deps))
|
file.write("\n".join(deps))
|
||||||
|
|
||||||
subprocess.run(["cargo", "update"], check=True)
|
subprocess.run(["cargo", "update"], check=True)
|
||||||
shutil.rmtree("remote")
|
if os.path.exists("remote"):
|
||||||
|
shutil.rmtree("remote")
|
||||||
subprocess.run(["cargo-raze"], check=True)
|
subprocess.run(["cargo-raze"], check=True)
|
||||||
os.remove("Cargo.toml")
|
os.remove("Cargo.toml")
|
||||||
|
|
|
@ -12,7 +12,7 @@ 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.11.0"
|
version = "0.12.0"
|
||||||
features = ["extension-module"]
|
features = ["extension-module"]
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use anki::backend::{init_backend, Backend as RustBackend, BackendMethod};
|
use anki::backend::{init_backend, Backend as RustBackend, BackendMethod};
|
||||||
use pyo3::exceptions::Exception;
|
use pyo3::exceptions::PyException;
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
use pyo3::types::PyBytes;
|
use pyo3::types::PyBytes;
|
||||||
use pyo3::{create_exception, exceptions, wrap_pyfunction};
|
use pyo3::{create_exception, wrap_pyfunction};
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
// Regular backend
|
// Regular backend
|
||||||
|
@ -16,7 +16,7 @@ struct Backend {
|
||||||
backend: RustBackend,
|
backend: RustBackend,
|
||||||
}
|
}
|
||||||
|
|
||||||
create_exception!(_rsbridge, BackendError, Exception);
|
create_exception!(_rsbridge, BackendError, PyException);
|
||||||
|
|
||||||
#[pyfunction]
|
#[pyfunction]
|
||||||
fn buildhash() -> &'static str {
|
fn buildhash() -> &'static str {
|
||||||
|
@ -27,7 +27,7 @@ fn buildhash() -> &'static str {
|
||||||
fn open_backend(init_msg: &PyBytes) -> PyResult<Backend> {
|
fn open_backend(init_msg: &PyBytes) -> PyResult<Backend> {
|
||||||
match init_backend(init_msg.as_bytes()) {
|
match init_backend(init_msg.as_bytes()) {
|
||||||
Ok(backend) => Ok(Backend { backend }),
|
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);
|
let out_obj = PyBytes::new(py, &out_bytes);
|
||||||
out_obj.into()
|
out_obj.into()
|
||||||
})
|
})
|
||||||
.map_err(BackendError::py_err)
|
.map_err(BackendError::new_err)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This takes and returns JSON, due to Python's slow protobuf
|
/// This takes and returns JSON, due to Python's slow protobuf
|
||||||
|
@ -82,7 +82,7 @@ impl Backend {
|
||||||
let out_res = py.allow_threads(|| {
|
let out_res = py.allow_threads(|| {
|
||||||
self.backend
|
self.backend
|
||||||
.run_db_command_bytes(in_bytes)
|
.run_db_command_bytes(in_bytes)
|
||||||
.map_err(BackendError::py_err)
|
.map_err(BackendError::new_err)
|
||||||
});
|
});
|
||||||
let out_bytes = out_res?;
|
let out_bytes = out_res?;
|
||||||
let out_obj = PyBytes::new(py, &out_bytes);
|
let out_obj = PyBytes::new(py, &out_bytes);
|
||||||
|
|
Loading…
Reference in a new issue