diff -Naur psutil-release-5.4.7.orig/psutil/_common.py psutil-release-5.4.7/psutil/_common.py --- psutil-release-5.4.7.orig/psutil/_common.py 2018-08-28 06:57:51.026821300 -0400 +++ psutil-release-5.4.7/psutil/_common.py 2018-08-28 06:59:09.095384200 -0400 @@ -43,7 +43,7 @@ __all__ = [ # constants 'FREEBSD', 'BSD', 'LINUX', 'NETBSD', 'OPENBSD', 'MACOS', 'OSX', 'POSIX', - 'SUNOS', 'WINDOWS', + 'SUNOS', 'WINDOWS', 'MSYS' 'ENCODING', 'ENCODING_ERRS', 'AF_INET6', # connection constants 'CONN_CLOSE', 'CONN_CLOSE_WAIT', 'CONN_CLOSING', 'CONN_ESTABLISHED', @@ -74,6 +74,7 @@ POSIX = os.name == "posix" WINDOWS = os.name == "nt" +MSYS = "MSYSTEM" in os.environ LINUX = sys.platform.startswith("linux") MACOS = sys.platform.startswith("darwin") OSX = MACOS # deprecated alias diff -Naur psutil-release-5.4.7.orig/setup.py psutil-release-5.4.7/setup.py --- psutil-release-5.4.7.orig/setup.py 2018-08-28 06:57:51.085820500 -0400 +++ psutil-release-5.4.7/setup.py 2018-08-28 07:04:51.425299500 -0400 @@ -38,6 +38,7 @@ from _common import POSIX # NOQA from _common import SUNOS # NOQA from _common import WINDOWS # NOQA +from _common import MSYS # NOQA macros = [] @@ -103,7 +104,7 @@ setattr(sys, stream_name, orig) -if WINDOWS: +if WINDOWS or MSYS: def get_winver(): maj, min = sys.getwindowsversion()[0:2] return '0x0%s' % ((maj * 100) + min) @@ -126,16 +127,20 @@ ('PSAPI_VERSION', 1), ]) + sources=sources + [ + 'psutil/_psutil_windows.c', + 'psutil/arch/windows/process_info.c', + 'psutil/arch/windows/process_handles.c', + 'psutil/arch/windows/security.c', + 'psutil/arch/windows/services.c', + ] + + if not MSYS: + sources.append('psutil/arch/windows/inet_ntop.c') + ext = Extension( 'psutil._psutil_windows', - sources=sources + [ - 'psutil/_psutil_windows.c', - 'psutil/arch/windows/process_info.c', - 'psutil/arch/windows/process_handles.c', - 'psutil/arch/windows/security.c', - 'psutil/arch/windows/inet_ntop.c', - 'psutil/arch/windows/services.c', - ], + sources=sources, define_macros=macros, libraries=[ "psapi", "kernel32", "advapi32", "shell32", "netapi32",