90 lines
2.7 KiB
Diff
90 lines
2.7 KiB
Diff
From 92f37549d4be5632bde8373ec6329024455143aa Mon Sep 17 00:00:00 2001
|
|
From: Manuel Naranjo <naranjo.manuel@gmail.com>
|
|
Date: Thu, 23 Jun 2016 18:11:02 -0300
|
|
Subject: [PATCH 1/2] [MSYS] Allow detecting when running on MSYS
|
|
|
|
* Adding a check for testing for msys2
|
|
* disabling inet_ntop.c on msys2 as it's provided by mingw
|
|
---
|
|
psutil/_common.py | 3 ++-
|
|
setup.py | 45 +++++++++++++++++++++++++--------------------
|
|
2 files changed, 27 insertions(+), 21 deletions(-)
|
|
|
|
diff --git a/psutil/_common.py b/psutil/_common.py
|
|
index 1e48b63..38d46f8 100644
|
|
--- a/psutil/_common.py
|
|
+++ b/psutil/_common.py
|
|
@@ -39,7 +39,7 @@ else:
|
|
__all__ = [
|
|
# OS constants
|
|
'FREEBSD', 'BSD', 'LINUX', 'NETBSD', 'OPENBSD', 'OSX', 'POSIX', 'SUNOS',
|
|
- 'WINDOWS',
|
|
+ 'WINDOWS', 'MSYS',
|
|
# connection constants
|
|
'CONN_CLOSE', 'CONN_CLOSE_WAIT', 'CONN_CLOSING', 'CONN_ESTABLISHED',
|
|
'CONN_FIN_WAIT1', 'CONN_FIN_WAIT2', 'CONN_LAST_ACK', 'CONN_LISTEN',
|
|
@@ -69,6 +69,7 @@ __all__ = [
|
|
|
|
POSIX = os.name == "posix"
|
|
WINDOWS = os.name == "nt"
|
|
+MSYS = "MSYSTEM" in os.environ
|
|
LINUX = sys.platform.startswith("linux")
|
|
OSX = sys.platform.startswith("darwin")
|
|
FREEBSD = sys.platform.startswith("freebsd")
|
|
diff --git a/setup.py b/setup.py
|
|
index a61b5ed..18472db 100644
|
|
--- a/setup.py
|
|
+++ b/setup.py
|
|
@@ -34,6 +34,7 @@
|
|
from _common import POSIX # NOQA
|
|
from _common import SUNOS # NOQA
|
|
from _common import WINDOWS # NOQA
|
|
+from _common import MSYS # NOQA
|
|
|
|
|
|
macros = []
|
|
@@ -86,7 +86,7 @@
|
|
macros.append(('PSUTIL_VERSION', int(VERSION.replace('.', ''))))
|
|
|
|
# Windows
|
|
-if WINDOWS:
|
|
+if WINDOWS or MSYS:
|
|
def get_winver():
|
|
maj, min = sys.getwindowsversion()[0:2]
|
|
return '0x0%s' % ((maj * 100) + min)
|
|
@@ -107,18 +107,22 @@
|
|
# see: https://github.com/giampaolo/psutil/issues/348
|
|
('PSAPI_VERSION', 1),
|
|
])
|
|
+
|
|
+ sources=[
|
|
+ 'psutil/_psutil_windows.c',
|
|
+ 'psutil/_psutil_common.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=[
|
|
- 'psutil/_psutil_windows.c',
|
|
- 'psutil/_psutil_common.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",
|
|
--
|
|
2.7.2
|
|
|