diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2020-02-12 20:33:42 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2020-02-12 20:33:42 +0100 |
commit | cdb20187518e73ce8de96f57e9c5aca1357d6430 (patch) | |
tree | 689e18d9235c46c7aa7c2bbb7fec742340092852 /setup.py | |
parent | b5cf1f92f01b644067b7daf6011df50fda3be3f6 (diff) | |
download | psutil-cdb20187518e73ce8de96f57e9c5aca1357d6430.tar.gz |
#1672: determine pid_t size at runtime in setup.py
Diffstat (limited to 'setup.py')
-rwxr-xr-x | setup.py | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -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') |