# HG changeset patch # User Thomas De Schampheleire # Date 1602243548 -7200 # Node ID ec73bce93d6a5b6ef6656bb763284470cf5250a9 # Parent d379e2c39bba4666fd0e62a065e1cb5e60372b4b extensions: rename internal names away from 'rcextensions' Additionally, get rid of the unnecessary 'EXT' variable in load_extensions. diff -r d379e2c39bba -r ec73bce93d6a kallithea/bin/kallithea_cli_index.py --- a/kallithea/bin/kallithea_cli_index.py Thu Oct 08 14:52:00 2020 +0200 +++ b/kallithea/bin/kallithea_cli_index.py Fri Oct 09 13:39:08 2020 +0200 @@ -28,7 +28,7 @@ import kallithea.bin.kallithea_cli_base as cli_base from kallithea.lib.indexers.daemon import WhooshIndexingDaemon from kallithea.lib.pidlock import DaemonLock, LockHeld -from kallithea.lib.utils import load_rcextensions +from kallithea.lib.utils import load_extensions from kallithea.model.repo import RepoModel @@ -41,7 +41,7 @@ """Create or update full text search index""" index_location = kallithea.CONFIG['index_dir'] - load_rcextensions(kallithea.CONFIG['here']) + load_extensions(kallithea.CONFIG['here']) if not repo_location: repo_location = RepoModel().repos_path diff -r d379e2c39bba -r ec73bce93d6a kallithea/config/app_cfg.py --- a/kallithea/config/app_cfg.py Thu Oct 08 14:52:00 2020 +0200 +++ b/kallithea/config/app_cfg.py Fri Oct 09 13:39:08 2020 +0200 @@ -34,7 +34,7 @@ import kallithea.model.base import kallithea.model.meta from kallithea.lib import celerypylons -from kallithea.lib.utils import check_git_version, load_rcextensions, set_app_settings, set_indexer_config, set_vcs_config +from kallithea.lib.utils import check_git_version, load_extensions, set_app_settings, set_indexer_config, set_vcs_config from kallithea.lib.utils2 import asbool from kallithea.model import db @@ -139,7 +139,7 @@ kallithea.CELERY_APP = celerypylons.make_app() kallithea.CONFIG = config - load_rcextensions(root_path=config['here']) + load_extensions(root_path=config['here']) set_app_settings(config) diff -r d379e2c39bba -r ec73bce93d6a kallithea/lib/utils.py --- a/kallithea/lib/utils.py Thu Oct 08 14:52:00 2020 +0200 +++ b/kallithea/lib/utils.py Fri Oct 09 13:39:08 2020 +0200 @@ -520,32 +520,25 @@ return added, removed -def load_rcextensions(root_path): +def load_extensions(root_path): path = os.path.join(root_path, 'rcextensions', '__init__.py') if os.path.isfile(path): - rcext = create_module('rc', path) - EXT = kallithea.EXTENSIONS = rcext - log.debug('Found rcextensions now loading %s...', rcext) + ext = create_module('rc', path) + kallithea.EXTENSIONS = ext + log.debug('Found rcextensions now loading %s...', ext) # Additional mappings that are not present in the pygments lexers - kallithea.config.conf.LANGUAGES_EXTENSIONS_MAP.update(getattr(EXT, 'EXTRA_MAPPINGS', {})) + kallithea.config.conf.LANGUAGES_EXTENSIONS_MAP.update(getattr(ext, 'EXTRA_MAPPINGS', {})) # OVERRIDE OUR EXTENSIONS FROM RC-EXTENSIONS (if present) - if getattr(EXT, 'INDEX_EXTENSIONS', []): + if getattr(ext, 'INDEX_EXTENSIONS', []): log.debug('settings custom INDEX_EXTENSIONS') - kallithea.config.conf.INDEX_EXTENSIONS = getattr(EXT, 'INDEX_EXTENSIONS', []) + kallithea.config.conf.INDEX_EXTENSIONS = getattr(ext, 'INDEX_EXTENSIONS', []) # ADDITIONAL MAPPINGS log.debug('adding extra into INDEX_EXTENSIONS') - kallithea.config.conf.INDEX_EXTENSIONS.extend(getattr(EXT, 'EXTRA_INDEX_EXTENSIONS', [])) - - # auto check if the module is not missing any data, set to default if is - # this will help autoupdate new feature of rcext module - #from kallithea.config import rcextensions - #for k in dir(rcextensions): - # if not k.startswith('_') and not hasattr(EXT, k): - # setattr(EXT, k, getattr(rcextensions, k)) + kallithea.config.conf.INDEX_EXTENSIONS.extend(getattr(ext, 'EXTRA_INDEX_EXTENSIONS', [])) #==============================================================================