Add chip_config user option to chip_data/setup.py
Signed-off-by: Caleb Palmer <cnpalmer@us.ibm.com>
Change-Id: I69784a74feb95c36e91c59a610d04b1fcfe4f0f6
diff --git a/chip_data/setup.py b/chip_data/setup.py
index 408c88a..4fa62a7 100644
--- a/chip_data/setup.py
+++ b/chip_data/setup.py
@@ -27,6 +27,20 @@
# This is a custom build class that is used to dynamically build the data files.
class my_build_py(build_py):
+ user_options = build_py.user_options + [
+ ("chipConfig=", None, "List of chip IDs to build PEL parser JSON")
+ ]
+
+ def initialize_options(self):
+ # Default chip_config option is all valid chip types
+ self.chipConfig = ["p10_10", "p10_20", "explorer", "odyssey"]
+ return super().initialize_options()
+
+ def finalize_options(self):
+ if not isinstance(self.chipConfig, list):
+ self.chipConfig = self.chipConfig.split(",")
+ return super().finalize_options()
+
def run(self):
if not self.dry_run: # honor --dry-run flag
# Make sure the build directory for the data exists.
@@ -36,9 +50,7 @@
self.mkpath(data_dir)
# Generate the PEL parser data JSON from the Chip Data XML.
- # TODO: The list of data file directories will need to be
- # configurable via the package config in the bitbake recipes.
- for chip in ("p10_10", "p10_20", "explorer", "odyssey"):
+ for chip in self.chipConfig:
gen_peltool_json(chip, data_dir)
# Call the superclass run() to ensure everything else builds.