mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-17 01:51:39 +09:00
Allow compilation on Redox
This commit is contained in:
@@ -63,7 +63,7 @@ unic-common = "0.9"
|
||||
maplit = "1.0"
|
||||
bitflags = "1.2.1"
|
||||
libc = "0.2"
|
||||
nix = "0.16.0"
|
||||
nix = "0.17"
|
||||
arr_macro = "0.1.2"
|
||||
csv = "1.1.1"
|
||||
paste = "0.1"
|
||||
@@ -84,8 +84,6 @@ uname = "0.1.1"
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
crc32fast = "1.2.0"
|
||||
adler32 = "1.0.3"
|
||||
flate2 = { version = "1.0", features = ["zlib"], default-features = false }
|
||||
libz-sys = "1.0.25"
|
||||
gethostname = "0.2.0"
|
||||
subprocess = "0.2.2"
|
||||
num_cpus = "1"
|
||||
@@ -94,6 +92,8 @@ rustyline = "6.0"
|
||||
|
||||
[target.'cfg(not(any(target_arch = "wasm32", target_os = "redox")))'.dependencies]
|
||||
dns-lookup = "1.0"
|
||||
flate2 = { version = "1.0", features = ["zlib"], default-features = false }
|
||||
libz-sys = "1.0"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winreg = "0.7"
|
||||
|
||||
@@ -60,7 +60,7 @@ mod subprocess;
|
||||
mod winapi;
|
||||
#[cfg(windows)]
|
||||
mod winreg;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[cfg(not(any(target_arch = "wasm32", target_os = "redox")))]
|
||||
mod zlib;
|
||||
|
||||
pub type StdlibInitFunc = Box<dyn Fn(&VirtualMachine) -> PyObjectRef>;
|
||||
@@ -124,6 +124,7 @@ pub fn get_module_inits() -> HashMap<String, StdlibInitFunc> {
|
||||
modules.insert("signal".to_owned(), Box::new(signal::make_module));
|
||||
modules.insert("select".to_owned(), Box::new(select::make_module));
|
||||
modules.insert("_subprocess".to_owned(), Box::new(subprocess::make_module));
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
modules.insert("zlib".to_owned(), Box::new(zlib::make_module));
|
||||
modules.insert(
|
||||
"faulthandler".to_owned(),
|
||||
|
||||
@@ -890,7 +890,7 @@ fn os_chdir(path: PyStringRef, vm: &VirtualMachine) -> PyResult<()> {
|
||||
env::set_current_dir(path.as_str()).map_err(|err| convert_io_error(vm, err))
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(all(unix, not(target_os = "redox")))]
|
||||
fn os_chroot(path: PyStringRef, vm: &VirtualMachine) -> PyResult<()> {
|
||||
nix::unistd::chroot(path.as_str()).map_err(|err| convert_nix_error(vm, err))
|
||||
}
|
||||
@@ -1340,6 +1340,7 @@ pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
|
||||
#[cfg(unix)]
|
||||
support_funcs.extend(vec![
|
||||
SupportFunc::new(vm, "chmod", os_chmod, Some(false), Some(false), Some(false)),
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
SupportFunc::new(vm, "chroot", os_chroot, Some(false), None, None),
|
||||
]);
|
||||
let supports_fd = PySet::default().into_ref(vm);
|
||||
@@ -1427,7 +1428,6 @@ fn extend_module_platform_specific(vm: &VirtualMachine, module: PyObjectRef) ->
|
||||
extend_module!(vm, module, {
|
||||
"access" => ctx.new_function(os_access),
|
||||
"chmod" => ctx.new_function(os_chmod),
|
||||
"chroot" => ctx.new_function(os_chroot),
|
||||
"get_inheritable" => ctx.new_function(os_get_inheritable), // TODO: windows
|
||||
"get_blocking" => ctx.new_function(os_get_blocking),
|
||||
"getppid" => ctx.new_function(os_getppid),
|
||||
@@ -1468,6 +1468,7 @@ fn extend_module_platform_specific(vm: &VirtualMachine, module: PyObjectRef) ->
|
||||
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
extend_module!(vm, module, {
|
||||
"chroot" => ctx.new_function(os_chroot),
|
||||
"getsid" => ctx.new_function(os_getsid),
|
||||
"setsid" => ctx.new_function(os_setsid),
|
||||
"setegid" => ctx.new_function(os_setegid),
|
||||
|
||||
Reference in New Issue
Block a user