Skip to content

Commit 217bb5f

Browse files
committed
os: Work if "ffi" module is not available (provide wrappers for "uos").
1 parent d7bdde8 commit 217bb5f

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

os/os/__init__.py

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,30 @@
3131

3232
libc = ffilib.libc()
3333

34-
chdir_ = libc.func("i", "chdir", "s")
35-
mkdir_ = libc.func("i", "mkdir", "si")
36-
rename_ = libc.func("i", "rename", "ss")
37-
unlink_ = libc.func("i", "unlink", "s")
38-
rmdir_ = libc.func("i", "rmdir", "s")
39-
getcwd_ = libc.func("s", "getcwd", "si")
40-
opendir_ = libc.func("P", "opendir", "s")
41-
readdir_ = libc.func("P", "readdir", "P")
42-
open_ = libc.func("i", "open", "sii")
43-
read_ = libc.func("i", "read", "ipi")
44-
write_ = libc.func("i", "write", "iPi")
45-
close_ = libc.func("i", "close", "i")
46-
dup_ = libc.func("i", "dup", "i")
47-
access_ = libc.func("i", "access", "si")
48-
fork_ = libc.func("i", "fork", "")
49-
pipe_ = libc.func("i", "pipe", "p")
50-
_exit_ = libc.func("v", "_exit", "i")
51-
getpid_ = libc.func("i", "getpid", "")
52-
waitpid_ = libc.func("i", "waitpid", "ipi")
53-
system_ = libc.func("i", "system", "s")
54-
execvp_ = libc.func("i", "execvp", "PP")
55-
kill_ = libc.func("i", "kill", "ii")
56-
getenv_ = libc.func("s", "getenv", "P")
34+
if libc:
35+
chdir_ = libc.func("i", "chdir", "s")
36+
mkdir_ = libc.func("i", "mkdir", "si")
37+
rename_ = libc.func("i", "rename", "ss")
38+
unlink_ = libc.func("i", "unlink", "s")
39+
rmdir_ = libc.func("i", "rmdir", "s")
40+
getcwd_ = libc.func("s", "getcwd", "si")
41+
opendir_ = libc.func("P", "opendir", "s")
42+
readdir_ = libc.func("P", "readdir", "P")
43+
open_ = libc.func("i", "open", "sii")
44+
read_ = libc.func("i", "read", "ipi")
45+
write_ = libc.func("i", "write", "iPi")
46+
close_ = libc.func("i", "close", "i")
47+
dup_ = libc.func("i", "dup", "i")
48+
access_ = libc.func("i", "access", "si")
49+
fork_ = libc.func("i", "fork", "")
50+
pipe_ = libc.func("i", "pipe", "p")
51+
_exit_ = libc.func("v", "_exit", "i")
52+
getpid_ = libc.func("i", "getpid", "")
53+
waitpid_ = libc.func("i", "waitpid", "ipi")
54+
system_ = libc.func("i", "system", "s")
55+
execvp_ = libc.func("i", "execvp", "PP")
56+
kill_ = libc.func("i", "kill", "ii")
57+
getenv_ = libc.func("s", "getenv", "P")
5758

5859

5960

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy