def get_platforms(): platform_list = {} for path in js.get_paths(paths=gapyJsonPath): config_path = os.path.join(path, 'platforms') if os.path.exists(config_path): files = os.listdir(config_path) for platform_file in files: name = platform_file[:platform_file.index('.json')] if platform_list.get(name) is None: platform_list[name] = os.path.join(config_path, platform_file) return platform_list
def devices(self): devices = [] for path in js.get_paths(): for file in listdir(os.path.join(path, 'devices')): if file.find('.json') != -1: local_path = os.path.join('devices', file) full_path = os.path.join(path, local_path) if isfile(full_path): config = pulp_config.get_config(file=full_path) doc = config.get_str('doc_rst') if doc is not None: doc_path = os.path.join(path, doc) devices.append([config, local_path, doc_path]) if len(self.args.devices) == 0: x = PrettyTable( ['Name', 'Path', 'Description', 'Supported platforms']) x.align = 'l' for device in devices: config = device[0] x.add_row([ config.get_str('name'), device[1], config.get_str('description'), ', '.join(config.get('platforms').get_dict()) ]) print(x) else: for device in devices: if device[0].get_str('name') in self.args.devices: config = device[0] doc_path = device[2] print() with open(doc_path) as doc: print(doc.read())