🔧 Add date, version to Config Export

This commit is contained in:
Scott Lahteine 2022-08-04 15:48:14 -05:00
parent 4c9146cffd
commit b7fd046d59
6 changed files with 50 additions and 130 deletions

View file

@ -18,7 +18,7 @@ def apply_opt(name, val, conf=None):
if name == "lcd": name, val = val, "on"
# Create a regex to match the option and capture parts of the line
regex = re.compile(r'^(\s*)(//\s*)?(#define\s+)(' + name + r'\b)(\s*)(.*?)(\s*)(//.*)?$', re.IGNORECASE)
regex = re.compile(rf'^(\s*)(//\s*)?(#define\s+)({name}\b)(\s*)(.*?)(\s*)(//.*)?$', re.IGNORECASE)
# Find and enable and/or update all matches
for file in ("Configuration.h", "Configuration_adv.h"):
@ -87,6 +87,9 @@ def fetch_example(path):
if path.endswith("/"):
path = path[:-1]
if '@' in path:
path, brch = map(strip, path.split('@'))
url = path.replace("%", "%25").replace(" ", "%20")
if not path.startswith('http'):
url = "https://raw.githubusercontent.com/MarlinFirmware/Configurations/bugfix-2.1.x/config/%s" % url