File tree 7 files changed +38
-18
lines changed
7 files changed +38
-18
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ Release History
12
12
* Added
13
13
`Project Configuration <http://docs.platformio.org/en/latest/projectconf.html >`__
14
14
option named `envs_dir <http://docs.platformio.org/en/latest/projectconf.html#envs-dir >`__
15
+ * Disabled "prompts" automatically for *Continuous Integration * systems
16
+ (`issue #103 <https://github.com/ivankravets/platformio/issues/103 >`_)
15
17
* Fixed firmware uploading for
16
18
`atmelavr <http://docs.platformio.org/en/latest/platforms/atmelavr.html#boards >`__
17
19
boards which work within ``usbtiny `` protocol
Original file line number Diff line number Diff line change @@ -18,6 +18,19 @@ General
18
18
PlatformIO uses *General * environment variables for the common
19
19
operations/commands.
20
20
21
+ .. _envvar_CI :
22
+
23
+ CI
24
+ ~~
25
+
26
+ PlatformIO handles ``CI `` variable which is setup by
27
+ `Continuous Integration <http://en.wikipedia.org/wiki/Continuous_integration >`_
28
+ (Travis, Circle and etc.) systems.
29
+ Currently, PlatformIO uses it to disable prompts.
30
+
31
+ In other words, ``CI=true `` automatically setup
32
+ :ref: `PLATFORMIO_SETTING_ENABLE_PROMPTS=false <envvar_PLATFORMIO_SETTING_ENABLE_PROMPTS >`.
33
+
21
34
.. _envvar_PLATFORMIO_HOME_DIR :
22
35
23
36
PLATFORMIO_HOME_DIR
Original file line number Diff line number Diff line change @@ -32,11 +32,12 @@ application:
32
32
.. warning ::
33
33
If you are going to run *PlatformIO * from **subprocess **, you **MUST
34
34
DISABLE ** all prompts. It will allow you to avoid blocking.
35
- There are 2 options:
35
+ There are a few options:
36
36
37
- - using environment variable :ref: `PLATFORMIO_SETTING_ENABLE_PROMPTS=false <envvar_PLATFORMIO_SETTING_ENABLE_PROMPTS >`
38
- - disable global setting via :ref: `platformio setting enable_prompts false <cmd_settings >`
39
- command.
37
+ - using environment variable :ref: `PLATFORMIO_SETTING_ENABLE_PROMPTS=No <envvar_PLATFORMIO_SETTING_ENABLE_PROMPTS >`
38
+ - disable global setting ``enable_prompts `` via :ref: `cmd_settings ` command
39
+ - masking under Continuous Integration system via environment variable
40
+ :ref: `CI=true <envvar_CI >`.
40
41
41
42
Please *choose one of * the following:
42
43
Original file line number Diff line number Diff line change @@ -86,7 +86,9 @@ better.
86
86
87
87
88
88
.. note ::
89
- You can override these settings using :ref: `envvars `.
89
+ * The ``Yes `` value is equl to: ``True ``, ``Y ``, ``1 ``.
90
+ The value is not case sensetive.
91
+ * You can override these settings using :ref: `envvars `.
90
92
91
93
Examples
92
94
~~~~~~~~
Original file line number Diff line number Diff line change @@ -101,6 +101,10 @@ def set_state_item(name, value):
101
101
102
102
103
103
def get_setting (name ):
104
+ # disable prompts for Continuous Integration systems
105
+ if name == "enable_prompts" and getenv ("CI" , "" ).lower () == "true" :
106
+ return False
107
+
104
108
_env_name = "PLATFORMIO_SETTING_%s" % name .upper ()
105
109
if _env_name in environ :
106
110
return sanitize_setting (name , getenv (_env_name ))
Original file line number Diff line number Diff line change 1
1
# Copyright (C) Ivan Kravets <[email protected] >
2
2
# See LICENSE for details.
3
3
4
+ from os import environ
5
+
4
6
from click .testing import CliRunner
5
7
6
8
import pytest
7
- from platformio import app
8
9
9
10
10
11
@pytest .fixture (scope = "session" )
11
12
def platformio_setup (request ):
12
- prev_settings = dict (
13
- enable_telemetry = None ,
14
- enable_prompts = None
15
- )
16
- for key , value in prev_settings .iteritems ():
17
- prev_settings [key ] = app .get_setting (key )
18
- # disable temporary
19
- if prev_settings [key ]:
20
- app .set_setting (key , False )
13
+ pioenvvars = ("ENABLE_PROMPTS" , "ENABLE_TELEMETRY" )
14
+ for v in pioenvvars :
15
+ environ ["PLATFORMIO_SETTING_%s" % v ] = "No"
21
16
22
17
def platformio_teardown ():
23
- # restore settings
24
- for key , value in prev_settings .iteritems ():
25
- app .set_setting (key , value )
18
+ for v in pioenvvars :
19
+ _name = "PLATFORMIO_SETTING_%s" % v
20
+ if _name in environ :
21
+ del environ [_name ]
26
22
27
23
request .addfinalizer (platformio_teardown )
28
24
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ basepython =
38
38
py27: python2.7
39
39
usedevelop = True
40
40
deps = pytest
41
+ setenv =
42
+ PLATFORMIO_SETTING_ENABLE_PROMPTS = False
41
43
commands =
42
44
{envpython} --version
43
45
pip install --egg http://sourceforge.net/projects/scons/files/latest/download
You can’t perform that action at this time.
0 commit comments