Anatol Pomazau | d1a42fb | 2015-01-24 12:17:42 -0800 | [diff] [blame] | 1 | #!/usr/bin/env python2 |
Todd Broch | be40937 | 2011-12-29 17:12:49 -0800 | [diff] [blame] | 2 | # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
Todd Broch | e505b8d | 2011-03-21 18:19:54 -0700 | [diff] [blame] | 5 | # |
| 6 | # Based on suggestions in http://guide.python-distribute.org/creation.html |
| 7 | # ...with a mix of bits from pymox. |
| 8 | |
Ruben Rodriguez Buchillon | 6fbca6b | 2018-01-03 15:19:27 +0800 | [diff] [blame] | 9 | import imp |
Todd Broch | e505b8d | 2011-03-21 18:19:54 -0700 | [diff] [blame] | 10 | import os |
Ruben Rodriguez Buchillon | 51e2d5f | 2020-03-20 13:26:47 -0700 | [diff] [blame] | 11 | import sys |
| 12 | |
Todd Broch | e505b8d | 2011-03-21 18:19:54 -0700 | [diff] [blame] | 13 | from setuptools import setup |
Ruben Rodriguez Buchillon | 6fbca6b | 2018-01-03 15:19:27 +0800 | [diff] [blame] | 14 | from setuptools.command import build_py |
Ruben Rodriguez Buchillon | 51e2d5f | 2020-03-20 13:26:47 -0700 | [diff] [blame] | 15 | import servo.sversion_util as svu |
| 16 | |
| 17 | __version__ = svu.setuptools_version() |
| 18 | |
Ruben Rodriguez Buchillon | 6fbca6b | 2018-01-03 15:19:27 +0800 | [diff] [blame] | 19 | |
| 20 | class servo_build_py(build_py.build_py): |
Matthew Blecker | 86de8a6 | 2020-08-23 23:22:07 -0700 | [diff] [blame] | 21 | """Custom build_py class for servod to do setup""" |
Ruben Rodriguez Buchillon | 6fbca6b | 2018-01-03 15:19:27 +0800 | [diff] [blame] | 22 | |
| 23 | # The only reason we include the servo.data package is to build INA |
| 24 | # XML configuration files from simplified .py files. So we pop it |
| 25 | # out to avoid building the python files. |
| 26 | # See generate_ina_controls.py & servo/data/README.md for more |
| 27 | # information. |
Ruben Rodriguez Buchillon | 8f751f0 | 2020-03-27 20:33:09 -0700 | [diff] [blame] | 28 | |
| 29 | def build_ina_maps(self): |
| 30 | """Generate .xml servod configuration files from the servo/data/*.py""" |
| 31 | # get package_data files |
| 32 | # run generate_ina_controls.py over all the files, |
| 33 | # giving the file an output directory? |
Ruben Rodriguez Buchillon | 6fbca6b | 2018-01-03 15:19:27 +0800 | [diff] [blame] | 34 | data_dir = self.get_package_dir(self.packages.pop(1)) |
Ruben Rodriguez Buchillon | 6fbca6b | 2018-01-03 15:19:27 +0800 | [diff] [blame] | 35 | module_name = 'generate_ina_controls' |
| 36 | ina_generator = imp.load_module(module_name, *imp.find_module(module_name, |
| 37 | [data_dir])) |
| 38 | ina_generator.GenerateINAControls(data_dir) |
Ruben Rodriguez Buchillon | 8f751f0 | 2020-03-27 20:33:09 -0700 | [diff] [blame] | 39 | |
| 40 | def run(self): |
| 41 | """Build INA maps.""" |
| 42 | self.build_ina_maps() |
Ruben Rodriguez Buchillon | 6fbca6b | 2018-01-03 15:19:27 +0800 | [diff] [blame] | 43 | build_py.build_py.run(self) |
Todd Broch | e505b8d | 2011-03-21 18:19:54 -0700 | [diff] [blame] | 44 | |
| 45 | setup( |
Matthew Blecker | 86de8a6 | 2020-08-23 23:22:07 -0700 | [diff] [blame] | 46 | name = 'servo', |
Tom Wai-Hong Tam | 720f62b | 2015-09-28 15:59:30 +0800 | [diff] [blame] | 47 | version = __version__, |
Matthew Blecker | 86de8a6 | 2020-08-23 23:22:07 -0700 | [diff] [blame] | 48 | package_dir = {'': 'build'}, |
Todd Broch | e505b8d | 2011-03-21 18:19:54 -0700 | [diff] [blame] | 49 | py_modules=['servo.servod', 'servo.dut_control'], |
Ruben Rodriguez Buchillon | a79d01d | 2020-02-28 15:10:24 -0800 | [diff] [blame] | 50 | packages=['servo', 'servo.data', 'servo.drv', 'servo.interface', |
Ruben Rodriguez Buchillon | b69664c | 2020-02-19 20:02:11 -0800 | [diff] [blame] | 51 | 'servo.tools', 'servo.utils'], |
Matthew Blecker | 86de8a6 | 2020-08-23 23:22:07 -0700 | [diff] [blame] | 52 | package_data={ |
| 53 | 'servo': [ |
| 54 | 'data/*.xml', |
| 55 | 'data/*.scenario', |
| 56 | 'data/*.board', |
| 57 | ], |
| 58 | }, |
Ruben Rodriguez Buchillon | 6fbca6b | 2018-01-03 15:19:27 +0800 | [diff] [blame] | 59 | cmdclass={'build_py': servo_build_py}, |
Matthew Blecker | 86de8a6 | 2020-08-23 23:22:07 -0700 | [diff] [blame] | 60 | url = 'http://www.chromium.org', |
Todd Broch | e505b8d | 2011-03-21 18:19:54 -0700 | [diff] [blame] | 61 | maintainer='chromium os', |
| 62 | maintainer_email='chromium-os-dev@chromium.org', |
Matthew Blecker | 86de8a6 | 2020-08-23 23:22:07 -0700 | [diff] [blame] | 63 | license = 'Chromium', |
| 64 | description = 'Server to communicate and control servo debug board.', |
| 65 | long_description = 'Server to communicate and control servo debug board.', |
Todd Broch | e505b8d | 2011-03-21 18:19:54 -0700 | [diff] [blame] | 66 | entry_points={ |
Matthew Blecker | 86de8a6 | 2020-08-23 23:22:07 -0700 | [diff] [blame] | 67 | 'console_scripts': [ |
| 68 | 'servod = servo.servod:main', |
| 69 | 'dut-control = servo.dut_control:main', |
| 70 | 'dut-power = servo.dut_power:main', |
| 71 | 'servodutil = servo.servodtool:servodutil', |
| 72 | 'servodtool = servo.servodtool:main', |
| 73 | ], |
| 74 | }) |
Todd Broch | be40937 | 2011-12-29 17:12:49 -0800 | [diff] [blame] | 75 | |
| 76 | setup( |
Matthew Blecker | 86de8a6 | 2020-08-23 23:22:07 -0700 | [diff] [blame] | 77 | name = 'usbkm232', |
Tom Wai-Hong Tam | 720f62b | 2015-09-28 15:59:30 +0800 | [diff] [blame] | 78 | version = __version__, |
Matthew Blecker | 86de8a6 | 2020-08-23 23:22:07 -0700 | [diff] [blame] | 79 | package_dir = {'': 'build'}, |
Todd Broch | be40937 | 2011-12-29 17:12:49 -0800 | [diff] [blame] | 80 | py_modules=['usbkm232.ctrld', 'usbkm232.ctrlu', 'usbkm232.enter', |
Vincent Palatin | 1519276 | 2012-01-04 18:05:22 +0000 | [diff] [blame] | 81 | 'usbkm232.space', 'usbkm232.tab'], |
Todd Broch | be40937 | 2011-12-29 17:12:49 -0800 | [diff] [blame] | 82 | packages=['usbkm232'], |
Matthew Blecker | 86de8a6 | 2020-08-23 23:22:07 -0700 | [diff] [blame] | 83 | url = 'http://www.chromium.org', |
Todd Broch | be40937 | 2011-12-29 17:12:49 -0800 | [diff] [blame] | 84 | maintainer='chromium os', |
| 85 | maintainer_email='chromium-os-dev@chromium.org', |
Matthew Blecker | 86de8a6 | 2020-08-23 23:22:07 -0700 | [diff] [blame] | 86 | license = 'Chromium', |
| 87 | description = 'Communicate and control usbkm232 USB keyboard device.', |
| 88 | long_description = 'Communicate and control usbkm232 USB keyboard device.', |
Todd Broch | be40937 | 2011-12-29 17:12:49 -0800 | [diff] [blame] | 89 | entry_points={ |
Matthew Blecker | 86de8a6 | 2020-08-23 23:22:07 -0700 | [diff] [blame] | 90 | 'console_scripts': [ |
| 91 | 'usbkm232-ctrld = usbkm232.ctrld:main', |
| 92 | 'usbkm232-ctrlu = usbkm232.ctrlu:main', |
| 93 | 'usbkm232-enter = usbkm232.enter:main', |
| 94 | 'usbkm232-space = usbkm232.space:main', |
| 95 | 'usbkm232-tab = usbkm232.tab:main', |
| 96 | 'usbkm232-test = usbkm232.usbkm232:main', |
| 97 | ], |
| 98 | }) |
Ruben Rodriguez Buchillon | 95c7322 | 2019-05-06 15:32:10 -0700 | [diff] [blame] | 99 | |
| 100 | setup( |
Matthew Blecker | 86de8a6 | 2020-08-23 23:22:07 -0700 | [diff] [blame] | 101 | name = 'servo_mfg', |
Ruben Rodriguez Buchillon | 95c7322 | 2019-05-06 15:32:10 -0700 | [diff] [blame] | 102 | version = __version__, |
Matthew Blecker | 86de8a6 | 2020-08-23 23:22:07 -0700 | [diff] [blame] | 103 | package_dir = {'': 'servo/scripts'}, |
| 104 | py_modules=['servo_mfg'], |
Ruben Rodriguez Buchillon | 95c7322 | 2019-05-06 15:32:10 -0700 | [diff] [blame] | 105 | packages=['servo_mfg'], |
Matthew Blecker | 86de8a6 | 2020-08-23 23:22:07 -0700 | [diff] [blame] | 106 | package_data={ |
| 107 | 'servo_mfg': [ |
| 108 | 'binfiles/*.hex', |
Ruben Rodriguez Buchillon | 31b3dfa | 2020-07-09 10:57:34 -0700 | [diff] [blame] | 109 | 'binfiles/*.cfg', |
| 110 | 'binfiles/*.ini', |
| 111 | 'binfiles/*.bin', |
Matthew Blecker | 86de8a6 | 2020-08-23 23:22:07 -0700 | [diff] [blame] | 112 | '*.sh', |
| 113 | ], |
| 114 | }, |
| 115 | url = 'http://www.chromium.org', |
Ruben Rodriguez Buchillon | 95c7322 | 2019-05-06 15:32:10 -0700 | [diff] [blame] | 116 | maintainer='chromium os', |
| 117 | maintainer_email='chromium-os-dev@chromium.org', |
Matthew Blecker | 86de8a6 | 2020-08-23 23:22:07 -0700 | [diff] [blame] | 118 | license = 'Chromium', |
| 119 | description = 'Tools to program and validate servo devices.', |
Ruben Rodriguez Buchillon | 95c7322 | 2019-05-06 15:32:10 -0700 | [diff] [blame] | 120 | entry_points={ |
Matthew Blecker | 86de8a6 | 2020-08-23 23:22:07 -0700 | [diff] [blame] | 121 | 'console_scripts': [ |
| 122 | 'mfg_servo_v4 = servo_mfg.mfg_servo_v4:flash_v4', |
| 123 | 'mfg_servo_v4_1 = servo_mfg.mfg_servo_v4:flash_v4point1', |
| 124 | 'mfg_servo_micro = servo_mfg.mfg_servo_micro:main', |
| 125 | 'mfg_c2d2 = servo_mfg.mfg_c2d2:main', |
Ruben Rodriguez Buchillon | 31b3dfa | 2020-07-09 10:57:34 -0700 | [diff] [blame] | 126 | 'servo_mfg = servo_mfg.main:main', |
Matthew Blecker | 86de8a6 | 2020-08-23 23:22:07 -0700 | [diff] [blame] | 127 | ], |
| 128 | }) |