# HG changeset patch # User Mads Kiilerich # Date 2020-10-10 21:05:12 # Node ID d332fca2947472fdb316a63ddac20a654ae42720 # Parent f66a13a8ab990a8a8bf93cbd999da4a1f23093da config: move various py templates to kallithea/templates/py/ For some reason, we had some python templates in kallithea/config . kallithea.config is mainly the TG entry point, and thus a high level controller thing - not a place to store templates. Instead, use the templates directory and introduce a new py subdirectory. With git hook templates in a templates directory, there is no need for tmpl in the name. diff --git a/.coveragerc b/.coveragerc --- a/.coveragerc +++ b/.coveragerc @@ -8,9 +8,6 @@ omit = kallithea/lib/dbmigrate/* # the tests themselves should not be part of the coverage report kallithea/tests/* - # the scm hooks are not run in the kallithea process - kallithea/config/post_receive_tmpl.py - kallithea/config/pre_receive_tmpl.py # same omit lines should be present in sections 'run' and 'report' [report] @@ -23,9 +20,6 @@ omit = kallithea/lib/dbmigrate/* # the tests themselves should not be part of the coverage report kallithea/tests/* - # the scm hooks are not run in the kallithea process - kallithea/config/post_receive_tmpl.py - kallithea/config/pre_receive_tmpl.py [paths] source = diff --git a/kallithea/bin/kallithea_cli_extensions.py b/kallithea/bin/kallithea_cli_extensions.py --- a/kallithea/bin/kallithea_cli_extensions.py +++ b/kallithea/bin/kallithea_cli_extensions.py @@ -39,7 +39,7 @@ def extensions_create(): """ here = kallithea.CONFIG['here'] content = pkg_resources.resource_string( - 'kallithea', os.path.join('config', 'extensions', 'extensions.py') + 'kallithea', os.path.join('templates', 'py', 'extensions.py') ) ext_file = os.path.join(here, 'extensions.py') if os.path.exists(ext_file): diff --git a/kallithea/model/scm.py b/kallithea/model/scm.py --- a/kallithea/model/scm.py +++ b/kallithea/model/scm.py @@ -705,11 +705,11 @@ class ScmModel(object): tmpl_post = b"#!%s\n" % safe_bytes(self._get_git_hook_interpreter()) tmpl_post += pkg_resources.resource_string( - 'kallithea', os.path.join('config', 'post_receive_tmpl.py') + 'kallithea', os.path.join('templates', 'py', 'git_post_receive_hook.py') ) tmpl_pre = b"#!%s\n" % safe_bytes(self._get_git_hook_interpreter()) tmpl_pre += pkg_resources.resource_string( - 'kallithea', os.path.join('config', 'pre_receive_tmpl.py') + 'kallithea', os.path.join('templates', 'py', 'git_pre_receive_hook.py') ) for h_type, tmpl in [('pre', tmpl_pre), ('post', tmpl_post)]: diff --git a/kallithea/config/extensions/extensions.py b/kallithea/templates/py/extensions.py rename from kallithea/config/extensions/extensions.py rename to kallithea/templates/py/extensions.py diff --git a/kallithea/config/post_receive_tmpl.py b/kallithea/templates/py/git_post_receive_hook.py rename from kallithea/config/post_receive_tmpl.py rename to kallithea/templates/py/git_post_receive_hook.py diff --git a/kallithea/config/pre_receive_tmpl.py b/kallithea/templates/py/git_pre_receive_hook.py rename from kallithea/config/pre_receive_tmpl.py rename to kallithea/templates/py/git_pre_receive_hook.py