summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/setup.py b/setup.py
index 3a3889cf..e7c69316 100755
--- a/setup.py
+++ b/setup.py
@@ -11,11 +11,12 @@ import contextlib
import io
import os
import platform
+import re
import shutil
+import struct
import sys
import tempfile
import warnings
-import re
with warnings.catch_warnings():
warnings.simplefilter("ignore")
@@ -52,6 +53,15 @@ if POSIX:
if BSD:
macros.append(("PSUTIL_BSD", 1))
+# Needed to determine _Py_PARSE_PID in case it's missing (Python 2, PyPy).
+# Taken from Lib/test/test_fcntl.py.
+# XXX: not bullet proof as the (long long) case is missing.
+if struct.calcsize('l') == 8:
+ macros.append(('PSUTIL_SIZEOF_PID_T', '4')) # int
+else:
+ macros.append(('PSUTIL_SIZEOF_PID_T', '8')) # long
+
+
sources = ['psutil/_psutil_common.c']
if POSIX:
sources.append('psutil/_psutil_posix.c')