mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Minor improvements
This commit is contained in:
@ -285,10 +285,7 @@ def ProcessTest(env):
|
|||||||
join("$BUILD_DIR", "UnityTestLib"), get_core_package_dir("tool-unity"))
|
join("$BUILD_DIR", "UnityTestLib"), get_core_package_dir("tool-unity"))
|
||||||
env.Prepend(LIBS=[unitylib])
|
env.Prepend(LIBS=[unitylib])
|
||||||
|
|
||||||
src_filter = [
|
src_filter = ["+<*.cpp>", "+<*.c>"]
|
||||||
"+<*.cpp>",
|
|
||||||
"+<*.c>"
|
|
||||||
]
|
|
||||||
if "PIOTEST" in env:
|
if "PIOTEST" in env:
|
||||||
src_filter.append("+<%s%s>" % (env['PIOTEST'], sep))
|
src_filter.append("+<%s%s>" % (env['PIOTEST'], sep))
|
||||||
|
|
||||||
|
@ -32,6 +32,10 @@ class MinitermException(PlatformioException):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class UserSideException(PlatformioException):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AbortedByUser(PlatformioException):
|
class AbortedByUser(PlatformioException):
|
||||||
|
|
||||||
MESSAGE = "Aborted by user"
|
MESSAGE = "Aborted by user"
|
||||||
|
@ -46,7 +46,7 @@ class ProjectGenerator(object):
|
|||||||
|
|
||||||
@util.memoized
|
@util.memoized
|
||||||
def get_project_env(self):
|
def get_project_env(self):
|
||||||
data = None
|
data = {}
|
||||||
config = util.load_project_config(self.project_dir)
|
config = util.load_project_config(self.project_dir)
|
||||||
for section in config.sections():
|
for section in config.sections():
|
||||||
if not section.startswith("env:"):
|
if not section.startswith("env:"):
|
||||||
|
@ -92,10 +92,24 @@ class MeasurementProtocol(TelemetryBase):
|
|||||||
self['an'] = " ".join(dpdata)
|
self['an'] = " ".join(dpdata)
|
||||||
|
|
||||||
def _prefill_custom_data(self):
|
def _prefill_custom_data(self):
|
||||||
|
|
||||||
|
def _filter_args(items):
|
||||||
|
result = []
|
||||||
|
stop = False
|
||||||
|
for item in items:
|
||||||
|
item = str(item).lower()
|
||||||
|
result.append(item)
|
||||||
|
if stop:
|
||||||
|
break
|
||||||
|
if item == "account":
|
||||||
|
stop = True
|
||||||
|
return result
|
||||||
|
|
||||||
caller_id = str(app.get_session_var("caller_id"))
|
caller_id = str(app.get_session_var("caller_id"))
|
||||||
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['cd3'] = " ".join(_filter_args(sys.argv[1:]))
|
||||||
self['cd4'] = 1 if (not util.is_ci() and
|
self['cd4'] = 1 if (not util.is_ci() and
|
||||||
(caller_id or not util.is_container())) else 0
|
(caller_id or not util.is_container())) else 0
|
||||||
if caller_id:
|
if caller_id:
|
||||||
@ -109,7 +123,6 @@ class MeasurementProtocol(TelemetryBase):
|
|||||||
return _arg
|
return _arg
|
||||||
return None
|
return None
|
||||||
|
|
||||||
self['cd3'] = " ".join([str(s).lower() for s in sys.argv[1:]])
|
|
||||||
if not app.get_session_var("command_ctx"):
|
if not app.get_session_var("command_ctx"):
|
||||||
return
|
return
|
||||||
ctx_args = app.get_session_var("command_ctx").args
|
ctx_args = app.get_session_var("command_ctx").args
|
||||||
@ -301,12 +314,15 @@ def on_event(category, action, label=None, value=None, screen_name=None):
|
|||||||
|
|
||||||
|
|
||||||
def on_exception(e):
|
def on_exception(e):
|
||||||
skip = any([
|
skip_conditions = [
|
||||||
isinstance(e, cls)
|
isinstance(e, cls)
|
||||||
for cls in (IOError, exception.AbortedByUser,
|
for cls in (IOError, exception.AbortedByUser,
|
||||||
exception.NotGlobalLibDir, exception.InternetIsOffline)
|
exception.NotGlobalLibDir, exception.InternetIsOffline,
|
||||||
])
|
exception.NotPlatformIOProject,
|
||||||
if skip:
|
exception.UserSideException)
|
||||||
|
]
|
||||||
|
skip_conditions.append("[API] Account: " in str(e))
|
||||||
|
if any(skip_conditions):
|
||||||
return
|
return
|
||||||
is_crash = any([
|
is_crash = any([
|
||||||
not isinstance(e, exception.PlatformioException),
|
not isinstance(e, exception.PlatformioException),
|
||||||
|
@ -19,7 +19,7 @@ from sys import modules
|
|||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
|
|
||||||
from platformio import util
|
from platformio import util
|
||||||
from platformio.exception import PlatformioException
|
from platformio.exception import PlatformioException, UserSideException
|
||||||
|
|
||||||
|
|
||||||
class VCSClientFactory(object):
|
class VCSClientFactory(object):
|
||||||
@ -64,7 +64,7 @@ class VCSClientBase(object):
|
|||||||
else:
|
else:
|
||||||
assert self.run_cmd(["--version"])
|
assert self.run_cmd(["--version"])
|
||||||
except (AssertionError, OSError, PlatformioException):
|
except (AssertionError, OSError, PlatformioException):
|
||||||
raise PlatformioException(
|
raise UserSideException(
|
||||||
"VCS: `%s` client is not installed in your system" %
|
"VCS: `%s` client is not installed in your system" %
|
||||||
self.command)
|
self.command)
|
||||||
return True
|
return True
|
||||||
|
Reference in New Issue
Block a user