Format dev temp idedata (#2142)

This commit is contained in:
Otto Winter 2021-08-10 11:14:04 +02:00 committed by GitHub
parent f94c221a9a
commit 854f4a8896
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -113,15 +113,12 @@ def load_idedata(environment):
changed = False changed = False
if not changed: if not changed:
text = temp_idedata.read_text() return json.loads(temp_idedata.read_text())
else:
stdout = subprocess.check_output( stdout = subprocess.check_output(["pio", "run", "-t", "idedata", "-e", environment])
["pio", "run", "-t", "idedata", "-e", environment]
)
match = re.search(r'{\s*".*}', stdout.decode("utf-8")) match = re.search(r'{\s*".*}', stdout.decode("utf-8"))
text = match.group() data = json.loads(match.group())
temp_idedata.parent.mkdir(exist_ok=True) temp_idedata.parent.mkdir(exist_ok=True)
temp_idedata.write_text(text) temp_idedata.write_text(json.dumps(data, indent=2) + "\n")
return data
return json.loads(text)