Re-export more os functions in posix, tweak availability on linux (#6529)

This commit is contained in:
Akuli
2021-12-07 17:10:41 +02:00
committed by GitHub
parent 14f2e0feb9
commit 7155bdae63
5 changed files with 14 additions and 25 deletions

View File

@@ -575,8 +575,6 @@ if sys.platform != "win32":
# Unix only
def fchmod(fd: int, mode: int) -> None: ...
def fchown(fd: int, uid: int, gid: int) -> None: ...
if sys.platform != "darwin":
def fdatasync(fd: FileDescriptorLike) -> None: ... # Unix only, not Mac
def fpathconf(__fd: int, __name: str | int) -> int: ...
def fstatvfs(__fd: int) -> statvfs_result: ...
def get_blocking(__fd: int) -> bool: ...
@@ -584,7 +582,8 @@ if sys.platform != "win32":
def lockf(__fd: int, __command: int, __length: int) -> None: ...
def openpty() -> tuple[int, int]: ... # some flavors of Unix
if sys.platform != "darwin":
def pipe2(flags: int) -> tuple[int, int]: ... # some flavors of Unix
def fdatasync(fd: FileDescriptorLike) -> None: ...
def pipe2(__flags: int) -> tuple[int, int]: ... # some flavors of Unix
def posix_fallocate(fd: int, offset: int, length: int) -> None: ...
def posix_fadvise(fd: int, offset: int, length: int, advice: int) -> None: ...
def pread(__fd: int, __length: int, __offset: int) -> bytes: ...
@@ -632,17 +631,14 @@ def getcwd() -> str: ...
def getcwdb() -> bytes: ...
def chmod(path: _FdOrAnyPath, mode: int, *, dir_fd: int | None = ..., follow_symlinks: bool = ...) -> None: ...
if sys.platform != "win32":
if sys.platform != "win32" and sys.platform != "linux":
def chflags(path: StrOrBytesPath, flags: int, follow_symlinks: bool = ...) -> None: ... # some flavors of Unix
def chown(
path: _FdOrAnyPath, uid: int, gid: int, *, dir_fd: int | None = ..., follow_symlinks: bool = ...
) -> None: ... # Unix only
if sys.platform != "win32":
# Unix only
def chroot(path: StrOrBytesPath) -> None: ...
def lchflags(path: StrOrBytesPath, flags: int) -> None: ...
def lchmod(path: StrOrBytesPath, mode: int) -> None: ...
if sys.platform != "win32":
def chroot(path: StrOrBytesPath) -> None: ...
def chown(path: _FdOrAnyPath, uid: int, gid: int, *, dir_fd: int | None = ..., follow_symlinks: bool = ...) -> None: ...
def lchown(path: StrOrBytesPath, uid: int, gid: int) -> None: ...
def link(

View File

@@ -103,6 +103,7 @@ if sys.platform != "win32":
ctermid as ctermid,
device_encoding as device_encoding,
dup as dup,
dup2 as dup2,
error as error,
execv as execv,
execve as execve,
@@ -212,6 +213,8 @@ if sys.platform != "win32":
urandom as urandom,
utime as utime,
wait as wait,
wait3 as wait3,
wait4 as wait4,
waitpid as waitpid,
write as write,
writev as writev,
@@ -231,6 +234,9 @@ if sys.platform != "win32":
removexattr as removexattr,
setxattr as setxattr,
)
else:
from os import chflags as chflags, lchflags as lchflags, lchmod as lchmod
if sys.platform != "darwin":
from os import (
POSIX_FADV_DONTNEED as POSIX_FADV_DONTNEED,
@@ -242,6 +248,7 @@ if sys.platform != "win32":
fdatasync as fdatasync,
getresgid as getresgid,
getresuid as getresuid,
pipe2 as pipe2,
posix_fadvise as posix_fadvise,
posix_fallocate as posix_fallocate,
sched_getaffinity as sched_getaffinity,

View File

@@ -57,12 +57,6 @@ grp.struct_group.n_unnamed_fields
mimetypes.MimeTypes.read_windows_registry
os.ST_NOSUID
os.ST_RDONLY
posix.chflags
posix.dup2
posix.lchflags
posix.lchmod
posix.wait3
posix.wait4
resource.struct_rusage.n_fields
resource.struct_rusage.n_sequence_fields
resource.struct_rusage.n_unnamed_fields

View File

@@ -1,6 +1,5 @@
_curses.color_pair
curses.color_pair
os.pipe2
(os|posix).posix_fadvise
(os|posix).posix_fallocate
(os|posix).sched_getaffinity

View File

@@ -12,9 +12,6 @@ os.EX_NOTFOUND
os.SF_MNOWAIT
os.SF_NODISKIO
os.SF_SYNC
os.chflags
os.lchflags
os.lchmod
os.plock
posix.EX_NOTFOUND
select.EPOLL_RDHUP
@@ -65,10 +62,6 @@ mimetypes.MimeTypes.read_windows_registry
(os|posix).waitid_result.n_fields
(os|posix).waitid_result.n_sequence_fields
(os|posix).waitid_result.n_unnamed_fields
posix.dup2
posix.pipe2
posix.wait3
posix.wait4
resource.struct_rusage.n_fields
resource.struct_rusage.n_sequence_fields
resource.struct_rusage.n_unnamed_fields