mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-31 18:44:27 +02:00
Check that SCons is installed properly
This commit is contained in:
@@ -373,18 +373,7 @@ class BasePlatform(object):
|
|||||||
self._found_error = False
|
self._found_error = False
|
||||||
try:
|
try:
|
||||||
# test that SCons is installed correctly
|
# test that SCons is installed correctly
|
||||||
try:
|
assert self.test_scons()
|
||||||
r = util.exec_command(["scons", "--version"])
|
|
||||||
assert r['returncode'] == 0
|
|
||||||
except (OSError, AssertionError):
|
|
||||||
for p in sys.path:
|
|
||||||
try:
|
|
||||||
r = util.exec_command([join(p, "scons"), "--version"])
|
|
||||||
assert r['returncode'] == 0
|
|
||||||
os.environ['PATH'] += os.pathsep + p
|
|
||||||
break
|
|
||||||
except (OSError, AssertionError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
result = util.exec_command(
|
result = util.exec_command(
|
||||||
[
|
[
|
||||||
@@ -395,7 +384,7 @@ class BasePlatform(object):
|
|||||||
stdout=util.AsyncPipe(self.on_run_out),
|
stdout=util.AsyncPipe(self.on_run_out),
|
||||||
stderr=util.AsyncPipe(self.on_run_err)
|
stderr=util.AsyncPipe(self.on_run_err)
|
||||||
)
|
)
|
||||||
except OSError:
|
except (OSError, AssertionError):
|
||||||
raise exception.SConsNotInstalled()
|
raise exception.SConsNotInstalled()
|
||||||
|
|
||||||
assert "returncode" in result
|
assert "returncode" in result
|
||||||
@@ -407,6 +396,23 @@ class BasePlatform(object):
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def test_scons():
|
||||||
|
try:
|
||||||
|
r = util.exec_command(["scons", "--version"])
|
||||||
|
assert r['returncode'] == 0
|
||||||
|
return True
|
||||||
|
except (OSError, AssertionError):
|
||||||
|
for p in sys.path:
|
||||||
|
try:
|
||||||
|
r = util.exec_command([join(p, "scons"), "--version"])
|
||||||
|
assert r['returncode'] == 0
|
||||||
|
os.environ['PATH'] += os.pathsep + p
|
||||||
|
return True
|
||||||
|
except (OSError, AssertionError):
|
||||||
|
pass
|
||||||
|
return False
|
||||||
|
|
||||||
def on_run_out(self, line):
|
def on_run_out(self, line):
|
||||||
self._echo_line(line, level=3)
|
self._echo_line(line, level=3)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user