Skip to content
Permalink
Browse files

scripts: gen_cfb_font_header: correct command sanitization

The code to sanitize the generated font path by removing bindir
improperly stripped the first character of every argument when --bindir
was not provided, corrupting the command documentation when fonts are
generated manually.  Only sanitize if --bindir was provided with
non-empty content.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
  • Loading branch information...
pabigot authored and nashif committed Jul 9, 2019
1 parent 8b4d529 commit 98a8e293cbe2b857ae32deb99de0b07e6b886a66
Showing with 2 additions and 2 deletions.
  1. +2 −2 scripts/gen_cfb_font_header.py
@@ -75,7 +75,7 @@ def generate_header():
if arg.startswith("--bindir"):
# Drop. Assumes --bindir= was passed with '=' sign.
continue
if arg.startswith(args.bindir):
if args.bindir and arg.startswith(args.bindir):
# +1 to also strip '/' or '\' separator
striplen = min(len(args.bindir)+1, len(arg))
clean_cmd.append(arg[striplen:])
@@ -158,7 +158,7 @@ def parse_args():
"-o", "--output", type=argparse.FileType('w'), default="-", metavar="FILE",
help="CFB font header file (default: stdout)")
group.add_argument(
"--bindir", type=str, default="",
"--bindir", type=str,
help="CMAKE_BINARY_DIR for pure logging purposes. No trailing slash.")
group.add_argument(
"-x", "--width", required=True, type=int,

0 comments on commit 98a8e29

Please sign in to comment.
You can’t perform that action at this time.