From eb2a863fba1535faf0fd1043190d74c0aabb71c8 Mon Sep 17 00:00:00 2001 From: mityax Date: Mon, 24 Apr 2023 14:51:56 +0200 Subject: [PATCH] feature: Update pyo3 version to 0.18.3 - template-dependent extensions conflicting with this pyo3 version need to either fix their dependency using a manifest-comment "//: ..." or migrate their code to the new pyo3 version. --- examples/test_workspace/crate_c/Cargo.toml | 2 +- rustimport/__main__.py | 2 +- rustimport/pre_processing/pyo3_template.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/test_workspace/crate_c/Cargo.toml b/examples/test_workspace/crate_c/Cargo.toml index c37ced1..751c030 100644 --- a/examples/test_workspace/crate_c/Cargo.toml +++ b/examples/test_workspace/crate_c/Cargo.toml @@ -25,5 +25,5 @@ name = "crate_c" crate-type = ["cdylib"] [dependencies] -pyo3 = { version = "0.16.5", features = ["extension-module"] } +pyo3 = { version = "0.18.3", features = ["extension-module"] } crate_b = { path = "../crate_b" } \ No newline at end of file diff --git a/rustimport/__main__.py b/rustimport/__main__.py index bb7a349..6cea0b3 100644 --- a/rustimport/__main__.py +++ b/rustimport/__main__.py @@ -54,7 +54,7 @@ crate-type = ["cdylib"] [dependencies] -pyo3 = { version = "0.16.2", features = ["extension-module"] } +pyo3 = { version = "0.18.3", features = ["extension-module"] } """ diff --git a/rustimport/pre_processing/pyo3_template.py b/rustimport/pre_processing/pyo3_template.py index f532d33..8dfc4e1 100644 --- a/rustimport/pre_processing/pyo3_template.py +++ b/rustimport/pre_processing/pyo3_template.py @@ -25,7 +25,7 @@ def __generate_manifest(self) -> bytes: 'crate-type': ['cdylib'], }, 'dependencies': { - 'pyo3': {'version': '0.16.2', 'features': ['extension-module']} + 'pyo3': {'version': '0.18.3', 'features': ['extension-module']} } }) @@ -37,7 +37,7 @@ def __process_content(self) -> bytes: def __generate_pymodule(self) -> bytes: # A rather rudimentary implementation of generating PyO3 the "pymodule" macro's contents functions = re.finditer( - rb'#\[pyfunction.*\s*(?:\w+\s+)*?(?:#\[pyo3.*)?\s*(?:\w+\s+)*?fn\s+([\w0-9]+)', self.contents, re.MULTILINE + rb'#\[pyfunction.*\s*(?:\w+\s+)*?(?:#\[pyo3.*)?\s*(?:\w+\s+)*?fn\s+([\w0-9]+)', self.contents, re.MULTILINE ) structs = re.finditer(rb'#\[pyclass]\s*(?:\w+\s+)*?(?:struct|enum)\s+([\w0-9]+)', self.contents, re.MULTILINE)