Remove `enable_prompts` setting. Now, all PlatformIO CLI is non-blocking!

This commit is contained in:
Ivan Kravets
2016-08-26 11:46:59 +03:00
parent de62e5082e
commit f9e8ea66ea
18 changed files with 91 additions and 130 deletions

View File

@ -20,4 +20,4 @@ confidence=
# --disable=W" # --disable=W"
# disable=import-star-module-level,old-octal-literal,oct-method,print-statement,unpacking-in-except,parameter-unpacking,backtick,old-raise-syntax,old-ne-operator,long-suffix,dict-view-method,dict-iter-method,metaclass-assignment,next-method-called,raising-string,indexing-exception,raw_input-builtin,long-builtin,file-builtin,execfile-builtin,coerce-builtin,cmp-builtin,buffer-builtin,basestring-builtin,apply-builtin,filter-builtin-not-iterating,using-cmp-argument,useless-suppression,range-builtin-not-iterating,suppressed-message,no-absolute-import,old-division,cmp-method,reload-builtin,zip-builtin-not-iterating,intern-builtin,unichr-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,input-builtin,round-builtin,hex-method,nonzero-method,map-builtin-not-iterating # disable=import-star-module-level,old-octal-literal,oct-method,print-statement,unpacking-in-except,parameter-unpacking,backtick,old-raise-syntax,old-ne-operator,long-suffix,dict-view-method,dict-iter-method,metaclass-assignment,next-method-called,raising-string,indexing-exception,raw_input-builtin,long-builtin,file-builtin,execfile-builtin,coerce-builtin,cmp-builtin,buffer-builtin,basestring-builtin,apply-builtin,filter-builtin-not-iterating,using-cmp-argument,useless-suppression,range-builtin-not-iterating,suppressed-message,no-absolute-import,old-division,cmp-method,reload-builtin,zip-builtin-not-iterating,intern-builtin,unichr-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,input-builtin,round-builtin,hex-method,nonzero-method,map-builtin-not-iterating
disable=locally-disabled,missing-docstring,invalid-name,too-few-public-methods,redefined-variable-type,import-error,similarities,unsupported-membership-test,unsubscriptable-object,ungrouped-imports disable=locally-disabled,missing-docstring,invalid-name,too-few-public-methods,redefined-variable-type,import-error,similarities,unsupported-membership-test,unsubscriptable-object,ungrouped-imports,cyclic-import

View File

@ -65,6 +65,7 @@ PlatformIO 3.0
+ Support for the 3rd party manifests (Arduino IDE "library.properties" + Support for the 3rd party manifests (Arduino IDE "library.properties"
and ARM mbed "module.json") and ARM mbed "module.json")
* Removed ``enable_prompts`` setting. Now, all PlatformIO CLI is non-blocking!
* Switched to SSL PlatformIO API * Switched to SSL PlatformIO API
* Build System: Attach custom Before/Pre and After/Post actions for targets * Build System: Attach custom Before/Pre and After/Post actions for targets
(`issue #542 <https://github.com/platformio/platformio/issues/542>`_) (`issue #542 <https://github.com/platformio/platformio/issues/542>`_)
@ -1126,8 +1127,7 @@ PlatformIO 0.0
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
* Replaced "dark blue" by "cyan" colour for the texts (`issue #33 <https://github.com/platformio/platformio/issues/33>`_) * Replaced "dark blue" by "cyan" colour for the texts (`issue #33 <https://github.com/platformio/platformio/issues/33>`_)
* Added new setting `enable_prompts <http://docs.platformio.org/en/latest/userguide/cmd_settings.html>`_ * Added new setting ``enable_prompts`` and allowed to disable all *PlatformIO* prompts (useful for cloud compilers)
and allowed to disable all *PlatformIO* prompts (useful for cloud compilers)
(`issue #34 <https://github.com/platformio/platformio/issues/34>`_) (`issue #34 <https://github.com/platformio/platformio/issues/34>`_)
* Fixed compilation bug on *Windows* with installed *MSVC* (`issue #18 <https://github.com/platformio/platformio/issues/18>`_) * Fixed compilation bug on *Windows* with installed *MSVC* (`issue #18 <https://github.com/platformio/platformio/issues/18>`_)

View File

@ -35,8 +35,8 @@ PlatformIO handles ``CI`` variable which is setup by
`Continuous Integration <http://en.wikipedia.org/wiki/Continuous_integration>`_ `Continuous Integration <http://en.wikipedia.org/wiki/Continuous_integration>`_
(Travis, Circle and etc.) systems. (Travis, Circle and etc.) systems.
PlatformIO uses it to disable prompts and progress bars. In other words, PlatformIO uses it to disable prompts and progress bars. In other words,
``CI=true`` automatically setup :envvar:`PLATFORMIO_SETTING_ENABLE_PROMPTS` to ``CI=true`` automatically setup :envvar:`PLATFORMIO_DISABLE_PROGRESSBAR` to
``false`` and :envvar:`PLATFORMIO_DISABLE_PROGRESSBAR` to ``true``. ``true``.
.. envvar:: PLATFORMIO_FORCE_COLOR .. envvar:: PLATFORMIO_FORCE_COLOR
@ -154,10 +154,6 @@ Allows to override setting :ref:`setting_check_platformio_interval`.
Allows to override setting :ref:`setting_check_platforms_interval`. Allows to override setting :ref:`setting_check_platforms_interval`.
.. envvar:: PLATFORMIO_SETTING_ENABLE_PROMPTS
Allows to override setting :ref:`setting_enable_prompts`.
.. envvar:: PLATFORMIO_SETTING_ENABLE_TELEMETRY .. envvar:: PLATFORMIO_SETTING_ENABLE_TELEMETRY
Allows to override setting :ref:`setting_enable_telemetry`. Allows to override setting :ref:`setting_enable_telemetry`.

View File

@ -139,21 +139,6 @@ Please upgrade *SetupTools* package:
Miscellaneous Miscellaneous
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
.. _faq_troubleshooting_pioblocksprompt:
PlatformIO blocks command execution using user prompt
'''''''''''''''''''''''''''''''''''''''''''''''''''''
If you are going to run *PlatformIO* from **subprocess**, you **MUST
DISABLE** all prompts. It will allow you to avoid blocking.
There are a few options:
- using :option:`platformio --force` option before each command
- using environment variable :envvar:`PLATFORMIO_SETTING_ENABLE_PROMPTS=No <PLATFORMIO_SETTING_ENABLE_PROMPTS>`
- disable global setting ``enable_prompts`` via :ref:`cmd_settings` command
- masking under Continuous Integration system via environment variable
:envvar:`CI=true <CI>`.
Serial does not work with panStampAVR board Serial does not work with panStampAVR board
''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''

View File

@ -200,11 +200,6 @@ To revert to the latest stable version
Troubleshooting Troubleshooting
--------------- ---------------
.. warning::
If you are going to run *PlatformIO* from **subprocess**, you
:ref:`MUST DISABLE <faq_troubleshooting_pioblocksprompt>` all prompts.
It will allow you to avoid blocking.
.. note:: .. note::
**Linux OS**: Don't forget to install "udev" rules file **Linux OS**: Don't forget to install "udev" rules file
`99-platformio-udev.rules <https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules>`_ (an instruction is located in the file). `99-platformio-udev.rules <https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules>`_ (an instruction is located in the file).

View File

@ -111,24 +111,6 @@ Force verbose output when processing environments. This setting overrides
* :option:`platformio ci --verbose` * :option:`platformio ci --verbose`
* :option:`platformio test --verbose` * :option:`platformio test --verbose`
.. _setting_enable_prompts:
``enable_prompts``
^^^^^^^^^^^^^^^^^^
:Default: Yes
:Values: Yes/No
Can PlatformIO communicate with you via prompts?
* propose to install platforms which aren't installed yet
* paginate over library search results
* and etc.
.. warning::
If you are going to run *PlatformIO* from **subprocess**, you **MUST
DISABLE** all prompts. It will allow you to avoid blocking.
.. _setting_enable_telemetry: .. _setting_enable_telemetry:
``enable_telemetry`` ``enable_telemetry``
@ -172,7 +154,6 @@ Examples
check_libraries_interval 7 Check for the library updates interval (days) check_libraries_interval 7 Check for the library updates interval (days)
check_platformio_interval 3 Check for the new PlatformIO interval (days) check_platformio_interval 3 Check for the new PlatformIO interval (days)
check_platforms_interval 7 Check for the platform updates interval (days) check_platforms_interval 7 Check for the platform updates interval (days)
enable_prompts Yes Can PlatformIO communicate with you via prompts ...
enable_telemetry Yes Telemetry service (Yes/No) enable_telemetry Yes Telemetry service (Yes/No)

View File

@ -34,8 +34,7 @@ Options
.. option:: .. option::
--force, -f --force, -f
Force to accept any confirmation prompts. This option allows to avoid an issue Force to accept any confirmation prompts and disable progress bars.
with :ref:`faq_troubleshooting_pioblocksprompt`
.. option:: .. option::
--version --version

View File

@ -14,7 +14,7 @@
import sys import sys
VERSION = (3, 0, "0a10") VERSION = (3, 0, "0a11")
__version__ = ".".join([str(s) for s in VERSION]) __version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio" __title__ = "platformio"

View File

@ -58,15 +58,6 @@ DEFAULT_SETTINGS = {
("Telemetry service <http://docs.platformio.org/en/stable/" ("Telemetry service <http://docs.platformio.org/en/stable/"
"userguide/cmd_settings.html?#enable-telemetry> (Yes/No)"), "userguide/cmd_settings.html?#enable-telemetry> (Yes/No)"),
"value": True "value": True
},
"enable_prompts": {
"description":
("Can PlatformIO communicate with you via prompts: "
"propose to install platforms which aren't installed yet, "
"paginate over library search results and etc.)? ATTENTION!!! "
"If you call PlatformIO like subprocess, "
"please disable prompts to avoid blocking (Yes/No)"),
"value": True
} }
} }
@ -148,12 +139,6 @@ def set_state_item(name, value):
def get_setting(name): def get_setting(name):
if name == "enable_prompts":
# disable prompts for Continuous Integration systems
# and when global "--force" option is set
if any([util.is_ci(), get_session_var("force_option")]):
return False
_env_name = "PLATFORMIO_SETTING_%s" % name.upper() _env_name = "PLATFORMIO_SETTING_%s" % name.upper()
if _env_name in environ: if _env_name in environ:
return sanitize_setting(name, getenv(_env_name)) return sanitize_setting(name, getenv(_env_name))
@ -188,5 +173,5 @@ def set_session_var(name, value):
def is_disabled_progressbar(): def is_disabled_progressbar():
return (not get_setting("enable_prompts") or return any([get_session_var("force_option"), util.is_ci(),
getenv("PLATFORMIO_DISABLE_PROGRESSBAR") == "true") getenv("PLATFORMIO_DISABLE_PROGRESSBAR") == "true"])

View File

@ -14,10 +14,11 @@
import json import json
from os.path import join from os.path import join
from time import sleep
import click import click
from platformio import app, exception, util from platformio import exception, util
from platformio.managers.lib import LibraryManager from platformio.managers.lib import LibraryManager
from platformio.util import get_api_result from platformio.util import get_api_result
@ -75,11 +76,15 @@ def cli(ctx, **options):
# "library dependencies") # "library dependencies")
@click.option( @click.option(
"-s", "--silent", is_flag=True, help="Suppress progress reporting") "-s", "--silent", is_flag=True, help="Suppress progress reporting")
@click.option(
"--interactive",
is_flag=True,
help="Allow to make a choice for all prompts")
@click.pass_obj @click.pass_obj
def lib_install(lm, libraries, silent): def lib_install(lm, libraries, silent, interactive):
# @TODO "save" option # @TODO "save" option
for library in libraries: for library in libraries:
lm.install(library, silent=silent) lm.install(library, silent=silent, interactive=interactive)
@cli.command("uninstall", short_help="Uninstall libraries") @cli.command("uninstall", short_help="Uninstall libraries")
@ -147,6 +152,7 @@ def echo_liblist_item(item):
@cli.command("search", short_help="Search for library") @cli.command("search", short_help="Search for library")
@click.argument("query", required=False, nargs=-1)
@click.option("--json-output", is_flag=True) @click.option("--json-output", is_flag=True)
@click.option("--page", type=click.INT, default=1) @click.option("--page", type=click.INT, default=1)
@click.option("-n", "--name", multiple=True) @click.option("-n", "--name", multiple=True)
@ -154,8 +160,11 @@ def echo_liblist_item(item):
@click.option("-k", "--keyword", multiple=True) @click.option("-k", "--keyword", multiple=True)
@click.option("-f", "--framework", multiple=True) @click.option("-f", "--framework", multiple=True)
@click.option("-p", "--platform", multiple=True) @click.option("-p", "--platform", multiple=True)
@click.argument("query", required=False, nargs=-1) @click.option(
def lib_search(query, json_output, page, **filters): "--noninteractive",
is_flag=True,
help="Do not prompt, automatically paginate with delay")
def lib_search(query, json_output, page, noninteractive, **filters):
if not query: if not query:
query = [] query = []
if not isinstance(query, list): if not isinstance(query, list):
@ -205,14 +214,20 @@ def lib_search(query, json_output, page, **filters):
int(result['total'])): int(result['total'])):
break break
if (app.get_setting("enable_prompts") and if noninteractive:
click.confirm("Show next libraries?")): click.echo()
result = get_api_result( click.secho(
"/lib/search", "Loading next %d libraries... Press Ctrl+C to stop!" %
dict( result['perpage'],
query=" ".join(query), page=int(result['page']) + 1)) fg="yellow")
else: click.echo()
sleep(5)
elif not click.confirm("Show next libraries?"):
break break
result = get_api_result(
"/lib/search",
dict(
query=" ".join(query), page=int(result['page']) + 1))
@cli.command("list", short_help="List installed libraries") @cli.command("list", short_help="List installed libraries")

View File

@ -16,7 +16,7 @@ import json
import click import click
from platformio import app, exception, util from platformio import exception, util
from platformio.managers.platform import PlatformFactory, PlatformManager from platformio.managers.platform import PlatformFactory, PlatformManager
@ -150,17 +150,11 @@ def platform_list(json_output):
@cli.command("show", short_help="Show details about installed platform") @cli.command("show", short_help="Show details about installed platform")
@click.argument("platform") @click.argument("platform")
@click.pass_context def platform_show(platform):
def platform_show(ctx, platform):
try: try:
p = PlatformFactory.newPlatform(platform) p = PlatformFactory.newPlatform(platform)
except exception.UnknownPlatform: except exception.UnknownPlatform:
if (not app.get_setting("enable_prompts") or raise exception.PlatformNotInstalledYet(platform)
click.confirm("The platform '%s' has not been installed yet. "
"Would you like to install it now?" % platform)):
ctx.invoke(platform_install, platforms=[platform])
else:
raise exception.PlatformNotInstalledYet(platform)
click.echo("{name} ~ {title}".format( click.echo("{name} ~ {title}".format(
name=click.style( name=click.style(

View File

@ -70,10 +70,11 @@ def cli(ctx, environment, ignore, upload_port, project_dir, verbose):
# check ignore patterns # check ignore patterns
_ignore = list(ignore) _ignore = list(ignore)
if projectconf.has_option(section, "test_ignore"): if projectconf.has_option(section, "test_ignore"):
_ignore.extend([p.strip() _ignore.extend([
for p in projectconf.get( p.strip()
section, "test_ignore").split(",") for p in projectconf.get(section, "test_ignore").split(",")
if p.strip()]) if p.strip()
])
if testname != "*" and \ if testname != "*" and \
any([fnmatch(testname, p) for p in _ignore]): any([fnmatch(testname, p) for p in _ignore]):
results.append((None, testname, envname)) results.append((None, testname, envname))

View File

@ -18,7 +18,7 @@ from os.path import join
import click import click
import semantic_version import semantic_version
from platformio import app, commands, exception, util from platformio import commands, exception, util
from platformio.managers.package import BasePkgManager from platformio.managers.package import BasePkgManager
@ -106,7 +106,11 @@ class LibraryManager(BasePkgManager):
name, requirements)), requirements) name, requirements)), requirements)
return item['version'] if item else None return item['version'] if item else None
def _get_pkg_id_by_name(self, name, requirements, silent=False): def _get_pkg_id_by_name(self,
name,
requirements,
silent=False,
interactive=False):
if name.startswith("id="): if name.startswith("id="):
return int(name[3:]) return int(name[3:])
# try to find ID from installed packages # try to find ID from installed packages
@ -115,7 +119,8 @@ class LibraryManager(BasePkgManager):
manifest = self.load_manifest(installed_dir) manifest = self.load_manifest(installed_dir)
if "id" in manifest: if "id" in manifest:
return int(manifest['id']) return int(manifest['id'])
return int(self.search_for_library({"name": name}, silent)['id']) return int(
self.search_for_library({"name": name}, silent, interactive)['id'])
def _install_from_piorepo(self, name, requirements): def _install_from_piorepo(self, name, requirements):
assert name.startswith("id=") assert name.startswith("id=")
@ -136,15 +141,16 @@ class LibraryManager(BasePkgManager):
requirements) requirements)
return pkg_dir return pkg_dir
def install(self, def install(self, # pylint: disable=too-many-arguments
name, name,
requirements=None, requirements=None,
silent=False, silent=False,
trigger_event=True): trigger_event=True,
interactive=False):
_name, _requirements, _url = self.parse_pkg_name(name, requirements) _name, _requirements, _url = self.parse_pkg_name(name, requirements)
if not _url: if not _url:
_name = "id=%d" % self._get_pkg_id_by_name( _name = "id=%d" % self._get_pkg_id_by_name(
_name, _requirements, silent=silent) _name, _requirements, silent=silent, interactive=interactive)
already_installed = self.get_installed_dir(_name, _requirements, _url) already_installed = self.get_installed_dir(_name, _requirements, _url)
pkg_dir = BasePkgManager.install(self, _name if not _url else name, pkg_dir = BasePkgManager.install(self, _name if not _url else name,
_requirements, silent, trigger_event) _requirements, silent, trigger_event)
@ -164,7 +170,8 @@ class LibraryManager(BasePkgManager):
if any([s in filters.get("version", "") for s in ("\\", "/")]): if any([s in filters.get("version", "") for s in ("\\", "/")]):
self.install("{name}={version}".format(**filters)) self.install("{name}={version}".format(**filters))
else: else:
lib_info = self.search_for_library(filters, silent) lib_info = self.search_for_library(filters, silent,
interactive)
if filters.get("version"): if filters.get("version"):
self.install( self.install(
lib_info['id'], lib_info['id'],
@ -180,7 +187,9 @@ class LibraryManager(BasePkgManager):
@staticmethod @staticmethod
def search_for_library( # pylint: disable=too-many-branches def search_for_library( # pylint: disable=too-many-branches
filters, silent=False): filters,
silent=False,
interactive=False):
assert isinstance(filters, dict) assert isinstance(filters, dict)
assert "name" in filters assert "name" in filters
if not silent: if not silent:
@ -206,13 +215,18 @@ class LibraryManager(BasePkgManager):
click.secho( click.secho(
"Conflict: More than one library has been found " "Conflict: More than one library has been found "
"by request %s:" % json.dumps(filters), "by request %s:" % json.dumps(filters),
fg="red") fg="red",
err=True)
commands.lib.echo_liblist_header() commands.lib.echo_liblist_header()
for item in result['items']: for item in result['items']:
commands.lib.echo_liblist_item(item) commands.lib.echo_liblist_item(item)
if not app.get_setting("enable_prompts"): if not interactive:
click.echo("Automatically chose the first available library") click.secho(
"Automatically chose the first available library "
"(use `--interactive` option to make a choice)",
fg="yellow",
err=True)
lib_info = result['items'][0] lib_info = result['items'][0]
else: else:
deplib_id = click.prompt( deplib_id = click.prompt(

View File

@ -27,6 +27,8 @@ from platformio.downloader import FileDownloader
from platformio.unpacker import FileUnpacker from platformio.unpacker import FileUnpacker
from platformio.vcsclient import VCSClientFactory from platformio.vcsclient import VCSClientFactory
# pylint: disable=too-many-arguments
class PackageRepoIterator(object): class PackageRepoIterator(object):
@ -424,7 +426,8 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin):
name, name,
requirements=None, requirements=None,
silent=False, silent=False,
trigger_event=True): trigger_event=True,
interactive=False): # pylint: disable=unused-argument
name, requirements, url = self.parse_pkg_name(name, requirements) name, requirements, url = self.parse_pkg_name(name, requirements)
installed_dir = self.get_installed_dir(name, requirements, url) installed_dir = self.get_installed_dir(name, requirements, url)

View File

@ -43,10 +43,13 @@ class PlatformManager(BasePkgManager):
def manifest_name(self): def manifest_name(self):
return "platform.json" return "platform.json"
def install(self, # pylint: disable=too-many-arguments,arguments-differ def install(self, # pylint: disable=too-many-arguments
name, requirements=None, silent=False, name,
trigger_event=True, with_packages=None, requirements=None,
without_packages=None, skip_default_package=False): with_packages=None,
without_packages=None,
skip_default_package=False,
**_):
platform_dir = BasePkgManager.install(self, name, requirements) platform_dir = BasePkgManager.install(self, name, requirements)
p = PlatformFactory.newPlatform(self.get_manifest_path(platform_dir)) p = PlatformFactory.newPlatform(self.get_manifest_path(platform_dir))
p.install_packages(with_packages, without_packages, p.install_packages(with_packages, without_packages,

View File

@ -27,7 +27,6 @@ import click
import requests import requests
from platformio import __version__, app, exception, util from platformio import __version__, app, exception, util
from platformio.ide.projectgenerator import ProjectGenerator
class TelemetryBase(object): class TelemetryBase(object):
@ -60,7 +59,7 @@ class TelemetryBase(object):
class MeasurementProtocol(TelemetryBase): class MeasurementProtocol(TelemetryBase):
TRACKING_ID = "UA-1768265-9" TID = "UA-1768265-9"
PARAMS_MAP = { PARAMS_MAP = {
"screen_name": "cd", "screen_name": "cd",
"event_category": "ec", "event_category": "ec",
@ -72,7 +71,7 @@ class MeasurementProtocol(TelemetryBase):
def __init__(self): def __init__(self):
TelemetryBase.__init__(self) TelemetryBase.__init__(self)
self['v'] = 1 self['v'] = 1
self['tid'] = self.TRACKING_ID self['tid'] = self.TID
self['cid'] = self.get_cid() self['cid'] = self.get_cid()
self['sr'] = "%dx%d" % click.get_terminal_size() self['sr'] = "%dx%d" % click.get_terminal_size()
@ -106,8 +105,9 @@ class MeasurementProtocol(TelemetryBase):
self['cd1'] = util.get_systype() self['cd1'] = util.get_systype()
self['cd2'] = "Python/%s %s" % (platform.python_version(), self['cd2'] = "Python/%s %s" % (platform.python_version(),
platform.platform()) platform.platform())
self['cd4'] = (1 if app.get_setting("enable_prompts") or self['cd4'] = 1 if not util.is_ci() else 0
app.get_session_var("caller_id") else 0) if app.get_session_var("caller_id"):
self['cd5'] = str(app.get_session_var("caller_id")).lower()
def _prefill_screen_name(self): def _prefill_screen_name(self):
self['cd3'] = " ".join([str(s).lower() for s in sys.argv[1:]]) self['cd3'] = " ".join([str(s).lower() for s in sys.argv[1:]])
@ -227,9 +227,6 @@ def on_command():
if util.is_ci(): if util.is_ci():
measure_ci() measure_ci()
if app.get_session_var("caller_id"):
measure_caller(app.get_session_var("caller_id"))
def measure_ci(): def measure_ci():
event = {"category": "CI", "action": "NoName", "label": None} event = {"category": "CI", "action": "NoName", "label": None}
@ -251,14 +248,6 @@ def measure_ci():
on_event(**event) on_event(**event)
def measure_caller(calller_id):
calller_id = str(calller_id)[:20].lower()
event = {"category": "Caller", "action": "Misc", "label": calller_id}
if calller_id in (["atom", "vim"] + ProjectGenerator.get_supported_ides()):
event['action'] = "IDE"
on_event(**event)
def on_run_environment(options, targets): def on_run_environment(options, targets):
opts = ["%s=%s" % (opt, value) for opt, value in sorted(options.items())] opts = ["%s=%s" % (opt, value) for opt, value in sorted(options.items())]
targets = [t.title() for t in targets or ["run"]] targets = [t.title() for t in targets or ["run"]]

View File

@ -231,7 +231,7 @@ def get_projectpioenvs_dir(force=False):
[InternetShortcut] [InternetShortcut]
URL=http://docs.platformio.org/en/stable/projectconf.html#envs-dir URL=http://docs.platformio.org/en/stable/projectconf.html#envs-dir
""") """)
except Exception as e: except Exception as e: # pylint: disable=broad-except
if not force: if not force:
raise Exception(e) raise Exception(e)
return path return path
@ -348,9 +348,10 @@ def _api_request_session():
return requests.Session() return requests.Session()
def get_api_result(path, params=None, data=None, skipdns=False): def get_api_result(path, # pylint: disable=too-many-branches
params=None, data=None, skipdns=False):
import requests import requests
import app from platformio.app import get_setting
result = None result = None
r = None r = None
@ -361,7 +362,7 @@ def get_api_result(path, params=None, data=None, skipdns=False):
url = "https://%s" % __apiip__ url = "https://%s" % __apiip__
headers['host'] = __apiurl__[__apiurl__.index("://") + 3:] headers['host'] = __apiurl__[__apiurl__.index("://") + 3:]
if app.get_setting("disable_ssl"): if get_setting("disable_ssl"):
url = url.replace("https://", "http://") url = url.replace("https://", "http://")
try: try:

View File

@ -20,7 +20,7 @@ from click.testing import CliRunner
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def platformio_setup(request): def platformio_setup(request):
pioenvvars = ("ENABLE_PROMPTS", "ENABLE_TELEMETRY") pioenvvars = ("ENABLE_TELEMETRY", )
for v in pioenvvars: for v in pioenvvars:
os.environ["PLATFORMIO_SETTING_%s" % v] = "No" os.environ["PLATFORMIO_SETTING_%s" % v] = "No"