-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
93 additions
and
2 deletions.
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,42 @@ | ||
import subprocess | ||
from os import environ | ||
from sys import path as spath | ||
|
||
spath.append("../source/cptoml/") | ||
spath.append("../scripts/CircuitMPY/") | ||
import circuitmpy | ||
from cptoml import put | ||
|
||
if "FSNAME" not in environ: | ||
environ["FSNAME"] = "BERYLLIUM" | ||
[boardpath, board, version] = circuitmpy.detect_board() | ||
|
||
if boardpath == None: | ||
print( | ||
"Error: Board not found.\nMake sure it is attached and mounted before you run make" | ||
) | ||
exit(1) | ||
|
||
|
||
def cmd(txt): | ||
try: | ||
return subprocess.check_output(txt).strip().decode("utf-8") | ||
except subprocess.CalledProcessError as e: | ||
return None | ||
|
||
|
||
def get_tag() -> str: | ||
cmd(["git", "fetch", "--tags"]) | ||
desc = cmd(["git", "describe", "--tags"]) | ||
if cmd(["git", "status", "--porcelain"]): | ||
desc += "-dirty" | ||
print(desc) | ||
return desc | ||
|
||
|
||
def write_tag(tag: str): | ||
put("git_tag", tag, subtable="BERYLLIUM", toml=f"{boardpath}/settings.toml") | ||
|
||
|
||
if __name__ == "__main__": | ||
write_tag(get_tag()) |
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,43 @@ | ||
import subprocess | ||
from os import environ | ||
from sys import path as spath | ||
|
||
spath.append("../source/cptoml/") | ||
spath.append("../scripts/CircuitMPY/") | ||
import circuitmpy | ||
from cptoml import put | ||
|
||
if "FSNAME" not in environ: | ||
environ["FSNAME"] = "BERYLLIUM" | ||
[boardpath, board, version] = circuitmpy.detect_board() | ||
|
||
if boardpath == None: | ||
print( | ||
"Error: Board not found.\nMake sure it is attached and mounted before you run make" | ||
) | ||
exit(1) | ||
|
||
|
||
def cmd(txt): | ||
try: | ||
return subprocess.check_output(txt).strip().decode("utf-8") | ||
except subprocess.CalledProcessError as e: | ||
return None | ||
|
||
|
||
def get_tag() -> str: | ||
cmd(["git", "fetch", "--tags"]) | ||
desc = cmd(["git", "describe", "--tags"]) | ||
desc += "-debug" | ||
if cmd(["git", "status", "--porcelain"]): | ||
desc += "-dirty" | ||
print(desc) | ||
return desc | ||
|
||
|
||
def write_tag(tag: str): | ||
put("git_tag", tag, subtable="BERYLLIUM", toml=f"{boardpath}/settings.toml") | ||
|
||
|
||
if __name__ == "__main__": | ||
write_tag(get_tag()) |
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