Rename "install_libs" env option to "lib_install"

This commit is contained in:
Ivan Kravets
2015-06-28 20:16:43 +03:00
parent ebdbf79868
commit e288499db9
5 changed files with 29 additions and 23 deletions

View File

@ -105,7 +105,7 @@ Release History
(`issue #192 <https://github.com/platformio/platformio/issues/192>`_) (`issue #192 <https://github.com/platformio/platformio/issues/192>`_)
* Control verbosity of `platformio run <http://docs.platformio.org/en/latest/userguide/cmd_run.html#cmdoption-platformio-run-v>`_ command via ``-v/--verbose`` option * Control verbosity of `platformio run <http://docs.platformio.org/en/latest/userguide/cmd_run.html#cmdoption-platformio-run-v>`_ command via ``-v/--verbose`` option
* Add library dependencies for build environment using * Add library dependencies for build environment using
`install_libs <http://docs.platformio.org/en/latest/projectconf.html#install-libs>`_ `lib_install <http://docs.platformio.org/en/latest/projectconf.html#lib-install>`_
option in ``platformio.ini`` option in ``platformio.ini``
(`issue #134 <https://github.com/platformio/platformio/issues/134>`_) (`issue #134 <https://github.com/platformio/platformio/issues/134>`_)
* Specify libraries which are compatible with build environment using * Specify libraries which are compatible with build environment using

View File

@ -341,8 +341,8 @@ exclude ``.git`` and ``svn`` repository folders and exclude ``examples`` folder.
This option can be set by global environment variable This option can be set by global environment variable
:ref:`envvar_PLATFORMIO_SRC_FILTER`. :ref:`envvar_PLATFORMIO_SRC_FILTER`.
``install_libs`` ``lib_install``
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
Specify dependent libraries which should be installed before environment Specify dependent libraries which should be installed before environment
process. The only library IDs are allowed. Multiple libraries can be passed process. The only library IDs are allowed. Multiple libraries can be passed
@ -355,7 +355,7 @@ Example:
.. code-block:: ini .. code-block:: ini
[env:depends_on_some_libs] [env:depends_on_some_libs]
install_libs = 1,13,19 lib_install = 1,13,19
``lib_use`` ``lib_use``
^^^^^^^^^^^ ^^^^^^^^^^^

View File

@ -41,7 +41,7 @@ class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904
def _handle_obsolate_command(name): def _handle_obsolate_command(name):
if name in ("install", "list", "search", "show", "uninstall"): if name in ("install", "list", "search", "show", "uninstall"):
click.secho( click.secho(
"Warning! `platformio %s` command is obsoleted and will be " "Warning! `platformio %s` command is deprecated and will be "
"removed in the next release! Please use " "removed in the next release! Please use "
"`platformio platforms %s` instead." % (name, name), "`platformio platforms %s` instead." % (name, name),
fg="yellow" fg="yellow"

View File

@ -74,16 +74,17 @@ def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914
class EnvironmentProcessor(object): class EnvironmentProcessor(object):
RENAMED_OPTIONS = { RENAMED_OPTIONS = {
"LDF_CYCLIC": "LIB_DFCYCLIC", "INSTALL_LIBS": "LIB_INSTALL",
"IGNORE_LIBS": "LIB_IGNORE", "IGNORE_LIBS": "LIB_IGNORE",
"USE_LIBS": "LIB_USE" "USE_LIBS": "LIB_USE",
"LDF_CYCLIC": "LIB_DFCYCLIC"
} }
def __init__(self, cmd_ctx, name, options, # pylint: disable=R0913 def __init__(self, cmd_ctx, name, options, # pylint: disable=R0913
targets, upload_port, verbose): targets, upload_port, verbose):
self.cmd_ctx = cmd_ctx self.cmd_ctx = cmd_ctx
self.name = name self.name = name
self.options = options self.options = self._validate_options(options)
self.targets = targets self.targets = targets
self.upload_port = upload_port self.upload_port = upload_port
self.verbose_level = int(verbose) self.verbose_level = int(verbose)
@ -114,24 +115,29 @@ class EnvironmentProcessor(object):
return not is_error return not is_error
def _validate_options(self, options):
result = {}
for k, v in options.items():
_k = k.upper()
# process obsolete options
if _k in self.RENAMED_OPTIONS:
click.secho(
"Warning! `%s` option is deprecated and will be "
"removed in the next release! Please use "
"`%s` instead." % (
k, self.RENAMED_OPTIONS[_k].lower()),
fg="yellow"
)
k = self.RENAMED_OPTIONS[_k].lower()
result[k] = v
return result
def _get_build_variables(self): def _get_build_variables(self):
variables = ["PIOENV=" + self.name] variables = ["PIOENV=" + self.name]
if self.upload_port: if self.upload_port:
variables.append("UPLOAD_PORT=%s" % self.upload_port) variables.append("UPLOAD_PORT=%s" % self.upload_port)
for k, v in self.options.items(): for k, v in self.options.items():
k = k.upper() k = k.upper()
# process obsolete options
if k in self.RENAMED_OPTIONS:
click.secho(
"Warning! `%s` option is obsoleted and will be "
"removed in the next release! Please use "
"`%s` instead." % (
k.lower(), self.RENAMED_OPTIONS[k].lower()),
fg="yellow"
)
k = self.RENAMED_OPTIONS[k]
if k == "TARGETS" or (k == "UPLOAD_PORT" and self.upload_port): if k == "TARGETS" or (k == "UPLOAD_PORT" and self.upload_port):
continue continue
variables.append("%s=%s" % (k, v)) variables.append("%s=%s" % (k, v))
@ -157,8 +163,8 @@ class EnvironmentProcessor(object):
# install platform and libs dependencies # install platform and libs dependencies
_autoinstall_platform(self.cmd_ctx, platform) _autoinstall_platform(self.cmd_ctx, platform)
if "install_libs" in self.options: if "lib_install" in self.options:
_autoinstall_libs(self.cmd_ctx, self.options['install_libs']) _autoinstall_libs(self.cmd_ctx, self.options['lib_install'])
p = PlatformFactory.newPlatform(platform) p = PlatformFactory.newPlatform(platform)
return p.run(build_vars, build_targets, self.verbose_level) return p.run(build_vars, build_targets, self.verbose_level)

View File

@ -86,7 +86,7 @@ class Upgrader(object):
def _upgrade_to_0_9_0(self, ctx): # pylint: disable=R0201 def _upgrade_to_0_9_0(self, ctx): # pylint: disable=R0201
prev_platforms = [] prev_platforms = []
# remove platform's folder (obsoleted package structure) # remove platform's folder (obsolete package structure)
for name in PlatformFactory.get_platforms().keys(): for name in PlatformFactory.get_platforms().keys():
pdir = join(get_home_dir(), name) pdir = join(get_home_dir(), name)
if not isdir(pdir): if not isdir(pdir):