This repository has been archived by the owner on Jun 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
58 lines (51 loc) · 1.75 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import subprocess
import sys
from setuptools import setup
import setuptools.command.build_py
package_name = 'spatz_display_rqt'
# List of all .proto files
proto_dir = "external/protobuf_types"
proto_src = [proto_dir + '/container.proto',
proto_dir + '/controlstate.proto',
proto_dir + '/hwhealth.proto',
proto_dir + '/lights.proto',
proto_dir + '/sensor.proto',
proto_dir + '/setpoint.proto',
proto_dir + '/time.proto',
proto_dir + '/util.proto']
proto_dest_dir = "src/spatz_display_rqt/generated"
class BuildWithProtoBuf(setuptools.command.build_py.build_py):
def run(self):
sys.stderr.write("Running protoc generation")
for proto_file in proto_src:
subprocess.run(["protoc", f"-I={proto_dir}", f"--python_out={proto_dest_dir}", f"{proto_file}"])
setuptools.command.build_py.build_py.run(self)
setup(
name=package_name,
version='0.0.0',
packages=[package_name, package_name + ".generated"],
package_dir={'': 'src'},
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + package_name + '/resource',
['resource/display.ui']),
('share/' + package_name, ['package.xml']),
('share/' + package_name, ['plugin.xml']),
],
install_requires=['setuptools'],
cmdclass={
'build_py': BuildWithProtoBuf,
},
zip_safe=True,
maintainer='Jonas Otto',
maintainer_email='[email protected]',
description='TODO: Package description',
license='MIT',
tests_require=['pytest'],
entry_points={
'console_scripts': [
'spatz_display_rqt = ' + package_name + '.main:main',
],
},
)