forked from Linaro/test-definitions
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
automated: linux: lmp-device-register check toml file
When lmp-device-register runs it creates sota.toml file from the values returned by server. This patch adds a check to confirm whether the file is a valid TOML. Signed-off-by: Milosz Wasilewski <[email protected]>
- Loading branch information
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import argparse | ||
import sys | ||
|
||
|
||
def main(toml_file): | ||
info = sys.version_info | ||
if info.major >= 3 and info.minor >= 11: | ||
import tomllib as tlib | ||
else: | ||
import toml as tlib | ||
|
||
with open(toml_file, "rb") as f: | ||
tlib.load(f) | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--toml-file", required=True) | ||
args = parser.parse_args() | ||
main(args.toml_file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters