From 47c238b1ebd5bfd60c0bee169074a5aa67061103 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 15 Jun 2016 19:30:37 +0300 Subject: [PATCH] Fix issue with ``platformio init --ide`` command for Python 2.6 --- .gitignore | 1 + HISTORY.rst | 5 +++++ platformio/__init__.py | 2 +- platformio/commands/upgrade.py | 2 ++ platformio/ide/projectgenerator.py | 7 ++++++- 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index dfcb0c78..89257136 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ docs/_build dist build +.cache diff --git a/HISTORY.rst b/HISTORY.rst index ec59872a..1bc72b89 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,6 +4,11 @@ Release Notes PlatformIO 2.0 -------------- +2.10.4 (2016-06-??) +~~~~~~~~~~~~~~~~~~~ + +* Fixed issue with ``platformio init --ide`` command for Python 2.6 + 2.10.3 (2016-06-15) ~~~~~~~~~~~~~~~~~~~ diff --git a/platformio/__init__.py b/platformio/__init__.py index 0f8db754..8746c80d 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (2, 10, 3) +VERSION = (2, 10, "4.dev0") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/commands/upgrade.py b/platformio/commands/upgrade.py index 894e8182..44e3b8ea 100644 --- a/platformio/commands/upgrade.py +++ b/platformio/commands/upgrade.py @@ -52,6 +52,8 @@ def cli(): r = None try: for cmd in cmds: + if sys.version_info < (2, 7, 0): + cmd[0] += ".__main__" cmd = [os.path.normpath(sys.executable), "-m"] + cmd r = None r = util.exec_command(cmd) diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index 2afd9d40..b4be53a3 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -66,7 +66,12 @@ class ProjectGenerator(object): envdata = self.get_project_env() if "env_name" not in envdata: return data - cmd = [normpath(sys.executable), "-m", "platformio", "-f"] + cmd = [ + normpath(sys.executable), "-m", + "platformio" + ( + ".__main__" if sys.version_info < (2, 7, 0) else ""), + "-f" + ] if app.get_session_var("caller_id"): cmd.extend(["-c", app.get_session_var("caller_id")]) cmd.extend(["run", "-t", "idedata", "-e", envdata['env_name']])