From 40a682476dab9e2e50b83b803457e78d478dbf0a Mon Sep 17 00:00:00 2001 From: Ionel Cristian Maries Date: Fri, 10 Apr 2015 21:44:27 +0300 Subject: [PATCH] Improve version test (use pkg_resources to compare versions). Also log failures to stderr. --HG-- branch : pytest-2.7 --- setup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 038e5f633..e7d74c793 100644 --- a/setup.py +++ b/setup.py @@ -29,8 +29,10 @@ def get_version(): def has_newish_setuptools(): try: import setuptools - return tuple(int(i) for i in str(setuptools.__version__).split('.')) > (0, 7) - except Exception: + import pkg_resources + return pkg_resources.parse_version(setuptools.__version__) >= pkg_resources.parse_version('0.7') + except Exception as exc: + sys.stderr.write("Could not test setuptool's version: %s\n" % exc) return False