summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2016-11-08 21:02:22 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2016-11-08 21:02:22 +0100
commite2f71f7dd89782b39f309e50198c296492623b32 (patch)
tree12b9a66025b81266a3143882a60525a459cd67f6
parentc4319266320d97d4674834e2ed6c31705cdf6738 (diff)
downloadpsutil-e2f71f7dd89782b39f309e50198c296492623b32.tar.gz
#811: on Win XP let the possibility to install psutil from sources as it still (kind of) works)
-rw-r--r--docs/index.rst8
-rw-r--r--psutil/__init__.py21
-rw-r--r--psutil/_common.py9
-rwxr-xr-xsetup.py13
4 files changed, 32 insertions, 19 deletions
diff --git a/docs/index.rst b/docs/index.rst
index d1bf54a1..7fd79a1e 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1924,8 +1924,12 @@ Q&A
===
* Q: What Windows versions are supported?
-* A: From Windows Vista onwards. Latest release supporting Windows 2000, XP and
- 2003 server is psutil `3.4.2 <https://pypi.python.org/pypi?name=psutil&version=3.4.2&:action=files>`__.
+* A: From Windows **Vista** onwards. Latest binary (wheel / exe) release
+ supporting Windows **2000**, **XP** and **2003 server** which can installed
+ via pip without a compiler being installed is
+ `psutil 3.4.2 <https://pypi.python.org/pypi?name=psutil&version=3.4.2&:action=files>`__.
+ More recent psutil versions may still be compiled from sources and work
+ (more or less) but they are no longer being tested or maintained.
Timeline
diff --git a/psutil/__init__.py b/psutil/__init__.py
index 13b7b5a7..06cc1c4c 100644
--- a/psutil/__init__.py
+++ b/psutil/__init__.py
@@ -123,11 +123,24 @@ if LINUX:
pass
elif WINDOWS:
- from ._common import assert_supported_winver
- assert_supported_winver()
- del assert_supported_winver
+ try:
+ from . import _pswindows as _psplatform
+ except ImportError as err:
+ if sys.getwindowsversion()[0] < 6:
+ # We may get here if:
+ # 1) we are on an old Windows version
+ # 2) psutil was installed via pip + wheel
+ # See: https://github.com/giampaolo/psutil/issues/811
+ # It must be noted that psutil can still (kind of) work
+ # on outdated systems if compiled / installed from sources,
+ # but if we get here it means this this was a wheel (or exe).
+ msg = "this Windows version is too old (< Windows Vista); "
+ msg += "psutil 3.4.2 is the latest version which supports Windows "
+ msg += "2000, XP and 2003 server"
+ raise RuntimeError(msg)
+ else:
+ raise
- from . import _pswindows as _psplatform
from ._psutil_windows import ABOVE_NORMAL_PRIORITY_CLASS # NOQA
from ._psutil_windows import BELOW_NORMAL_PRIORITY_CLASS # NOQA
from ._psutil_windows import HIGH_PRIORITY_CLASS # NOQA
diff --git a/psutil/_common.py b/psutil/_common.py
index c05efc79..3879a1d7 100644
--- a/psutil/_common.py
+++ b/psutil/_common.py
@@ -427,12 +427,3 @@ def deprecated_method(replacement):
return getattr(self, replacement)(*args, **kwargs)
return inner
return outer
-
-
-def assert_supported_winver():
- """Raise an error if this Windows version is not supported."""
- if WINDOWS and sys.getwindowsversion()[0] < 6:
- msg = "this Windows version is too old (< Windows Vista); "
- msg += "psutil 3.4.2 is the latest version which supports Windows "
- msg += "2000, XP and 2003 server"
- raise RuntimeError(msg)
diff --git a/setup.py b/setup.py
index 01ca833b..938cfef9 100755
--- a/setup.py
+++ b/setup.py
@@ -13,9 +13,10 @@ import atexit
import contextlib
import io
import os
+import platform
import sys
import tempfile
-import platform
+import warnings
try:
from setuptools import setup, Extension
except ImportError:
@@ -24,7 +25,6 @@ except ImportError:
HERE = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, os.path.join(HERE, "psutil"))
-from _common import assert_supported_winver # NOQA
from _common import BSD # NOQA
from _common import FREEBSD # NOQA
from _common import LINUX # NOQA
@@ -99,12 +99,17 @@ if POSIX:
# Windows
if WINDOWS:
- assert_supported_winver()
-
def get_winver():
maj, min = sys.getwindowsversion()[0:2]
return '0x0%s' % ((maj * 100) + min)
+ if sys.getwindowsversion()[0] < 6:
+ msg = "Windows versions < Vista are no longer supported or maintained;"
+ msg = " latest supported version is psutil 3.4.2; "
+ msg += "psutil may still be installed from sources if you have "
+ msg += "Visual Studio and may also (kind of) work though"
+ warnings.warn(msg, UserWarning)
+
macros.extend([
# be nice to mingw, see:
# http://www.mingw.org/wiki/Use_more_recent_defined_functions