Verified Commit 45603667 authored by Oskar Roesler's avatar Oskar Roesler
Browse files

Make tool finally rosdistro-independent

parent c7835417
......@@ -45,10 +45,9 @@ class Routines:
if os.path.isfile(file):
sed.rmlinematch(self.package, file)
@staticmethod
def build_metainfo_dict():
def build_metainfo_dict(self):
rosdistro_url = \
f'https://raw.githubusercontent.com/ros/rosdistro/master/{get_ros_distro}/distribution.yaml'
f'https://raw.githubusercontent.com/ros/rosdistro/master/{self.get_ros_distro()}/distribution.yaml'
rosdistro = yaml.load(requests.get(rosdistro_url, allow_redirects=True).content,
Loader=yaml.BaseLoader)['repositories']
ros_dict = {}
......
......@@ -31,14 +31,18 @@ def main(argv):
args = parser.parse_args(argv)
def retry_with_rosdistro_name():
name = "ros-{0}-{1}".format(Routines().get_ros_distro(), args.package)
if os.path.exists(os.path.join(Routines.CACHE_ROOT, "packages/", name)):
routines = Routines()
name = "ros-{0}-{1}".format(routines.get_ros_distro(), args.package)
if os.path.exists(os.path.join(routines.cache_path, 'packages', name)):
try:
commands(args.command, name, args.verbose, args.quiet)
except KeyError:
print(f"Error: {args.package} could not be found in ROS Metainfo dict while running {args.command}")
print(f"Error: {args.package} could not be found in ROS Metainfo dict while running {args.command}",
file=sys.stderr)
except FileNotFoundError:
print(f"Error: {args.package} folder could not be found while running {args.command}")
print(f"Error: {args.package} folder could not be found while running {args.command}", file=sys.stderr)
else:
print(f"Error: {args.package} is not on disk. Try to clone it.", file=sys.stderr)
try:
commands(args.command, args.package, args.verbose, args.quiet)
......
......@@ -8,6 +8,9 @@ import xml.etree.ElementTree as ET
class Update(Routines):
#Singleton to not reload for every package
#metainfo_dict = None
# packages that are missing information or are special cases
skip = ['fcl', 'libviso2', 'viso2_ros', 'opencv3', 'roscpp_git', 'message_filters_git',
'ivcon', 'stage', 'nodelet_tutorial_math', 'common_tutorials',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment