Example #1
0
 def find_modules(self, widget):
     list_of_modules = paparazzi.get_list_of_modules()
     self.update_combo(self.modules_combo, list_of_modules)
Example #2
0
 def find_modules(self, widget):
     list_of_modules = paparazzi.get_list_of_modules()
     self.update_combo(self.modules_combo, list_of_modules)
Example #3
0
    def find_not_tested_by_conf(self, show_airframes, show_flightplans,
                                show_boards, show_modules):
        # Find all airframe, flightplan and module  XML's
        afs = self.find_airframe_files()
        fps = self.find_flightplan_files()
        bs = self.find_board_files()
        mods = dict()
        fps_usage = dict()
        conf_files = paparazzi.get_list_of_conf_files()

        # Generation of list of all files in the sw directory, for checking with the modules.
        if show_modules:
            module_sw_dir = paparazzi.PAPARAZZI_SRC + "/sw/"
            file_dict = dict()
            for root, dirs, dir_files in os.walk(module_sw_dir):
                for dir_file in dir_files:
                    file_dict[dir_file] = os.path.join(root, dir_file)

            mods = {
                name: Module(name, file_dict)
                for name in paparazzi.get_list_of_modules()
            }

        for conf in conf_files:
            airframes = self.list_airframes_in_conf(conf)
            for ac in airframes:
                xml = ac.xml
                flight_plan = ac.flight_plan
                af = self.airframe_details(xml)
                if show_airframes:
                    if xml in afs:
                        afs.remove(xml)
                    if len(af.includes) > 0:
                        for i in af.includes:
                            inc_name = i[5:].replace('$AC_ID', ac.ac_id)
                            if inc_name in afs:
                                afs.remove(inc_name)
                if show_flightplans and flight_plan in fps:
                    fps.remove(flight_plan)
                if show_boards:
                    for board in af.boards:
                        pattern = 'boards/' + board + '.makefile'
                        if pattern in bs:
                            bs.remove(pattern)
                if show_airframes and len(af.includes) > 0:
                    for i in af.includes:
                        inc_name = i[5:].replace('$AC_ID', ac.ac_id)
                        if inc_name in afs:
                            afs.remove(inc_name)
                if show_modules:
                    for ac_mod in ac.modules:
                        mod_str = self.remove_path_and_xml(ac_mod)
                        try:
                            mods[mod_str].usage = mods[mod_str].usage + 1
                        except KeyError:
                            print(
                                mod_str + " in " + str(conf) +
                                ": Does not seem to have an xml file associated with it"
                            )

        # Check if flight plans are included in other flight plans
        if show_flightplans:
            for fp in fps:
                fps_usage[os.path.split(fp)[1]] = ""
            for fp in fps:
                includes = self.flightplan_includes(fp)
                for include in includes:
                    try:
                        fps_usage[include] = fps_usage[include] + str(
                            os.path.split(fp)[1]) + ". "
                    except KeyError:
                        print(
                            include + " in " + fp +
                            ": Does not seem to have an xml file associated with it"
                        )

        # Create usage dictionary for modules
        if show_modules:
            for ac in afs:
                af = self.airframe_details(ac)
                for af_mod in af.modules:
                    if af_mod[1] == "":
                        mod_str = af_mod[0]
                    else:
                        mod_str = af_mod[0] + "_" + af_mod[1]
                    mod_str = self.remove_path_and_xml(mod_str)
                    try:
                        mods[mod_str].usage = mods[mod_str].usage + 1
                    except KeyError:
                        print(
                            mod_str + " in " + af.xml +
                            ": Does not seem to have an xml file associated with it"
                        )

        return afs, fps, bs, mods, fps_usage