From 8ca3d59e37eb0501f709554d31bfb986db5349a8 Mon Sep 17 00:00:00 2001 From: Peter Date: Thu, 14 Jan 2016 10:21:17 -0500 Subject: [PATCH] Adding pending deprecation warning for Python2.6 This change add a simple warning that is triggered whenever Python 2.6 is used with PyKMIP. It simply advises the user to use a newer version of Python. For now, Python 2.6 can still be used with PyKMIP. --- kmip/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kmip/__init__.py b/kmip/__init__.py index e8af528..0ea8c04 100644 --- a/kmip/__init__.py +++ b/kmip/__init__.py @@ -17,6 +17,7 @@ import logging.config import os import re import sys +import warnings # Dynamically set __version__ version_path = os.path.join(os.path.dirname( @@ -63,3 +64,11 @@ else: logging.basicConfig() __all__ = ['core', 'demos', 'services'] + +if sys.version_info[:2] == (2, 6): + warnings.simplefilter("always") + warnings.warn( + ("Please use a newer version of Python (2.7.9+ preferred). PyKMIP " + "support for Python 2.6 will be abandoned in the future."), + PendingDeprecationWarning) + warnings.simplefilter("default")