blob: 3233a90f9e3055c26a93967a30f2b72ae393f4bd [file] [log] [blame]
Anatol Pomazaud1a42fb2015-01-24 12:17:42 -08001#!/usr/bin/env python2
Todd Brochbe409372011-12-29 17:12:49 -08002# 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 Broche505b8d2011-03-21 18:19:54 -07005#
6# Based on suggestions in http://guide.python-distribute.org/creation.html
7# ...with a mix of bits from pymox.
8
Ruben Rodriguez Buchillon6fbca6b2018-01-03 15:19:27 +08009import imp
Todd Broche505b8d2011-03-21 18:19:54 -070010import os
Ruben Rodriguez Buchillon51e2d5f2020-03-20 13:26:47 -070011import sys
12
Todd Broche505b8d2011-03-21 18:19:54 -070013from setuptools import setup
Ruben Rodriguez Buchillon6fbca6b2018-01-03 15:19:27 +080014from setuptools.command import build_py
Ruben Rodriguez Buchillon51e2d5f2020-03-20 13:26:47 -070015import servo.sversion_util as svu
16
17__version__ = svu.setuptools_version()
18
Ruben Rodriguez Buchillon6fbca6b2018-01-03 15:19:27 +080019
20class servo_build_py(build_py.build_py):
Matthew Blecker86de8a62020-08-23 23:22:07 -070021 """Custom build_py class for servod to do setup"""
Ruben Rodriguez Buchillon6fbca6b2018-01-03 15:19:27 +080022
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 Buchillon8f751f02020-03-27 20:33:09 -070028
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 Buchillon6fbca6b2018-01-03 15:19:27 +080034 data_dir = self.get_package_dir(self.packages.pop(1))
Ruben Rodriguez Buchillon6fbca6b2018-01-03 15:19:27 +080035 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 Buchillon8f751f02020-03-27 20:33:09 -070039
40 def run(self):
41 """Build INA maps."""
42 self.build_ina_maps()
Ruben Rodriguez Buchillon6fbca6b2018-01-03 15:19:27 +080043 build_py.build_py.run(self)
Todd Broche505b8d2011-03-21 18:19:54 -070044
45setup(
Matthew Blecker86de8a62020-08-23 23:22:07 -070046 name = 'servo',
Tom Wai-Hong Tam720f62b2015-09-28 15:59:30 +080047 version = __version__,
Matthew Blecker86de8a62020-08-23 23:22:07 -070048 package_dir = {'': 'build'},
Todd Broche505b8d2011-03-21 18:19:54 -070049 py_modules=['servo.servod', 'servo.dut_control'],
Ruben Rodriguez Buchillona79d01d2020-02-28 15:10:24 -080050 packages=['servo', 'servo.data', 'servo.drv', 'servo.interface',
Ruben Rodriguez Buchillonb69664c2020-02-19 20:02:11 -080051 'servo.tools', 'servo.utils'],
Matthew Blecker86de8a62020-08-23 23:22:07 -070052 package_data={
53 'servo': [
54 'data/*.xml',
55 'data/*.scenario',
56 'data/*.board',
57 ],
58 },
Ruben Rodriguez Buchillon6fbca6b2018-01-03 15:19:27 +080059 cmdclass={'build_py': servo_build_py},
Matthew Blecker86de8a62020-08-23 23:22:07 -070060 url = 'http://www.chromium.org',
Todd Broche505b8d2011-03-21 18:19:54 -070061 maintainer='chromium os',
62 maintainer_email='chromium-os-dev@chromium.org',
Matthew Blecker86de8a62020-08-23 23:22:07 -070063 license = 'Chromium',
64 description = 'Server to communicate and control servo debug board.',
65 long_description = 'Server to communicate and control servo debug board.',
Todd Broche505b8d2011-03-21 18:19:54 -070066 entry_points={
Matthew Blecker86de8a62020-08-23 23:22:07 -070067 '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 Brochbe409372011-12-29 17:12:49 -080075
76setup(
Matthew Blecker86de8a62020-08-23 23:22:07 -070077 name = 'usbkm232',
Tom Wai-Hong Tam720f62b2015-09-28 15:59:30 +080078 version = __version__,
Matthew Blecker86de8a62020-08-23 23:22:07 -070079 package_dir = {'': 'build'},
Todd Brochbe409372011-12-29 17:12:49 -080080 py_modules=['usbkm232.ctrld', 'usbkm232.ctrlu', 'usbkm232.enter',
Vincent Palatin15192762012-01-04 18:05:22 +000081 'usbkm232.space', 'usbkm232.tab'],
Todd Brochbe409372011-12-29 17:12:49 -080082 packages=['usbkm232'],
Matthew Blecker86de8a62020-08-23 23:22:07 -070083 url = 'http://www.chromium.org',
Todd Brochbe409372011-12-29 17:12:49 -080084 maintainer='chromium os',
85 maintainer_email='chromium-os-dev@chromium.org',
Matthew Blecker86de8a62020-08-23 23:22:07 -070086 license = 'Chromium',
87 description = 'Communicate and control usbkm232 USB keyboard device.',
88 long_description = 'Communicate and control usbkm232 USB keyboard device.',
Todd Brochbe409372011-12-29 17:12:49 -080089 entry_points={
Matthew Blecker86de8a62020-08-23 23:22:07 -070090 '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 Buchillon95c73222019-05-06 15:32:10 -070099
100setup(
Matthew Blecker86de8a62020-08-23 23:22:07 -0700101 name = 'servo_mfg',
Ruben Rodriguez Buchillon95c73222019-05-06 15:32:10 -0700102 version = __version__,
Matthew Blecker86de8a62020-08-23 23:22:07 -0700103 package_dir = {'': 'servo/scripts'},
104 py_modules=['servo_mfg'],
Ruben Rodriguez Buchillon95c73222019-05-06 15:32:10 -0700105 packages=['servo_mfg'],
Matthew Blecker86de8a62020-08-23 23:22:07 -0700106 package_data={
107 'servo_mfg': [
108 'binfiles/*.hex',
Ruben Rodriguez Buchillon31b3dfa2020-07-09 10:57:34 -0700109 'binfiles/*.cfg',
110 'binfiles/*.ini',
111 'binfiles/*.bin',
Matthew Blecker86de8a62020-08-23 23:22:07 -0700112 '*.sh',
113 ],
114 },
115 url = 'http://www.chromium.org',
Ruben Rodriguez Buchillon95c73222019-05-06 15:32:10 -0700116 maintainer='chromium os',
117 maintainer_email='chromium-os-dev@chromium.org',
Matthew Blecker86de8a62020-08-23 23:22:07 -0700118 license = 'Chromium',
119 description = 'Tools to program and validate servo devices.',
Ruben Rodriguez Buchillon95c73222019-05-06 15:32:10 -0700120 entry_points={
Matthew Blecker86de8a62020-08-23 23:22:07 -0700121 '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 Buchillon31b3dfa2020-07-09 10:57:34 -0700126 'servo_mfg = servo_mfg.main:main',
Matthew Blecker86de8a62020-08-23 23:22:07 -0700127 ],
128 })