mirror of
https://github.com/meshtastic/firmware.git
synced 2025-07-31 02:45:41 +00:00
get git url part from local repo (#7331)
This commit is contained in:
parent
29cca4d621
commit
ac3e5684d6
@ -3,6 +3,7 @@
|
|||||||
# trunk-ignore-all(flake8/F821): For SConstruct imports
|
# trunk-ignore-all(flake8/F821): For SConstruct imports
|
||||||
import sys
|
import sys
|
||||||
from os.path import join
|
from os.path import join
|
||||||
|
import subprocess
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@ -92,6 +93,17 @@ prefsLoc = projenv["PROJECT_DIR"] + "/version.properties"
|
|||||||
verObj = readProps(prefsLoc)
|
verObj = readProps(prefsLoc)
|
||||||
print("Using meshtastic platformio-custom.py, firmware version " + verObj["long"] + " on " + env.get("PIOENV"))
|
print("Using meshtastic platformio-custom.py, firmware version " + verObj["long"] + " on " + env.get("PIOENV"))
|
||||||
|
|
||||||
|
# get repository owner if git is installed
|
||||||
|
try:
|
||||||
|
r_owner = (
|
||||||
|
subprocess.check_output(["git", "config", "--get", "remote.origin.url"])
|
||||||
|
.decode("utf-8")
|
||||||
|
.strip().split("/")
|
||||||
|
)
|
||||||
|
repo_owner = r_owner[-2] + "/" + r_owner[-1].replace(".git", "")
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
repo_owner = "unknown"
|
||||||
|
|
||||||
jsonLoc = env["PROJECT_DIR"] + "/userPrefs.jsonc"
|
jsonLoc = env["PROJECT_DIR"] + "/userPrefs.jsonc"
|
||||||
with open(jsonLoc) as f:
|
with open(jsonLoc) as f:
|
||||||
jsonStr = re.sub("//.*","", f.read(), flags=re.MULTILINE)
|
jsonStr = re.sub("//.*","", f.read(), flags=re.MULTILINE)
|
||||||
@ -117,6 +129,7 @@ flags = [
|
|||||||
"-DAPP_VERSION=" + verObj["long"],
|
"-DAPP_VERSION=" + verObj["long"],
|
||||||
"-DAPP_VERSION_SHORT=" + verObj["short"],
|
"-DAPP_VERSION_SHORT=" + verObj["short"],
|
||||||
"-DAPP_ENV=" + env.get("PIOENV"),
|
"-DAPP_ENV=" + env.get("PIOENV"),
|
||||||
|
"-DAPP_REPO=" + repo_owner,
|
||||||
] + pref_flags
|
] + pref_flags
|
||||||
|
|
||||||
print ("Using flags:")
|
print ("Using flags:")
|
||||||
|
@ -286,7 +286,7 @@ void lateInitVariant() {}
|
|||||||
*/
|
*/
|
||||||
void printInfo()
|
void printInfo()
|
||||||
{
|
{
|
||||||
LOG_INFO("S:B:%d,%s,%s", HW_VENDOR, optstr(APP_VERSION), optstr(APP_ENV));
|
LOG_INFO("S:B:%d,%s,%s,%s", HW_VENDOR, optstr(APP_VERSION), optstr(APP_ENV), optstr(APP_REPO));
|
||||||
}
|
}
|
||||||
#ifndef PIO_UNIT_TESTING
|
#ifndef PIO_UNIT_TESTING
|
||||||
void setup()
|
void setup()
|
||||||
|
Loading…
Reference in New Issue
Block a user