|
1 | 1 | from setuptools import find_packages, setup |
2 | 2 | import glob |
| 3 | +import os |
3 | 4 |
|
4 | 5 | package_name = 'coffee_voice_agent' |
5 | 6 |
|
6 | | -setup( |
7 | | - name=package_name, |
8 | | - version='0.0.0', |
9 | | - packages=find_packages(exclude=['test']), |
10 | | - data_files=[ |
| 7 | +def get_data_files(): |
| 8 | + """Get all data files for the scripts directory including subdirectories""" |
| 9 | + data_files = [ |
11 | 10 | ('share/ament_index/resource_index/packages', |
12 | 11 | ['resource/' + package_name]), |
13 | 12 | ('share/' + package_name, ['package.xml']), |
14 | 13 | ('share/' + package_name + '/launch', glob.glob('launch/*.launch.py')), |
15 | | - ('share/' + package_name + '/scripts', glob.glob('scripts/*')), |
16 | | - ], |
| 14 | + ] |
| 15 | + |
| 16 | + # Add top-level script files |
| 17 | + script_files = glob.glob('scripts/*.py') + glob.glob('scripts/*.sh') |
| 18 | + if script_files: |
| 19 | + data_files.append(('share/' + package_name + '/scripts', script_files)) |
| 20 | + |
| 21 | + # Add subdirectory files recursively |
| 22 | + for root, dirs, files in os.walk('scripts'): |
| 23 | + if root == 'scripts': |
| 24 | + continue # Skip root, already handled above |
| 25 | + |
| 26 | + # Get Python files in this directory |
| 27 | + py_files = [os.path.join(root, f) for f in files if f.endswith('.py')] |
| 28 | + if py_files: |
| 29 | + # Convert path for installation |
| 30 | + rel_path = os.path.relpath(root, 'scripts') |
| 31 | + install_path = f'share/{package_name}/scripts/{rel_path}' |
| 32 | + data_files.append((install_path, py_files)) |
| 33 | + |
| 34 | + return data_files |
| 35 | + |
| 36 | +setup( |
| 37 | + name=package_name, |
| 38 | + version='0.0.0', |
| 39 | + packages=find_packages(exclude=['test']), |
| 40 | + data_files=get_data_files(), |
17 | 41 | install_requires=[ |
18 | 42 | 'setuptools', |
19 | 43 | 'rclpy', |
|
0 commit comments