Skip to content

Commit 23a2022

Browse files
committed
Add support for PLATFORMIO_DEFAULT_ENVS system environment variable // Resolve platformio#1967
1 parent c5177ef commit 23a2022

File tree

6 files changed

+9
-7
lines changed

6 files changed

+9
-7
lines changed

HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ PlatformIO 4.0
1919
- 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>`_)
2020
- 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>`_)
2121
- 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>`_)
22+
- 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>`_)
2223
- 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>`_)
2324

2425
* **Library Management**

platformio/project/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def envs(self):
284284
return [s[4:] for s in self._parser.sections() if s.startswith("env:")]
285285

286286
def default_envs(self):
287-
return self.get("platformio", "env_default", [])
287+
return self.get("platformio", "default_envs", [])
288288

289289
def validate(self, envs=None, silent=False):
290290
if not isfile(self.path):

platformio/project/options.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ def ConfigEnvOption(*args, **kwargs):
4848
# [platformio]
4949
#
5050
ConfigPlatformioOption(name="description"),
51-
ConfigPlatformioOption(name="env_default",
51+
ConfigPlatformioOption(name="default_envs",
52+
oldnames=["env_default"],
5253
multiple=True,
53-
sysenvvar="PLATFORMIO_ENV_DEFAULT"),
54+
sysenvvar="PLATFORMIO_DEFAULT_ENVS"),
5455
ConfigPlatformioOption(name="extra_configs", multiple=True),
5556

5657
# Dirs

tests/test_projectconf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ def test_real_config(tmpdir):
7474
with tmpdir.as_cwd():
7575
config = ProjectConfig(tmpdir.join("platformio.ini").strpath)
7676
assert config
77-
assert len(config.warnings) == 1
78-
assert "lib_install" in config.warnings[0]
77+
assert len(config.warnings) == 2
78+
assert "lib_install" in config.warnings[1]
7979

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

0 commit comments

Comments
 (0)