Skip to content

Commit ae8dc46

Browse files
committed
Allow compiling VM for wasm32-unknown-unknown
1 parent d048d0a commit ae8dc46

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,13 @@ fn shell_exec(vm: &mut VirtualMachine, source: &str, scope: PyObjectRef) -> bool
134134
true
135135
}
136136

137-
#[cfg(not(target_family = "unix"))]
137+
#[cfg(not(unix))]
138138
fn get_history_path() -> PathBuf {
139139
//Path buffer
140140
PathBuf::from(".repl_history.txt")
141141
}
142142

143-
#[cfg(target_family = "unix")]
143+
#[cfg(unix)]
144144
fn get_history_path() -> PathBuf {
145145
//work around for windows dependent builds. The xdg crate is unix specific
146146
//so access to the BaseDirectories struct breaks builds on python.

vm/src/stdlib/os.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,28 @@ use super::super::obj::objtype;
1616
use super::super::pyobject::{PyContext, PyFuncArgs, PyObjectRef, PyResult, TypeProtocol};
1717
use super::super::vm::VirtualMachine;
1818

19-
#[cfg(target_family = "unix")]
19+
#[cfg(unix)]
2020
pub fn raw_file_number(handle: File) -> i64 {
2121
use std::os::unix::io::IntoRawFd;
2222

2323
i64::from(handle.into_raw_fd())
2424
}
2525

26-
#[cfg(target_family = "unix")]
26+
#[cfg(unix)]
2727
pub fn rust_file(raw_fileno: i64) -> File {
2828
use std::os::unix::io::FromRawFd;
2929

3030
unsafe { File::from_raw_fd(raw_fileno as i32) }
3131
}
3232

33-
#[cfg(target_family = "windows")]
33+
#[cfg(windows)]
3434
pub fn raw_file_number(handle: File) -> i64 {
3535
use std::os::windows::io::IntoRawHandle;
3636

3737
handle.into_raw_handle() as i64
3838
}
3939

40-
#[cfg(target_family = "windows")]
40+
#[cfg(windows)]
4141
pub fn rust_file(raw_fileno: i64) -> File {
4242
use std::ffi::c_void;
4343
use std::os::windows::io::FromRawHandle;
@@ -46,6 +46,16 @@ pub fn rust_file(raw_fileno: i64) -> File {
4646
unsafe { File::from_raw_handle(raw_fileno as *mut c_void) }
4747
}
4848

49+
#[cfg(all(not(unix), not(windows)))]
50+
pub fn rust_file(raw_fileno: i64) -> File {
51+
unimplemented!();
52+
}
53+
54+
#[cfg(all(not(unix), not(windows)))]
55+
pub fn raw_file_number(handle: File) -> i64 {
56+
unimplemented!();
57+
}
58+
4959
pub fn os_close(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
5060
arg_check!(vm, args, required = [(fileno, Some(vm.ctx.int_type()))]);
5161

0 commit comments

Comments
 (0)