Skip to content

Commit

Permalink
tools/clean-svg: make the tablet name argument optional
Browse files Browse the repository at this point in the history
If we're passing in a .tablet file we don't need the tablet name
argument
  • Loading branch information
whot committed Nov 11, 2024
1 parent 7070531 commit c4bc0c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ jobs:
run: |
for tabletfile in data/*.tablet; do
echo "Checking $tabletfile"
./tools/clean_svg.py --ignore-missing "$tabletfile" ""
./tools/clean_svg.py --ignore-missing "$tabletfile"
done
###
Expand Down
12 changes: 10 additions & 2 deletions tools/clean_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,17 @@ def clean_svg(root, tabletname):
default=False,
help="Ignore .tablet files without a Layout",
)
parser.add_argument("filename", type=str, help="SVG file to clean", metavar="FILE")
parser.add_argument(
"filename",
type=str,
help="SVG file to clean or .tablet file with a Layout=xyz.svg line",
metavar="FILE",
)
parser.add_argument(
"tabletname",
type=str,
help="The name of the tablet",
nargs="?",
help="The name of the tablet, can be omitted if FILE is a .tablet file",
metavar="TABLET_NAME",
)
args = parser.parse_args()
Expand All @@ -345,6 +351,8 @@ def clean_svg(root, tabletname):
sys.exit(0 if args.ignore_missing else 77)
svgfile = Path(args.filename).parent / "layouts" / svgname
tabletname = config["Device"]["Name"]
else:
assert tabletname, "Argument TABLET_NAME must be provided for SVG files"

ET.register_namespace("", NAMESPACE)
try:
Expand Down

0 comments on commit c4bc0c3

Please sign in to comment.