Skip to content

Commit 7032de9

Browse files
Merge pull request RustPython#311 from nhynes/compile-wasm
Allow compiling VM for wasm32-unknown-unknown
2 parents b15ade1 + ae8dc46 commit 7032de9

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ fn shell_exec(
148148
}
149149
}
150150

151-
#[cfg(not(target_family = "unix"))]
151+
#[cfg(not(unix))]
152152
fn get_history_path() -> PathBuf {
153153
PathBuf::from(".repl_history.txt")
154154
}
155155

156-
#[cfg(target_family = "unix")]
156+
#[cfg(unix)]
157157
fn get_history_path() -> PathBuf {
158158
//work around for windows dependent builds. The xdg crate is unix specific
159159
//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
@@ -15,28 +15,28 @@ use crate::obj::objstr;
1515
use crate::pyobject::{PyContext, PyFuncArgs, PyObjectRef, PyResult, TypeProtocol};
1616
use crate::vm::VirtualMachine;
1717

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

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

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

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

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

3636
handle.into_raw_handle() as i64
3737
}
3838

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

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

0 commit comments

Comments
 (0)