Skip to content

Commit 573b495

Browse files
committed
Fix iOS build
1 parent 1daf2f1 commit 573b495

File tree

7 files changed

+22
-8
lines changed

7 files changed

+22
-8
lines changed

.github/workflows/ci.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ jobs:
132132
- name: Check compilation for Apple Silicon
133133
run: cargo check --target aarch64-apple-darwin
134134
if: runner.os == 'macOS'
135+
- name: prepare iOS build
136+
uses: dtolnay/rust-toolchain@stable
137+
with:
138+
target: aarch64-apple-ios
139+
if: runner.os == 'macOS'
140+
- name: Check compilation for iOS
141+
run: cargo check --target aarch64-apple-ios
142+
if: runner.os == 'macOS'
135143

136144
exotic_targets:
137145
name: Ensure compilation on various targets

stdlib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ ascii = "1.0.0"
6969
memmap2 = "0.5.4"
7070
page_size = "0.4"
7171

72-
[target.'cfg(all(unix, not(target_os = "redox")))'.dependencies]
72+
[target.'cfg(all(unix, not(target_os = "redox"), not(target_os = "ios")))'.dependencies]
7373
termios = "0.3.3"
7474

7575
[features]

stdlib/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ mod scproxy;
4949
mod select;
5050
#[cfg(all(not(target_arch = "wasm32"), feature = "ssl"))]
5151
mod ssl;
52-
#[cfg(all(unix, not(target_os = "redox")))]
52+
#[cfg(all(unix, not(target_os = "redox"), not(target_os = "ios")))]
5353
mod termios;
5454

5555
use rustpython_common as common;
@@ -118,9 +118,12 @@ pub fn get_module_inits() -> impl Iterator<Item = (Cow<'static, str>, StdlibInit
118118
{
119119
"_ssl" => ssl::make_module,
120120
}
121-
#[cfg(all(unix, not(target_os = "redox")))]
121+
#[cfg(all(unix, not(target_os = "redox"), not(target_os = "ios")))]
122122
{
123123
"termios" => termios::make_module,
124+
}
125+
#[cfg(all(unix, not(target_os = "redox")))]
126+
{
124127
"resource" => resource::make_module,
125128
}
126129
#[cfg(unix)]

stdlib/src/posixsubprocess.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ fn close_fds(above: i32, keep: &[i32]) -> nix::Result<()> {
217217
target_os = "freebsd",
218218
target_os = "netbsd",
219219
target_os = "openbsd",
220-
target_os = "macos",
220+
target_vendor = "apple",
221221
))]
222222
const FD_DIR_NAME: &[u8] = b"/dev/fd\0";
223223

vm/src/stdlib/posix.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ pub mod module {
444444
)
445445
})
446446
}
447-
#[cfg(not(target_os = "macos"))]
447+
#[cfg(not(target_vendor = "apple"))]
448448
fn mknod(self, vm: &VirtualMachine) -> PyResult<()> {
449449
let ret = match self.dir_fd.get_opt() {
450450
None => self._mknod(vm)?,
@@ -463,7 +463,7 @@ pub mod module {
463463
Ok(())
464464
}
465465
}
466-
#[cfg(target_os = "macos")]
466+
#[cfg(target_vendor = "apple")]
467467
fn mknod(self, vm: &VirtualMachine) -> PyResult<()> {
468468
let ret = self._mknod(vm)?;
469469
if ret != 0 {

vm/src/stdlib/signal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub(crate) mod _signal {
7272

7373
#[cfg(unix)]
7474
#[cfg(not(any(
75-
target_os = "macos",
75+
target_vendor = "apple",
7676
target_os = "openbsd",
7777
target_os = "freebsd",
7878
target_os = "netbsd"

vm/src/stdlib/time.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ mod time {
226226

227227
#[cfg(not(any(
228228
windows,
229-
target_os = "macos",
229+
target_vendor = "apple",
230230
target_os = "android",
231231
target_os = "dragonfly",
232232
target_os = "freebsd",
@@ -460,6 +460,7 @@ mod unix {
460460
}
461461

462462
#[cfg(not(target_os = "redox"))]
463+
#[cfg(any(not(target_vendor = "apple"), target_os = "macos"))]
463464
fn set_clock_time(
464465
clk_id: PyIntRef,
465466
timespec: libc::timespec,
@@ -473,6 +474,7 @@ mod unix {
473474
}
474475

475476
#[cfg(not(target_os = "redox"))]
477+
#[cfg(any(not(target_vendor = "apple"), target_os = "macos"))]
476478
#[pyfunction]
477479
fn clock_settime(
478480
clk_id: PyIntRef,
@@ -492,6 +494,7 @@ mod unix {
492494
}
493495

494496
#[cfg(not(target_os = "redox"))]
497+
#[cfg(any(not(target_vendor = "apple"), target_os = "macos"))]
495498
#[pyfunction]
496499
fn clock_settime_ns(clk_id: PyIntRef, time: PyIntRef, vm: &VirtualMachine) -> PyResult<()> {
497500
let time: libc::time_t = time.try_to_primitive(vm)?;

0 commit comments

Comments
 (0)