mirror of
https://git.planet-casio.com/Lephenixnoir/fxsdk.git
synced 2024-12-29 13:03:37 +01:00
fxconv: add a generic name_regex parameter to simplify naming
This commit is contained in:
parent
2596a53c6b
commit
8259e2dfc8
2 changed files with 9 additions and 2 deletions
|
@ -66,7 +66,10 @@ def parse_parameters(params):
|
||||||
raise FxconvError(f"invalid parameter {decl}, ignoring")
|
raise FxconvError(f"invalid parameter {decl}, ignoring")
|
||||||
else:
|
else:
|
||||||
name, value = decl.split(":", 1)
|
name, value = decl.split(":", 1)
|
||||||
insert(d, name.split("."), value.strip())
|
value = value.strip()
|
||||||
|
if name == "name_regex":
|
||||||
|
value = value.split(" ", 1)
|
||||||
|
insert(d, name.split("."), value)
|
||||||
|
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
|
@ -964,7 +964,11 @@ def convert(input, params, target, output=None, model=None, custom=None):
|
||||||
if output is None:
|
if output is None:
|
||||||
output = os.path.splitext(input)[0] + ".o"
|
output = os.path.splitext(input)[0] + ".o"
|
||||||
|
|
||||||
if "name" not in params:
|
if "name" in params:
|
||||||
|
pass
|
||||||
|
elif "name_regex" in params:
|
||||||
|
params["name"] = re.sub(*params["name_regex"], os.path.basename(input))
|
||||||
|
else:
|
||||||
raise FxconvError(f"no name specified for conversion '{input}'")
|
raise FxconvError(f"no name specified for conversion '{input}'")
|
||||||
|
|
||||||
if target["arch"] is None:
|
if target["arch"] is None:
|
||||||
|
|
Loading…
Reference in a new issue