Use current Python interpreter for the all subprocess platformio calls

This commit is contained in:
Ivan Kravets
2016-01-19 18:42:59 +02:00
parent c48ffc0089
commit c55204cc50
4 changed files with 22 additions and 11 deletions

View File

@@ -14,7 +14,7 @@
import sys
VERSION = (2, 7, "2.dev3")
VERSION = (2, 7, "2.dev4")
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"

View File

@@ -19,10 +19,11 @@ from glob import glob
from os import getenv, listdir, sep, walk
from os.path import basename, dirname, isdir, isfile, join, normpath, realpath
from platformio.util import pioversion_to_intstr
from SCons.Script import COMMAND_LINE_TARGETS, DefaultEnvironment, SConscript
from SCons.Util import case_sensitive_suffixes
from platformio.util import pioversion_to_intstr
SRC_BUILD_EXT = ["c", "cpp", "S", "spp", "SPP", "sx", "s", "asm", "ASM"]
SRC_HEADER_EXT = ["h", "hpp"]
SRC_DEFAULT_FILTER = " ".join([

View File

@@ -15,12 +15,14 @@
import json
import os
import re
from os.path import abspath, basename, expanduser, isdir, join, relpath
import sys
from os.path import (abspath, basename, expanduser, isdir, join, normpath,
relpath)
import bottle
import click # pylint: disable=wrong-import-order
from platformio import exception, util
from platformio import app, exception, util
class ProjectGenerator(object):
@@ -64,10 +66,12 @@ class ProjectGenerator(object):
envdata = self.get_project_env()
if "env_name" not in envdata:
return data
result = util.exec_command(
["platformio", "-f", "run", "-t", "idedata",
"-e", envdata['env_name'], "-d", self.project_dir]
)
cmd = [normpath(sys.executable), "-m", "platformio", "-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']])
cmd.extend(["-d", self.project_dir])
result = util.exec_command(cmd)
if result['returncode'] != 0 or '"includes":' not in result['out']:
raise exception.PlatformioException(

View File

@@ -18,9 +18,9 @@ import json
import os
import re
import subprocess
import sys
from glob import glob
from os.path import (abspath, basename, dirname, expanduser, isdir, isfile,
join, realpath)
from os.path import abspath, basename, dirname, expanduser, isdir, isfile, join
from platform import system, uname
from threading import Thread
@@ -175,7 +175,13 @@ def get_lib_dir():
def get_source_dir():
return dirname(realpath(__file__))
curpath = abspath(__file__)
if not isfile(curpath):
for p in sys.path:
if isfile(join(p, __file__)):
curpath = join(p, __file__)
break
return dirname(curpath)
def get_project_dir():