generated/cfb_font_dice.h: don't leak absolute paths in comment
The start of generated/cfb_font_dice.h looked like this: /* * This file was automatically generated using the following command: * /home/john/zephyrproject/zephyr/scripts/gen_cfb_font_header.py * --input fonts/dice.png --output * /home/john/tmp/build/zephyr/include/generated//cfb_font_dice.h * --width 32 --height 32 --first 49 --last 54 */ For build reproduction and "privacy" reasons, change it to this: /* * This file was automatically generated using the following command: * ${ZEPHYR_BASE}/scripts/gen_cfb_font_header.py * --input fonts/dice.png --output * zephyr/include/generated//cfb_font_dice.h * --width 32 --height 32 --first 49 --last 54 */ Test with: sanitycheck -p reel_board \ -T $ZEPHYR_BASE/samples/display/cfb_custom_font/ Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This commit is contained in:
parent
d385db0884
commit
6f98db61f1
2 changed files with 21 additions and 1 deletions
|
@ -15,6 +15,7 @@ function(generate_cfb_font
|
||||||
${ZEPHYR_BASE}/scripts/gen_cfb_font_header.py
|
${ZEPHYR_BASE}/scripts/gen_cfb_font_header.py
|
||||||
--input ${input_file}
|
--input ${input_file}
|
||||||
--output ${output_file}
|
--output ${output_file}
|
||||||
|
--bindir ${CMAKE_BINARY_DIR}
|
||||||
--width ${width}
|
--width ${width}
|
||||||
--height ${height}
|
--height ${height}
|
||||||
${ARGN} # Extra arguments are passed to gen_cfb_font_header.py
|
${ARGN} # Extra arguments are passed to gen_cfb_font_header.py
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from PIL import ImageFont
|
from PIL import ImageFont
|
||||||
|
@ -67,6 +68,21 @@ def generate_header():
|
||||||
guard = "__CFB_FONT_{:s}_{:d}{:d}_H__".format(args.name.upper(), args.width,
|
guard = "__CFB_FONT_{:s}_{:d}{:d}_H__".format(args.name.upper(), args.width,
|
||||||
args.height)
|
args.height)
|
||||||
|
|
||||||
|
zephyr_base = os.environ.get('ZEPHYR_BASE', "")
|
||||||
|
|
||||||
|
clean_cmd = [ ]
|
||||||
|
for arg in sys.argv:
|
||||||
|
if arg.startswith("--bindir"):
|
||||||
|
# Drop. Assumes --bindir= was passed with '=' sign.
|
||||||
|
continue
|
||||||
|
if arg.startswith(args.bindir):
|
||||||
|
# +1 to also strip '/' or '\' separator
|
||||||
|
striplen = min(len(args.bindir)+1, len(arg))
|
||||||
|
clean_cmd.append(arg[striplen:])
|
||||||
|
continue
|
||||||
|
|
||||||
|
clean_cmd.append(arg.replace(zephyr_base, '"${ZEPHYR_BASE}"'))
|
||||||
|
|
||||||
args.output.write("""/*
|
args.output.write("""/*
|
||||||
* This file was automatically generated using the following command:
|
* This file was automatically generated using the following command:
|
||||||
* {cmd}
|
* {cmd}
|
||||||
|
@ -80,7 +96,7 @@ def generate_header():
|
||||||
#include <display/cfb.h>
|
#include <display/cfb.h>
|
||||||
|
|
||||||
const u8_t cfb_font_{name:s}_{width:d}{height:d}[{elem:d}][{b:.0f}] = {{\n"""
|
const u8_t cfb_font_{name:s}_{width:d}{height:d}[{elem:d}][{b:.0f}] = {{\n"""
|
||||||
.format(cmd=" ".join(sys.argv),
|
.format(cmd=" ".join(clean_cmd),
|
||||||
guard=guard,
|
guard=guard,
|
||||||
name=args.name,
|
name=args.name,
|
||||||
width=args.width,
|
width=args.width,
|
||||||
|
@ -141,6 +157,9 @@ def parse_args():
|
||||||
group.add_argument(
|
group.add_argument(
|
||||||
"-o", "--output", type=argparse.FileType('w'), default="-", metavar="FILE",
|
"-o", "--output", type=argparse.FileType('w'), default="-", metavar="FILE",
|
||||||
help="CFB font header file (default: stdout)")
|
help="CFB font header file (default: stdout)")
|
||||||
|
group.add_argument(
|
||||||
|
"--bindir", type=str, default="",
|
||||||
|
help="CMAKE_BINARY_DIR for pure logging purposes. No trailing slash.")
|
||||||
group.add_argument(
|
group.add_argument(
|
||||||
"-x", "--width", required=True, type=int,
|
"-x", "--width", required=True, type=int,
|
||||||
help="width of the CFB font elements in pixels")
|
help="width of the CFB font elements in pixels")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue