Adriana Kobylak | 256be78 | 2016-08-24 15:43:16 -0500 | [diff] [blame] | 1 | from distutils.core import setup |
Brad Bishop | 54be910 | 2016-09-21 14:50:36 -0400 | [diff] [blame] | 2 | from distutils.command.build import build |
| 3 | import yaml |
| 4 | import pprint |
| 5 | |
Brad Bishop | c1e5e9f | 2016-09-29 09:40:01 -0400 | [diff] [blame] | 6 | |
Brad Bishop | 54be910 | 2016-09-21 14:50:36 -0400 | [diff] [blame] | 7 | class CustomBuild(build): |
| 8 | def run(self): |
| 9 | build.run(self) |
| 10 | |
| 11 | SETTINGS_FILE = 'settings.yaml' |
| 12 | OUTPUT_FILE = 'settings_file.py' |
| 13 | |
| 14 | with open(SETTINGS_FILE) as s: |
| 15 | data = yaml.safe_load(s) |
| 16 | |
| 17 | with open(OUTPUT_FILE, 'w') as f: |
| 18 | f.write('SETTINGS=\\\n') |
| 19 | pprint.pprint(data, stream=f) |
Adriana Kobylak | 256be78 | 2016-08-24 15:43:16 -0500 | [diff] [blame] | 20 | |
Brad Bishop | 3b3cffb | 2016-09-21 20:19:41 -0400 | [diff] [blame] | 21 | setup( |
| 22 | name='phosphor-settings', |
| 23 | version='1.0', |
| 24 | scripts=['settings_manager.py'], |
Brad Bishop | 54be910 | 2016-09-21 14:50:36 -0400 | [diff] [blame] | 25 | data_files=[('phosphor-settings', ['settings_file.py'])], |
| 26 | cmdclass={'build': CustomBuild}) |
Brad Bishop | 31c42f0 | 2016-09-29 09:35:32 -0400 | [diff] [blame] | 27 | |
| 28 | # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 |