Telemetry: add win support

The .vpython3 change is only necessary for running the opt in/out on
windows. Otherwise the only oddity was temporary files being weird
in windows.

Bug: 326277821
Change-Id: I88326410526d6fe7f6feb14a0bc27ab22eb12b58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6615021
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Commit-Queue: Struan Shrimpton <sshrimp@google.com>
changes/21/6615021/3
Struan Shrimpton 2 months ago committed by LUCI CQ
parent 9c11bcef1f
commit 929a231882

@ -5,6 +5,11 @@
python_version: "3.8"
wheel: <
name: "infra/python/wheels/colorama-py2_py3"
version: "version:0.4.1"
>
wheel: <
name: "infra/python/wheels/typing-extensions-py3"
version: "version:4.0.1"

@ -68,8 +68,8 @@ def is_google_host() -> bool:
def initialize(service_name,
notice=DEFAULT_BANNER,
cfg_file=config.DEFAULT_CONFIG_FILE):
# TODO(326277821): Add support for other platforms
if not sys.platform.startswith('linux'):
# TODO(326277821): Add support for mac
if sys.platform == 'darwin':
return
if not is_google_host():

@ -156,17 +156,19 @@ class Config:
self._trace_config = TraceConfig(self._config)
self._root_config = RootConfig(self._config)
def flush(self) -> None:
"""Flushes the current config to config file."""
tmpfile = tempfile.NamedTemporaryFile()
with open(tmpfile.name, "w", encoding="utf-8") as configfile:
tmpDir = tempfile.mkdtemp()
tmpfile = Path.joinpath(Path(tmpDir), 'telemetry.cfg')
with open(tmpfile, "w", encoding="utf-8") as configfile:
self._config.write(configfile)
if not self._path.parent.exists():
self._path.parent.mkdir(parents=True, exist_ok=True)
shutil.copy(tmpfile.name, self._path)
shutil.copy(tmpfile, self._path)
@property
def root_config(self) -> RootConfig:

Loading…
Cancel
Save