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 | |
Gunnar Mills | a16abc5 | 2018-01-27 10:02:34 -0600 | [diff] [blame^] | 21 | |
Brad Bishop | 3b3cffb | 2016-09-21 20:19:41 -0400 | [diff] [blame] | 22 | setup( |
| 23 | name='phosphor-settings', |
| 24 | version='1.0', |
| 25 | scripts=['settings_manager.py'], |
Brad Bishop | 54be910 | 2016-09-21 14:50:36 -0400 | [diff] [blame] | 26 | data_files=[('phosphor-settings', ['settings_file.py'])], |
| 27 | cmdclass={'build': CustomBuild}) |
Brad Bishop | 31c42f0 | 2016-09-29 09:35:32 -0400 | [diff] [blame] | 28 | |
| 29 | # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 |