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 | |
| 6 | class CustomBuild(build): |
| 7 | def run(self): |
| 8 | build.run(self) |
| 9 | |
| 10 | SETTINGS_FILE = 'settings.yaml' |
| 11 | OUTPUT_FILE = 'settings_file.py' |
| 12 | |
| 13 | with open(SETTINGS_FILE) as s: |
| 14 | data = yaml.safe_load(s) |
| 15 | |
| 16 | with open(OUTPUT_FILE, 'w') as f: |
| 17 | f.write('SETTINGS=\\\n') |
| 18 | pprint.pprint(data, stream=f) |
Adriana Kobylak | 256be78 | 2016-08-24 15:43:16 -0500 | [diff] [blame] | 19 | |
Brad Bishop | 3b3cffb | 2016-09-21 20:19:41 -0400 | [diff] [blame] | 20 | setup( |
| 21 | name='phosphor-settings', |
| 22 | version='1.0', |
| 23 | scripts=['settings_manager.py'], |
Brad Bishop | 54be910 | 2016-09-21 14:50:36 -0400 | [diff] [blame] | 24 | data_files=[('phosphor-settings', ['settings_file.py'])], |
| 25 | cmdclass={'build': CustomBuild}) |