Skip to content

Commit

Permalink
GNU: Add new platform for GNU/Hurd (based off Linux)
Browse files Browse the repository at this point in the history
TODO: Fix NotImplementedError:
/proc/diskstats nor /sys/block filesystem are available on this system

Signed-off-by: Damien Zammit <damien@zamaudio.com>
  • Loading branch information
zamaudio committed Oct 15, 2024
1 parent b1a7593 commit cdfd780
Show file tree
Hide file tree
Showing 19 changed files with 2,803 additions and 2 deletions.
12 changes: 12 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ include psutil/_common.py
include psutil/_compat.py
include psutil/_psaix.py
include psutil/_psbsd.py
include psutil/_psgnu.py
include psutil/_pslinux.py
include psutil/_psosx.py
include psutil/_psposix.py
Expand All @@ -35,6 +36,7 @@ include psutil/_psutil_aix.c
include psutil/_psutil_bsd.c
include psutil/_psutil_common.c
include psutil/_psutil_common.h
include psutil/_psutil_gnu.c
include psutil/_psutil_linux.c
include psutil/_psutil_osx.c
include psutil/_psutil_posix.c
Expand Down Expand Up @@ -83,6 +85,16 @@ include psutil/arch/linux/proc.c
include psutil/arch/linux/proc.h
include psutil/arch/linux/users.c
include psutil/arch/linux/users.h
include psutil/arch/gnu/disk.c
include psutil/arch/gnu/disk.h
include psutil/arch/gnu/mem.c
include psutil/arch/gnu/mem.h
include psutil/arch/gnu/net.c
include psutil/arch/gnu/net.h
include psutil/arch/gnu/proc.c
include psutil/arch/gnu/proc.h
include psutil/arch/gnu/users.c
include psutil/arch/gnu/users.h
include psutil/arch/netbsd/cpu.c
include psutil/arch/netbsd/cpu.h
include psutil/arch/netbsd/disk.c
Expand Down
7 changes: 7 additions & 0 deletions psutil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- NetBSD
- Sun Solaris
- AIX
- GNU/Hurd
Works with Python versions 2.7 and 3.6+.
"""
Expand Down Expand Up @@ -55,6 +56,7 @@
from ._common import CONN_SYN_SENT
from ._common import CONN_TIME_WAIT
from ._common import FREEBSD # NOQA
from ._common import GNU
from ._common import LINUX
from ._common import MACOS
from ._common import NETBSD # NOQA
Expand Down Expand Up @@ -106,6 +108,11 @@
from ._pslinux import IOPRIO_CLASS_NONE # NOQA
from ._pslinux import IOPRIO_CLASS_RT # NOQA

elif GNU:
PROCFS_PATH = "/proc"
from . import _psgnu as _psplatform
from ._psgnu import IOPRIO_CLASS_NONE # NOQA

elif WINDOWS:
from . import _pswindows as _psplatform
from ._psutil_windows import ABOVE_NORMAL_PRIORITY_CLASS # NOQA
Expand Down
3 changes: 2 additions & 1 deletion psutil/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
__all__ = [
# OS constants
'FREEBSD', 'BSD', 'LINUX', 'NETBSD', 'OPENBSD', 'MACOS', 'OSX', 'POSIX',
'SUNOS', 'WINDOWS',
'SUNOS', 'WINDOWS', 'GNU',
# connection constants
'CONN_CLOSE', 'CONN_CLOSE_WAIT', 'CONN_CLOSING', 'CONN_ESTABLISHED',
'CONN_FIN_WAIT1', 'CONN_FIN_WAIT2', 'CONN_LAST_ACK', 'CONN_LISTEN',
Expand Down Expand Up @@ -97,6 +97,7 @@
BSD = FREEBSD or OPENBSD or NETBSD
SUNOS = sys.platform.startswith(("sunos", "solaris"))
AIX = sys.platform.startswith("aix")
GNU = sys.platform.startswith("gnu")


# ===================================================================
Expand Down
Loading

0 comments on commit cdfd780

Please sign in to comment.