def step(obj, home_dir): if not obj: obj = {} obj['pyposto_dirs'] = starter._posto_dirs(home_dir) starter._setup_project(obj) build_plugin = obj['project_data']['builder_plugin'] plugin_spec = importlib.util.find_spec(build_plugin) if not plugin_spec: pipmain(['install', build_plugin]) manager.scan()
def scan_for_installed(attr, value): """ scan for entry points of the given groups in the already installed distributions :param value: a list of groups names to scan for """ ensure_list(value, attr) if value: print('scanning for plugins...') from reentry.manager import scan scan(value, group_re=False)
def scan_for_installed(dist, attr, value): # pylint: disable=unused-argument """ scan for entry points of the given groups in the already installed distributions :param value: a list of groups names to scan for """ ensure_list(value, attr) if value: from reentry import manager print('[ REENTRY ] scanning for plugins in groups {}...'.format(value), file=sys.stderr) print('[ REENTRY ] Current entry point map at {}:'.format( get_datafile()), file=sys.stderr) print(manager.format_map(manager.get_dist_map()), file=sys.stderr) scanned_map = manager.scan(groups=value, group_re=False, nodelete=True) print('[ REENTRY ] ... plugin scanning done.', file=sys.stderr) print('[ REENTRY ] Replaced following parts of the map at {}:'.format( get_datafile()), file=sys.stderr) print(manager.format_map(scanned_map), file=sys.stderr) print('[ REENTRY ] Current entry point map at {}:'.format( get_datafile()), file=sys.stderr) print(manager.format_map(manager.get_dist_map()), file=sys.stderr)
def scan(groups, regex): """ Scan for python entry points to cache for faster loading. Scan only for specific PATTERNs or leave empty to scan all """ from reentry import manager if regex: if not groups: # nothing to do sys.exit(0) import re matchstr = re.compile("|".join(['({})'.format(i) for i in groups])) manager.scan(group_re=matchstr) else: manager.scan(groups)
def main(with_noreg): """Test automatic scanning / registering""" entry_point_map = manager.get_entry_map( groups='reentry_test', ep_names=['test-plugin', 'test-noreg', 'builtin']) data_file = py_path.local(get_datafile()) assert entry_point_map, 'The test plugin entry point were not found\nMap:\n{}\n\nData File: {}\n\nContents:\n{}'.format( manager.get_entry_map(), data_file.strpath, data_file.read()) try: test_entry_point = entry_point_map['reentry_test']['test-plugin'] builtin_entry_point = entry_point_map['reentry_test']['builtin'] if with_noreg: noreg_entry_point = entry_point_map['reentry_test']['test-noreg'] except Exception as err: print('datafile: {}'.format(data_file.strpath)) print('\nCurrent relevant entry point map:\n\n') print(manager.format_map(entry_point_map)) print('\n') scan_map = manager.scan(groups=['reentry_test'], nocommit=True) print('\nFull entry point map after scan:\n\n') print(manager.format_map(scan_map)) raise err plugin_class = test_entry_point.load() builtin_class = builtin_entry_point.load() assert plugin_class.test_string == 'TEST', 'The test string was incorrect' assert builtin_class.test_string == 'TEST', 'The test string was incorrect' if with_noreg: noreg_class = noreg_entry_point.load() assert noreg_class.test_string == 'TEST', 'The test string was incorrect' plugin_list = [ ep.load() for ep in manager.iter_entry_points('reentry_test') ] assert plugin_class in plugin_list, 'iter_entry_points found differing test entry point from get_entry_map.' assert builtin_class in plugin_list, 'iter_entry_points found differing test entry point from get_entry_map.' if with_noreg: assert noreg_class in plugin_list, 'iter_entry_points found differing test entry point from get_entry_map.'
# -*- coding: utf-8 -*- # Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html from reentry import manager manager.scan() # -- Path setup -------------------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # import os import sys sys.path.insert(0, os.path.abspath('../../')) import aiida_pseudo # -- Project information ----------------------------------------------------- project = 'aiida-pseudo' copyright = '2020-2021, ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE (Theory and Simulation of Materials (THEOS) and National Centre for Computational Design and Discovery of Novel Materials (NCCR MARVEL)), Switzerland' release = aiida_pseudo.__version__ # -- General configuration ---------------------------------------------------
def run_reentry_scan(_): from reentry import manager manager.scan()