forked from platformio/platformio-core
Fix "OSError: [Errno 2] No such file or directory" when PlatformIO isn't installed properly
This commit is contained in:
@ -1,6 +1,14 @@
|
|||||||
Release History
|
Release History
|
||||||
===============
|
===============
|
||||||
|
|
||||||
|
0.9.1 (2014-12-03)
|
||||||
|
------------------
|
||||||
|
|
||||||
|
* Fixed "*OSError: [Errno 2] No such file or directory*" when PlatformIO isn't
|
||||||
|
installed properly
|
||||||
|
* Fixed example for `Eclipse IDE with Tiva board <https://github.com/ivankravets/platformio/tree/develop/examples/ide-eclipse>`_
|
||||||
|
(`issue #32 <https://github.com/ivankravets/platformio/issues/32>`_)
|
||||||
|
|
||||||
0.9.0 (2014-12-01)
|
0.9.0 (2014-12-01)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ def cli(project_dir):
|
|||||||
click.secho(
|
click.secho(
|
||||||
"will be used for the new project.\n"
|
"will be used for the new project.\n"
|
||||||
"You can specify another project directory via\n"
|
"You can specify another project directory via\n"
|
||||||
"`platformio init -d %PATH_TO_PROJECT_DIR%` command.\n",
|
"`platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.\n",
|
||||||
fg="yellow"
|
fg="yellow"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -26,7 +26,8 @@ class PlatformNotInstalledYet(PlatformioException):
|
|||||||
|
|
||||||
class UnknownCLICommand(PlatformioException):
|
class UnknownCLICommand(PlatformioException):
|
||||||
|
|
||||||
MESSAGE = "Unknown command '%s'"
|
MESSAGE = ("Unknown command '%s'. Please use `platformio --help`"
|
||||||
|
" to see all available commands")
|
||||||
|
|
||||||
|
|
||||||
class UnknownPackage(PlatformioException):
|
class UnknownPackage(PlatformioException):
|
||||||
@ -144,3 +145,12 @@ class InvalidSettingValue(PlatformioException):
|
|||||||
class UpgraderFailed(PlatformioException):
|
class UpgraderFailed(PlatformioException):
|
||||||
|
|
||||||
MESSAGE = "An error occurred while upgrading PlatformIO"
|
MESSAGE = "An error occurred while upgrading PlatformIO"
|
||||||
|
|
||||||
|
|
||||||
|
class SConsNotInstalled(PlatformioException):
|
||||||
|
|
||||||
|
MESSAGE = (
|
||||||
|
"The `scons` tool isn't installed properly. "
|
||||||
|
"Please use official installation procedure: "
|
||||||
|
"http://docs.platformio.ikravets.com/en/latest/installation.html"
|
||||||
|
)
|
||||||
|
@ -5,9 +5,8 @@ from imp import load_source
|
|||||||
from os import listdir
|
from os import listdir
|
||||||
from os.path import isdir, isfile, join
|
from os.path import isdir, isfile, join
|
||||||
|
|
||||||
|
from platformio import exception
|
||||||
from platformio.app import get_state_item, set_state_item
|
from platformio.app import get_state_item, set_state_item
|
||||||
from platformio.exception import (BuildScriptNotFound, PlatformNotInstalledYet,
|
|
||||||
UnknownPackage, UnknownPlatform)
|
|
||||||
from platformio.pkgmanager import PackageManager
|
from platformio.pkgmanager import PackageManager
|
||||||
from platformio.util import exec_command, get_home_dir, get_source_dir
|
from platformio.util import exec_command, get_home_dir, get_source_dir
|
||||||
|
|
||||||
@ -25,7 +24,7 @@ class PlatformFactory(object):
|
|||||||
module = load_source(
|
module = load_source(
|
||||||
"platformio.platforms.%s" % name, path)
|
"platformio.platforms.%s" % name, path)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise UnknownPlatform(name)
|
raise exception.UnknownPlatform(name)
|
||||||
return module
|
return module
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -47,7 +46,7 @@ class PlatformFactory(object):
|
|||||||
)
|
)
|
||||||
if isplatform:
|
if isplatform:
|
||||||
platforms[name] = path
|
platforms[name] = path
|
||||||
except UnknownPlatform:
|
except exception.UnknownPlatform:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if not installed:
|
if not installed:
|
||||||
@ -63,7 +62,7 @@ class PlatformFactory(object):
|
|||||||
def newPlatform(cls, name):
|
def newPlatform(cls, name):
|
||||||
platforms = cls.get_platforms()
|
platforms = cls.get_platforms()
|
||||||
if name not in platforms:
|
if name not in platforms:
|
||||||
raise UnknownPlatform(name)
|
raise exception.UnknownPlatform(name)
|
||||||
|
|
||||||
_instance = getattr(
|
_instance = getattr(
|
||||||
cls.load_module(name, platforms[name]),
|
cls.load_module(name, platforms[name]),
|
||||||
@ -123,7 +122,7 @@ class BasePlatform(object):
|
|||||||
upkgs = with_packages | without_packages
|
upkgs = with_packages | without_packages
|
||||||
ppkgs = set(self.get_packages().keys())
|
ppkgs = set(self.get_packages().keys())
|
||||||
if not upkgs.issubset(ppkgs):
|
if not upkgs.issubset(ppkgs):
|
||||||
raise UnknownPackage(", ".join(upkgs - ppkgs))
|
raise exception.UnknownPackage(", ".join(upkgs - ppkgs))
|
||||||
|
|
||||||
requirements = []
|
requirements = []
|
||||||
for name, opts in self.get_packages().items():
|
for name, opts in self.get_packages().items():
|
||||||
@ -151,7 +150,7 @@ class BasePlatform(object):
|
|||||||
installed=True).keys()
|
installed=True).keys()
|
||||||
|
|
||||||
if platform not in installed_platforms:
|
if platform not in installed_platforms:
|
||||||
raise PlatformNotInstalledYet(platform)
|
raise exception.PlatformNotInstalledYet(platform)
|
||||||
|
|
||||||
deppkgs = set()
|
deppkgs = set()
|
||||||
for item in installed_platforms:
|
for item in installed_platforms:
|
||||||
@ -191,7 +190,7 @@ class BasePlatform(object):
|
|||||||
installed_packages = PackageManager.get_installed()
|
installed_packages = PackageManager.get_installed()
|
||||||
|
|
||||||
if self.get_name() not in installed_platforms:
|
if self.get_name() not in installed_platforms:
|
||||||
raise PlatformNotInstalledYet(self.get_name())
|
raise exception.PlatformNotInstalledYet(self.get_name())
|
||||||
|
|
||||||
if "clean" in targets:
|
if "clean" in targets:
|
||||||
targets.remove("clean")
|
targets.remove("clean")
|
||||||
@ -205,20 +204,23 @@ class BasePlatform(object):
|
|||||||
continue
|
continue
|
||||||
_, path = v.split("=", 2)
|
_, path = v.split("=", 2)
|
||||||
if not isfile(path):
|
if not isfile(path):
|
||||||
raise BuildScriptNotFound(path)
|
raise exception.BuildScriptNotFound(path)
|
||||||
|
|
||||||
# append aliases of installed packages
|
# append aliases of the installed packages
|
||||||
for name, options in self.get_packages().items():
|
for name, options in self.get_packages().items():
|
||||||
if name not in installed_packages:
|
if name not in installed_packages:
|
||||||
continue
|
continue
|
||||||
variables.append(
|
variables.append(
|
||||||
"PIOPACKAGE_%s=%s" % (options['alias'].upper(), name))
|
"PIOPACKAGE_%s=%s" % (options['alias'].upper(), name))
|
||||||
|
|
||||||
result = exec_command([
|
try:
|
||||||
"scons",
|
result = exec_command([
|
||||||
"-Q",
|
"scons",
|
||||||
"-f", join(get_source_dir(), "builder", "main.py")
|
"-Q",
|
||||||
] + variables + targets)
|
"-f", join(get_source_dir(), "builder", "main.py")
|
||||||
|
] + variables + targets)
|
||||||
|
except OSError:
|
||||||
|
raise exception.SConsNotInstalled()
|
||||||
|
|
||||||
return self.after_run(result)
|
return self.after_run(result)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user