def package_is_installed(prefix, dist, exact=False, pip=False): packages = list(get_egg_info(prefix) if pip else linked(prefix)) if '::' not in text_type(dist): packages = [p.dist_name for p in packages] if exact: return dist in packages return any(p.startswith(dist) for p in packages)
def print_packages(prefix, regex=None, format='human', piplist=False, json=False, show_channel_urls=show_channel_urls): if not isdir(prefix): common.error_and_exit("""\ Error: environment does not exist: %s # # Use 'conda create' to create an environment before listing its packages.""" % prefix, json=json, error_type="NoEnvironmentFound") if not json: if format == 'human': print('# packages in environment at %s:' % prefix) print('#') if format == 'export': print_export_header() installed = install.linked(prefix) if piplist and use_pip and format == 'human': installed.update(get_egg_info(prefix)) exitcode, output = list_packages(prefix, installed, regex, format=format, show_channel_urls=show_channel_urls) if not json: print('\n'.join(output)) else: common.stdout_json(output) return exitcode
def find_all_unregistered_dists(target_prefix): """ Return a list of the canonical name of all unregistered dists. """ dists = get_egg_info(target_prefix, all_pkgs=False) dist_names = [dist.name for dist in dists] return dist_names