Skip to content

Commit

Permalink
Add support for PLATFORMIO_DEFAULT_ENVS system environment variable //
Browse files Browse the repository at this point in the history
…Resolve #1967
  • Loading branch information
ivankravets committed Jun 1, 2019
1 parent c5177ef commit 23a2022
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ PlatformIO 4.0
- Added support for Unix shell-style wildcards for `monitor_port <http://docs.platformio.org/page/projectconf/section_env_monitor.html#monitor-port>`__ option (`issue #2541 <https://github.com/platformio/platformio-core/issues/2541>`_)
- Added new `monitor_flags <http://docs.platformio.org/page/projectconf/section_env_monitor.html#monitor-flags>`__ option which allows passing extra flags and options to `platformio device monitor <http://docs.platformio.org/page/userguide/cmd_device.html#cmd-device-monitor>`__ command (`issue #2165 <https://github.com/platformio/platformio-core/issues/2165>`_)
- Override default development platform upload command with a custom `upload_command <http://docs.platformio.org/page/projectconf/section_env_upload.html#upload-command>`__ (`issue #2599 <https://github.com/platformio/platformio-core/issues/2599>`_)
- Added support for `PLATFORMIO_DEFAULT_ENVS <http://docs.platformio.org/page/envvars.html#envvar-PLATFORMIO_DEFAULT_ENVS>`__ system environment variable (`issue #1967 <https://github.com/platformio/platformio-core/issues/1967>`_)
- Fixed an issue when ``-U`` in ``build_flags`` does not remove macro previously defined via ``-D`` flag (`issue #2508 <https://github.com/platformio/platformio-core/issues/2508>`_)

* **Library Management**
Expand Down
2 changes: 1 addition & 1 deletion examples
2 changes: 1 addition & 1 deletion platformio/project/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def envs(self):
return [s[4:] for s in self._parser.sections() if s.startswith("env:")]

def default_envs(self):
return self.get("platformio", "env_default", [])
return self.get("platformio", "default_envs", [])

def validate(self, envs=None, silent=False):
if not isfile(self.path):
Expand Down
5 changes: 3 additions & 2 deletions platformio/project/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ def ConfigEnvOption(*args, **kwargs):
# [platformio]
#
ConfigPlatformioOption(name="description"),
ConfigPlatformioOption(name="env_default",
ConfigPlatformioOption(name="default_envs",
oldnames=["env_default"],
multiple=True,
sysenvvar="PLATFORMIO_ENV_DEFAULT"),
sysenvvar="PLATFORMIO_DEFAULT_ENVS"),
ConfigPlatformioOption(name="extra_configs", multiple=True),

# Dirs
Expand Down
4 changes: 2 additions & 2 deletions tests/test_projectconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def test_real_config(tmpdir):
with tmpdir.as_cwd():
config = ProjectConfig(tmpdir.join("platformio.ini").strpath)
assert config
assert len(config.warnings) == 1
assert "lib_install" in config.warnings[0]
assert len(config.warnings) == 2
assert "lib_install" in config.warnings[1]

config.validate(["extra_2", "base"], silent=True)
with pytest.raises(UnknownEnvNames):
Expand Down

0 comments on commit 23a2022

Please sign in to comment.