Skip to content

Commit 9707aeb

Browse files
Copilotyouknowone
andcommitted
fix: restore cross-target host env builds
Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/ca126bcb-b77c-4c2a-8ab1-545bbc828aa7 Co-authored-by: youknowone <[email protected]>
1 parent bd85062 commit 9707aeb

File tree

4 files changed

+6
-14
lines changed

4 files changed

+6
-14
lines changed

crates/host_env/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ num-traits = { workspace = true }
1616

1717
[target.'cfg(unix)'.dependencies]
1818
nix = { workspace = true }
19+
20+
[target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "redox")))'.dependencies]
1921
termios = "0.3.3"
2022

2123
[target.'cfg(windows)'.dependencies]

crates/host_env/src/fcntl.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
use std::io;
22

3-
#[cfg(target_os = "wasi")]
4-
fn ioctl_request(request: libc::c_ulong) -> libc::c_int {
5-
request as _
6-
}
7-
8-
#[cfg(not(target_os = "wasi"))]
9-
fn ioctl_request(request: libc::c_ulong) -> libc::c_ulong {
10-
request
11-
}
12-
133
pub fn fcntl_int(fd: i32, cmd: i32, arg: i32) -> io::Result<i32> {
144
let ret = unsafe { libc::fcntl(fd, cmd, arg) };
155
if ret < 0 {
@@ -37,7 +27,7 @@ pub unsafe fn ioctl_ptr(
3727
request: libc::c_ulong,
3828
arg: *mut libc::c_void,
3929
) -> io::Result<i32> {
40-
let ret = unsafe { libc::ioctl(fd, ioctl_request(request), arg) };
30+
let ret = unsafe { libc::ioctl(fd, request as _, arg) };
4131
if ret < 0 {
4232
Err(io::Error::last_os_error())
4333
} else {
@@ -46,7 +36,7 @@ pub unsafe fn ioctl_ptr(
4636
}
4737

4838
pub fn ioctl_int(fd: i32, request: libc::c_ulong, arg: i32) -> io::Result<i32> {
49-
let ret = unsafe { libc::ioctl(fd, ioctl_request(request), arg) };
39+
let ret = unsafe { libc::ioctl(fd, request as _, arg) };
5040
if ret < 0 {
5141
Err(io::Error::last_os_error())
5242
} else {

crates/vm/src/stdlib/msvcrt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ mod msvcrt {
88
PyRef, PyResult, VirtualMachine,
99
builtins::{PyBytes, PyStrRef},
1010
convert::IntoPyException,
11-
host_env::{crt_fd, suppress_iph},
11+
host_env::crt_fd,
1212
};
1313
use itertools::Itertools;
1414
use rustpython_host_env::msvcrt as host_msvcrt;

crates/vm/src/stdlib/nt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ pub(crate) mod module {
283283
}
284284

285285
fn win32_lchmod(path: &OsPath, mode: u32, vm: &VirtualMachine) -> PyResult<()> {
286-
host_nt::win32_lchmod(path.as_os_str(), mode, S_IWRITE)
286+
host_nt::win32_lchmod(path.path.as_os_str(), mode, S_IWRITE)
287287
.map_err(|err| OSErrorBuilder::with_filename(&err, path.clone(), vm))
288288
}
289289

0 commit comments

Comments
 (0)