def initialize(_subparsers, _default, ext_dir='tasks/'): global subparsers, default subparsers, default = _subparsers, _default discover([dirname(__file__), ], lambda x: x, lambda path: path.rpartition('.')[0] != __file__.rpartition('.')[0])
def initialize(_subparsers, _default, ext_dir='tasks/'): global subparsers, default subparsers, default = _subparsers, _default discover([dirname(__file__), ext_dir], lambda x: x, lambda path: path.rpartition('.')[0] != __file__.rpartition('.')[0])
def initialize(directories, conf, env): global __views_list __views_list = [] # view -> path urlmap = [(conf['views'][k]['view'], k) for k in conf['views']] directories += [os.path.dirname(__file__)] helpers.discover(directories, partial(index_views, conf, env, urlmap))
def initialize(directories, conf, env): """Import and initialize filters butskip modules that start with an underscore, md_x or rstx_ as they have special meaning to Acrylamid. :param directories: list of directories :param conf: user config :param env: environment""" directories += [os.path.dirname(__file__)] helpers.discover( directories, partial(index_filters, conf, env), lambda path: not path.startswith(('_', 'mdx_', 'rstx_')) )
def initialize(directories, conf, env): """Import and initialize filters butskip modules that start with an underscore, md_x or rstx_ as they have special meaning to Acrylamid. :param directories: list of directories :param conf: user config :param env: environment""" global __filter_list __filter_list = FilterList() directories += [dirname(__file__)] helpers.discover( directories, index_filters, lambda path: not basename(path).startswith( ('_', 'mdx_', 'rstx_')))
def initialize(directories, conf, env): global __views_list __views_list, urlmap = [], [] for rule, view in conf.views.iteritems(): if 'views' not in view: view['views'] = [view.pop('view'), ] for name in view['views']: item = view.copy() item.pop('views') item['name'] = name urlmap.append((rule, item)) directories += [os.path.dirname(__file__)] helpers.discover(directories, partial(index_views, conf, env, urlmap), lambda path: path.rpartition('.')[0] != __file__.rpartition('.')[0])
def initialize(directories, conf, env): global __views_list __views_list, urlmap = [], [] for rule, view in iteritems(conf.views): if 'views' not in view: view['views'] = [view.pop('view'), ] for name in view['views']: item = view.copy() item.pop('views') item['name'] = name urlmap.append((rule, item)) directories += [os.path.dirname(__file__)] helpers.discover(directories, partial(index_views, conf, env, urlmap), lambda path: path.rpartition('.')[0] != __file__.rpartition('.')[0]) for rule, item in urlmap: log.warn("unable to locate '%s' view", item['name'])
def initialize(conf, env): global pool hooks, blocks = conf.get('hooks', {}), not conf.get('hooks_mt', True) pool = Threadpool(1 if blocks else multiprocessing.cpu_count(), wait=blocks) force = env.options.force normalize = lambda path: path.replace(conf['output_dir'], '') for pattern, action in iteritems(hooks): if isinstance(action, (types.FunctionType, string_types)): event.register( callback=partial(simple, pool, pattern, normalize, action), to=['create', 'update'] if not force else event.events) else: event.register( callback=partial(advanced, pool, pattern, force, normalize, *action), to=event.events) discover([conf.get('HOOKS_DIR', 'hooks/')], lambda x: x)