forked from platformio/platformio-core
Fix IDE project generator when board is specified // Resolve #242
This commit is contained in:
@ -18,6 +18,8 @@ Release History
|
|||||||
`library.json <http://docs.platformio.org/en/latest/librarymanager/config.html>`__
|
`library.json <http://docs.platformio.org/en/latest/librarymanager/config.html>`__
|
||||||
* Fixed ``stk500v2_command(): command failed``
|
* Fixed ``stk500v2_command(): command failed``
|
||||||
(`issue #238 <https://github.com/platformio/platformio/issues/238>`_)
|
(`issue #238 <https://github.com/platformio/platformio/issues/238>`_)
|
||||||
|
* Fixed IDE project generator when board is specified
|
||||||
|
(`issue #242 <https://github.com/platformio/platformio/issues/242>`_)
|
||||||
|
|
||||||
2.1.2 (2015-06-21)
|
2.1.2 (2015-06-21)
|
||||||
------------------
|
------------------
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||||
# See LICENSE for details.
|
# See LICENSE for details.
|
||||||
|
|
||||||
VERSION = (2, 2, "0.dev3")
|
VERSION = (2, 2, "0.dev4")
|
||||||
__version__ = ".".join([str(s) for s in VERSION])
|
__version__ = ".".join([str(s) for s in VERSION])
|
||||||
|
|
||||||
__title__ = "platformio"
|
__title__ = "platformio"
|
||||||
|
@ -141,6 +141,8 @@ def DumpIDEData(env):
|
|||||||
|
|
||||||
# global symbols
|
# global symbols
|
||||||
for item in env.get("CPPDEFINES", []):
|
for item in env.get("CPPDEFINES", []):
|
||||||
|
if isinstance(item, list):
|
||||||
|
item = "=".join(item)
|
||||||
data['defines'].append(env.subst(item))
|
data['defines'].append(env.subst(item))
|
||||||
|
|
||||||
# special symbol for Atmel AVR MCU
|
# special symbol for Atmel AVR MCU
|
||||||
|
@ -86,7 +86,7 @@ def cli(project_dir, board, ide, disable_auto_uploading, env_prefix):
|
|||||||
project_file, board, disable_auto_uploading, env_prefix)
|
project_file, board, disable_auto_uploading, env_prefix)
|
||||||
|
|
||||||
if ide:
|
if ide:
|
||||||
pg = ProjectGenerator(project_dir, ide)
|
pg = ProjectGenerator(project_dir, ide, board[0] if board else None)
|
||||||
pg.generate()
|
pg.generate()
|
||||||
|
|
||||||
click.secho(
|
click.secho(
|
||||||
|
@ -13,9 +13,10 @@ from platformio import util
|
|||||||
|
|
||||||
class ProjectGenerator(object):
|
class ProjectGenerator(object):
|
||||||
|
|
||||||
def __init__(self, project_dir, ide):
|
def __init__(self, project_dir, ide, board=None):
|
||||||
self.project_dir = project_dir
|
self.project_dir = project_dir
|
||||||
self.ide = ide
|
self.ide = ide
|
||||||
|
self.board = board
|
||||||
self._tplvars = {}
|
self._tplvars = {}
|
||||||
|
|
||||||
self._gather_tplvars()
|
self._gather_tplvars()
|
||||||
@ -26,6 +27,7 @@ class ProjectGenerator(object):
|
|||||||
return sorted([d for d in listdir(tpls_dir)
|
return sorted([d for d in listdir(tpls_dir)
|
||||||
if isdir(join(tpls_dir, d))])
|
if isdir(join(tpls_dir, d))])
|
||||||
|
|
||||||
|
@util.memoized
|
||||||
def get_project_env(self):
|
def get_project_env(self):
|
||||||
data = {"env_name": "PlatformIO"}
|
data = {"env_name": "PlatformIO"}
|
||||||
with util.cd(self.project_dir):
|
with util.cd(self.project_dir):
|
||||||
@ -33,9 +35,11 @@ class ProjectGenerator(object):
|
|||||||
for section in config.sections():
|
for section in config.sections():
|
||||||
if not section.startswith("env:"):
|
if not section.startswith("env:"):
|
||||||
continue
|
continue
|
||||||
data['env_name'] = section[4:]
|
data = {"env_name": section[4:]}
|
||||||
for k, v in config.items(section):
|
for k, v in config.items(section):
|
||||||
data[k] = v
|
data[k] = v
|
||||||
|
if self.board and self.board == data.get("board"):
|
||||||
|
break
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@util.memoized
|
@util.memoized
|
||||||
|
Reference in New Issue
Block a user