def get_available_types(self, groups=None): """Return a set of tuples of the form (typename, dist_version), one for each available plugin type in the given entry point groups. If groups is None, return the set for all openmdao entry point groups. """ ret = [] if groups is None: groups = plugin_groups.keys() groups = set(groups) typ_dict = self._get_type_dict() distset = self._get_meta_info(ret, groups, typ_dict) if self._search_path is None: # self.env has same contents as working_set, # so don't bother looking through it return ret # now look in the whole Environment dists = [] # we want an iterator of newest dist for each project in Environment for proj in self.env: dist = self.env[proj][0] if dist.project_name not in distset: dists.append(dist) typ_dict = self._entry_map_info(dists) #dset = self._get_meta_info(ret, groups, typ_dict) return ret
def __init__(self, groups=plugin_groups.keys(), search_path=None): super(PkgResourcesFactory, self).__init__() self._have_new_types = True self._groups = copy.copy(groups) self._search_path = search_path self.env = Environment(search_path) self.tree_analyser = PythonSourceTreeAnalyser()
def _entry_map_info(self, distiter): dct = {} for group in plugin_groups.keys(): for dist in distiter: for name, value in dist.get_entry_map(group).items(): lst = dct.setdefault(name, (dist, [], set())) lst[1].append(group) lst[2].add(value.module_name) return dct
def get_types(self): ''' Get a dictionary of types available for creation. ''' # Don't want to get variable types showing up, so we exclude # 'openmdao.variable' from this list. keyset = set(plugin_groups.keys()) exclset = set(['openmdao.variable']) groups = list(keyset - exclset) return packagedict(get_available_types(groups))
def get_types(self): ''' Get a dictionary of types available for creation. ''' #Don't want to get variable types showing up, so we exclude #'openmdao.variable' from this list. keyset = set(plugin_groups.keys()) exclset = set(['openmdao.variable']) groups = list(keyset - exclset) return packagedict(get_available_types(groups))
def get_available_types(groups=None): """Return a set of tuples of the form (typename, dist_version), one for each available plugin type in the given entry point groups. If groups is *None*, return the set for all openmdao entry point groups. """ if groups is None: groups = plugin_groups.keys() else: badgroups = [] for group in groups: if group not in plugin_groups: badgroups.append(group) if badgroups: raise RuntimeError("Didn't recognize the following entry point" " groups: %s. Allowed groups are: %s" % (badgroups, plugin_groups.keys())) types = [] for fct in _factories: types.extend(fct.get_available_types(groups)) return sorted(types, _cmp)
def get_available_types(self, groups=None): """Return a set of tuples of the form (typename, dist_version), one for each available plugin type in the given entry point groups. If groups is None, return the set for all openmdao entry point groups. """ ret = [] if groups is None: groups = plugin_groups.keys() groups = set(groups) typ_dict = self._get_type_dict() self._get_meta_info(ret, groups, typ_dict) return ret