Skip to content

Commit d58a1f2

Browse files
dependabot[bot]Jason Mobarak
and
Jason Mobarak
authored
Bump pyo3 from 0.13.2 to 0.15.0 (#227)
* Bump pyo3 from 0.13.2 to 0.15.0 Bumps [pyo3](https://github.com/pyo3/pyo3) from 0.13.2 to 0.14.5. - [Release notes](https://github.com/pyo3/pyo3/releases) - [Changelog](https://github.com/PyO3/pyo3/blob/main/CHANGELOG.md) - [Commits](PyO3/pyo3@v0.13.2...v0.14.5) --- updated-dependencies: - dependency-name: pyo3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * workaround for linking bug in pyo3 The pyo3 build script removes python library link directives if you're building an extension module. This is problem if you want to build a binary that links against Python and an extension module in the same project (like we are). Rust features are additive, so it leaves the "extension-module" feature enabled in the "shared" build of pyo3, this causes pyo3 to fail to emit linking directives when building the console binary. This only worked before because we were using two different versions of pyo3. Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jason Mobarak <[email protected]>
1 parent dcad705 commit d58a1f2

File tree

7 files changed

+53
-96
lines changed

7 files changed

+53
-96
lines changed

Diff for: Cargo.lock

+12-84
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[workspace]
22
members = ["console_backend", "entrypoint"]
3+
resolver = "2"
34

45
[profile.release]
56
lto = true

Diff for: Makefile.toml

+28-4
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ if eq ${os} windows
1111
set_env BACKEND_WHEEL console_backend-0.1.0-cp39-cp39-win_amd64.whl
1212
set_env BUILD_TRIPLET "x86_64-pc-windows-msvc"
1313
set_env PYO3_CONFIG_FILE "${WORKSPACE}\\standalone-py\\pyo3_config.txt"
14+
set_env CONSOLE_PYO3_CONFIG_FILE "${WORKSPACE}\\standalone-py\\pyo3_config.txt"
1415
elseif eq ${os} linux
1516
set_env STANDALONE_PY_URL "${STANDALONE_PY_BASE_URL}/cpython-3.9.7-x86_64-unknown-linux-gnu-pgo+lto-20211017T1616.tar.zst"
1617
set_env PYTHON "${WORKSPACE}/py39/bin/python3"
1718
set_env DIST_PYTHON "${WORKSPACE}/py39-dist/bin/python3"
1819
set_env PYSIDE2_RCC "${WORKSPACE}/py39/bin/pyside2-rcc"
1920
set_env BACKEND_WHEEL console_backend-0.1.0-cp39-cp39-linux_x86_64.whl
2021
set_env PYO3_CONFIG_FILE "${WORKSPACE}/standalone-py/pyo3_config.txt"
22+
set_env CONSOLE_PYO3_CONFIG_FILE "${WORKSPACE}/standalone-py/pyo3_config_console.txt"
2123
output = exec --fail-on-error gcc -dumpmachine
2224
triplet = trim ${output.stdout}
2325
set_env BUILD_TRIPLET ${triplet}
@@ -28,6 +30,7 @@ else
2830
set_env PYSIDE2_RCC "${WORKSPACE}/py39/bin/pyside2-rcc"
2931
set_env BACKEND_WHEEL console_backend-0.1.0-cp39-cp39-macosx_10_15_x86_64.whl
3032
set_env PYO3_CONFIG_FILE "${WORKSPACE}/standalone-py/pyo3_config.txt"
33+
set_env CONSOLE_PYO3_CONFIG_FILE "${WORKSPACE}/standalone-py/pyo3_config_console.txt"
3134
output = exec --fail-on-error gcc -dumpmachine
3235
triplet = trim ${output.stdout}
3336
set_env BUILD_TRIPLET ${triplet}
@@ -239,28 +242,40 @@ args = ["-m", "flit", "build", "--no-setup-py"]
239242
[tasks.build-backend-wheel]
240243
cwd = "console_backend"
241244
command = "${PYTHON}"
242-
args = ["setup.py", "bdist_wheel"]
245+
args = ["setup.py", "-vv", "bdist_wheel"]
243246

244247
[tasks.get-get-pip]
245248
script_runner = "@duckscript"
246249
script = '''
247250
wget -O ./get-pip.py https://bootstrap.pypa.io/get-pip.py
248251
'''
249252

253+
[tasks.write-pyo3-config-console]
254+
script_runner = "@duckscript"
255+
cwd = "standalone-py"
256+
condition = { files_not_exist = ["${CONSOLE_PYO3_CONFIG_FILE}"] }
257+
script = '''
258+
writefile pyo3_config_console.txt "implementation=CPython\nversion=3.9\nshared=true\nabi3=false\nlib_name=python3.9\nlib_dir=${WORKSPACE}/standalone-py/python/install/lib\nexecutable=${WORKSPACE}/standalone-py/python/install/bin/python3.9\npointer_width=64\nbuild_flags=WITH_THREAD\nsuppress_build_script_link_lines=false\nextra_build_script_line=cargo:rustc-link-lib=python3.9\nextra_build_script_line=cargo:rustc-link-search=${WORKSPACE}/standalone-py/python/install/lib\n"
259+
'''
260+
261+
[tasks.write-pyo3-config-console.windows]
262+
script_runner = "@duckscript"
263+
script = ""
264+
250265
[tasks.write-pyo3-config]
251266
script_runner = "@duckscript"
252267
cwd = "standalone-py"
253268
condition = { files_not_exist = ["${PYO3_CONFIG_FILE}"] }
254269
script = '''
255-
writefile pyo3_config.txt "implementation=CPython\nversion=3.9\nshared=true\nabi3=false\nlib_name=python3.9\nlib_dir=${WORKSPACE}/standalone-py/python/install/lib\nexecutable=${WORKSPACE}/standalone-py/python/install/bin/python3.9\npointer_width=64\nbuild_flags=WITH_THREAD\nsuppress_build_script_link_lines=false\n"
270+
writefile pyo3_config.txt "implementation=CPython\nversion=3.9\nshared=true\nabi3=false\nlib_name=python3.9\nlib_dir=${WORKSPACE}/standalone-py/python/install/lib\nexecutable=${WORKSPACE}/standalone-py/python/install/bin/python3.9\npointer_width=64\nbuild_flags=WITH_THREAD\nsuppress_build_script_link_lines=false\nextra_build_script_line=\n"
256271
'''
257272

258273
[tasks.write-pyo3-config.windows]
259274
script_runner = "@duckscript"
260275
cwd = "standalone-py"
261276
condition = { files_not_exist = ["${PYO3_CONFIG_FILE}"] }
262277
script = '''
263-
writefile pyo3_config.txt "implementation=CPython\nversion=3.9\nshared=true\nabi3=false\nlib_name=python39\nlib_dir=${WORKSPACE}\\standalone-py\\python\\install\\libs\nexecutable=${WORKSPACE}\\standalone-py\\python\\install\\python.exe\npointer_width=64\nbuild_flags=WITH_THREAD\nsuppress_build_script_link_lines=false\n"
278+
writefile pyo3_config.txt "implementation=CPython\nversion=3.9\nshared=true\nabi3=false\nlib_name=python39\nlib_dir=${WORKSPACE}\\standalone-py\\python\\install\\libs\nexecutable=${WORKSPACE}\\standalone-py\\python\\install\\python.exe\npointer_width=64\nbuild_flags=WITH_THREAD\nsuppress_build_script_link_lines=false\nextra_build_script_line=\n"
264279
'''
265280

266281
[tasks.get-standalone-py]
@@ -305,10 +320,19 @@ cd ../../..
305320
exec --fail-on-error ${DIST_PYTHON} ./get-pip.py
306321
'''
307322

308-
[tasks.build-console]
323+
[tasks.call-build-console-bin]
324+
private = true
309325
command = "cargo"
310326
args = ["build", "--release", "-vv", "--bin", "console"]
311327

328+
[tasks.build-console]
329+
env = { PYO3_CONFIG_FILE = "${CONSOLE_PYO3_CONFIG_FILE}" }
330+
dependencies = ["write-pyo3-config-console"]
331+
run_task = "call-build-console-bin"
332+
333+
[tasks.build-console.windows]
334+
dependencies = ["call-build-console-bin"]
335+
312336
[tasks.build-dist-install-console]
313337
dependencies = ["build-console"]
314338
script_runner = "@duckscript"

Diff for: console_backend/Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ capnp = "0.14"
1616
chrono = { version = "0.4", features = ["serde"] }
1717
csv = "1"
1818
paste = "1"
19-
pyo3 = { version = "0.13", features = ["extension-module"], optional = true }
19+
pyo3 = { version = "0.15", features = [
20+
"extension-module",
21+
"macros",
22+
], default-features = false, optional = true }
2023
serde = { version = "1.0.123", features = ["derive"] }
2124
tempfile = "3.2.0"
2225
ordered-float = "2.0"

Diff for: console_backend/src/server.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl ServerEndpoint {
4343
ServerEndpoint { server_send: None }
4444
}
4545

46-
#[text_signature = "($self, bytes, /)"]
46+
#[pyo3(text_signature = "($self, bytes, /)")]
4747
pub fn shutdown(&mut self) -> PyResult<()> {
4848
if let Some(server_send) = self.server_send.take() {
4949
drop(server_send);
@@ -55,7 +55,7 @@ impl ServerEndpoint {
5555
}
5656
}
5757

58-
#[text_signature = "($self, bytes, /)"]
58+
#[pyo3(text_signature = "($self, bytes, /)")]
5959
pub fn send_message(&mut self, bytes: &PyBytes) -> PyResult<()> {
6060
let byte_vec: Vec<u8> = bytes.extract().unwrap();
6161
if let Some(server_send) = &self.server_send {
@@ -80,7 +80,7 @@ impl Server {
8080
}
8181
}
8282

83-
#[text_signature = "($self, /)"]
83+
#[pyo3(text_signature = "($self, /)")]
8484
pub fn fetch_message(&mut self, py: Python) -> Option<PyObject> {
8585
let result = py.allow_threads(move || loop {
8686
if let Some(client_recv) = &self.client_recv {
@@ -109,7 +109,7 @@ impl Server {
109109
result.map(|result| PyBytes::new(py, &result).into())
110110
}
111111

112-
#[text_signature = "($self, /)"]
112+
#[pyo3(text_signature = "($self, /)")]
113113
pub fn start(&mut self) -> PyResult<ServerEndpoint> {
114114
attach_console();
115115
let (client_send, client_recv) = channel::unbounded();

Diff for: entrypoint/Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ name = "console"
44
version = "0.1.0"
55
description = "Starts the console with the correct python installation"
66
edition = "2018"
7-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
87

98
[dependencies]
10-
pyo3 = { version = "0.14.5", features = ["auto-initialize"] }
9+
pyo3 = { version = "0.15", features = [
10+
"auto-initialize",
11+
], default-features = false }
1112

1213
[[bin]]
1314
name = "console"

Diff for: standalone-py/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
*.*~
2-
pyo3_config.txt
2+
pyo3_config*.txt
33
py39.*
44
python/

0 commit comments

Comments
 (0)