Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GNU: Add new platform for GNU/Hurd (based off Linux) #2462

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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