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>
This commit is contained in:
Peter A. Bigot 2019-07-09 17:24:46 -05:00 committed by Anas Nashif
commit 98a8e293cb

View file

@ -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,