|
4 | 4 | # Imports
|
5 | 5 | ##############################################################################
|
6 | 6 |
|
7 |
| -from rosinstall_generator.generator import ARG_ALL_PACKAGES, generate_rosinstall, sort_rosinstall |
| 7 | +import rosdistro |
| 8 | +import catkin_pkg |
8 | 9 |
|
9 | 10 | ##############################################################################
|
10 | 11 | # Imports
|
11 | 12 | ##############################################################################
|
12 | 13 |
|
13 | 14 |
|
| 15 | +def has_build_depend_on_message_generation(package): |
| 16 | + ''' |
| 17 | + Checks for a build dependency on message generation to determine if |
| 18 | + that package contains msgs/srvs. |
| 19 | +
|
| 20 | + @param package : typical catkin package object |
| 21 | + @type catkin_pkg.Package |
| 22 | +
|
| 23 | + @return True if it is a package that contains msgs/srvs |
| 24 | + @rtype Bool |
| 25 | + ''' |
| 26 | + return 'message_generation' in [d.name for d in package.build_depends] |
| 27 | + |
| 28 | + |
14 | 29 | def scrape_for_release_message_packages(track):
|
15 |
| - try: |
16 |
| - # Should use ROS_DISTRO here, or some passed in value. |
17 |
| - rosinstall_data = generate_rosinstall(track, [ARG_ALL_PACKAGES], |
18 |
| - wet_only=True, dry_only=False |
19 |
| - ) |
20 |
| - except RuntimeError as unused_e: |
21 |
| - raise RuntimeError("error occured while scraping rosdistro for msg package naems and versions.") |
22 |
| - rosinstall_data = sort_rosinstall(rosinstall_data) |
23 |
| - #print("%s" % rosinstall_data) |
| 30 | + url = rosdistro.get_index_url() |
| 31 | + index = rosdistro.get_index(url) |
| 32 | + cache = rosdistro.get_release_cache(index, 'hydro') |
24 | 33 | packages = []
|
25 |
| - for element in rosinstall_data: |
26 |
| - for unused_key, value in element.items(): |
27 |
| - if "_msgs" in value['local-name'] or "_srvs" in value['local-name']: |
28 |
| - name = value['local-name'] |
29 |
| - # bloom version is usually of the form: 'release/hydro/zeroconf_msgs/0.2.1-0' |
30 |
| - version = value['version'].split('/')[-1].split('-')[0] |
31 |
| - pkg = {'name': name, 'version': version} |
32 |
| - packages.append(pkg) |
| 34 | + for package_name, package_string in cache.package_xmls.iteritems(): |
| 35 | + package = catkin_pkg.package.parse_package_string(package_string) |
| 36 | + #print(" Name: %s" % package_name) |
| 37 | + #print(" Buildtool Depends %s" % package.build) |
| 38 | + if has_build_depend_on_message_generation(package): |
| 39 | + packages.append({'name': package_name, 'version': package.version}) |
33 | 40 | return packages
|
0 commit comments