From 1b84078541f95b0e90726d75ac286d84a1f976de Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 26 Dec 2015 20:22:22 +0200 Subject: [PATCH] Show error message when user tries to install/run PlatformIO with Python 3 --- platformio/__init__.py | 9 +++++++++ setup.py | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 558be264..cd2d6c86 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import sys + VERSION = (2, 7, "0.dev0") __version__ = ".".join([str(s) for s in VERSION]) @@ -31,3 +33,10 @@ __license__ = "Apache Software License" __copyright__ = "Copyright 2014-2015 Ivan Kravets" __apiurl__ = "http://api.platformio.org" + + +if sys.version_info >= (3, 0, 0): + msg = ("PlatformIO version %s does not run under Python version %s.\n" + "Python 3 is not yet supported.\n") + sys.stderr.write(msg % (__version__, sys.version.split()[0])) + sys.exit(1) diff --git a/setup.py b/setup.py index c82961a3..1ccabc68 100644 --- a/setup.py +++ b/setup.py @@ -12,11 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. - from setuptools import find_packages, setup from platformio import (__author__, __description__, __email__, __license__, - __title__, __url__, __version__, util) + __title__, __url__, __version__) setup(