summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@us.ibm.com>2017-02-08 13:25:17 -0500
committerBrad Bishop <bradleyb@us.ibm.com>2017-02-09 09:11:34 -0500
commit513f58eed1c6493a5eba4f0a408087079373d0f1 (patch)
treed1ccdd0b2b9cfd7ae7d06d407b56daea42fc7c33
parent9a6220c185fcde19f3c1f0f856dcf5009b747922 (diff)
downloadphosphor-led-manager-513f58eed1c6493a5eba4f0a408087079373d0f1.zip
phosphor-led-manager-513f58eed1c6493a5eba4f0a408087079373d0f1.tar.gz
led_gen: Add an outputdir cmdline option
The output is currently placed in the same directory as the script. Default instead to cwd, and allow the user to specify so out of tree builds can work. Change-Id: Ia7b94f509e0239f7697634d7a52f22e38d7efc6a Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
-rw-r--r--configure.ac2
-rwxr-xr-xparse_led.py15
2 files changed, 12 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index 8e41173..9fd3720 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,7 +60,7 @@ AC_DEFINE_UNQUOTED([OBJPATH], ["$OBJPATH"], [The Ledmanager Dbus root])
# Handling configuration files
AC_ARG_VAR(YAML_PATH, [The path to the yaml config files.])
AS_IF([test "x$YAML_PATH" == "x"], [YAML_PATH="$srcdir"])
-LEDGEN="$PYTHON $srcdir/parse_led.py -d $YAML_PATH"
+LEDGEN="$PYTHON $srcdir/parse_led.py -i $YAML_PATH"
AC_SUBST(LEDGEN)
# Create configured output
diff --git a/parse_led.py b/parse_led.py
index b63d4bc..552ad67 100755
--- a/parse_led.py
+++ b/parse_led.py
@@ -11,17 +11,24 @@ if __name__ == '__main__':
default='led.yaml',
help="Input File Name")
parser.add_argument(
- "-d", "--directory",
+ "-i", "--input-dir",
+ dest='inputdir',
default=script_dir,
help="Input directory")
+ parser.add_argument(
+ '-o', '--output-dir',
+ dest='outputdir',
+ default='.',
+ help='Output directory.')
+
args = parser.parse_args()
# Default to the one that is in the current.
yaml_dir = script_dir
yaml_file = os.path.join(yaml_dir, 'led.yaml')
- if args.directory:
- yaml_dir = args.directory
+ if args.inputdir:
+ yaml_dir = args.inputdir
if args.filename:
yaml_file = os.path.join(yaml_dir, args.filename)
@@ -29,7 +36,7 @@ if __name__ == '__main__':
with open(yaml_file, 'r') as f:
ifile = yaml.safe_load(f)
- with open(os.path.join(script_dir, 'led-gen.hpp'), 'w') as ofile:
+ with open(os.path.join(args.outputdir, 'led-gen.hpp'), 'w') as ofile:
ofile.write('/* !!! WARNING: This is a GENERATED Code..')
ofile.write('Please do NOT Edit !!! */\n\n')
OpenPOWER on IntegriCloud