##// END OF EJS Templates
scripts: introduce source_format.py to fix up the module name in file headers
Mads Kiilerich -
r8549:f8971422 default
parent child Browse files
Show More
@@ -0,0 +1,24 b''
1 #!/usr/bin/env python3
2
3 # hg files 'set:!binary()&grep("^#!.*python")' 'set:**.py' | xargs scripts/source_format.py
4
5 import re
6 import sys
7
8
9 filenames = sys.argv[1:]
10
11 for fn in filenames:
12 with open(fn) as f:
13 org_content = f.read()
14
15 mod_name = fn[:-3] if fn.endswith('.py') else fn
16 mod_name = mod_name[:-9] if mod_name.endswith('/__init__') else mod_name
17 mod_name = mod_name.replace('/', '.')
18 def f(m):
19 return '"""\n%s\n%s\n' % (mod_name, '~' * len(mod_name))
20 new_content = re.sub(r'^"""\n(kallithea\..*\n)(~+\n)?', f, org_content, count=1, flags=re.MULTILINE)
21
22 if new_content != org_content:
23 with open(fn, 'w') as f:
24 f.write(new_content)
@@ -13,7 +13,7 b''
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 """
14 """
15 kallithea.bin.vcs_hooks
15 kallithea.bin.vcs_hooks
16 ~~~~~~~~~~~~~~~~~~~
16 ~~~~~~~~~~~~~~~~~~~~~~~
17
17
18 Entry points for Kallithea hooking into Mercurial and Git.
18 Entry points for Kallithea hooking into Mercurial and Git.
19
19
@@ -12,8 +12,8 b''
12 # You should have received a copy of the GNU General Public License
12 # You should have received a copy of the GNU General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 """
14 """
15 kallithea.lib.middleware.https_fixup
15 kallithea.config.middleware.https_fixup
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17
17
18 middleware to handle https correctly
18 middleware to handle https correctly
19
19
@@ -12,8 +12,8 b''
12 # You should have received a copy of the GNU General Public License
12 # You should have received a copy of the GNU General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 """
14 """
15 kallithea.lib.middleware.permanent_repo_url
15 kallithea.config.middleware.permanent_repo_url
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17
17
18 middleware to handle permanent repo URLs, replacing PATH_INFO '/_123/yada' with
18 middleware to handle permanent repo URLs, replacing PATH_INFO '/_123/yada' with
19 '/name/of/repo/yada' after looking 123 up in the database.
19 '/name/of/repo/yada' after looking 123 up in the database.
@@ -12,8 +12,8 b''
12 # You should have received a copy of the GNU General Public License
12 # You should have received a copy of the GNU General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 """
14 """
15 kallithea.lib.middleware.pygrack
15 kallithea.config.middleware.pygrack
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17
17
18 Python implementation of git-http-backend's Smart HTTP protocol
18 Python implementation of git-http-backend's Smart HTTP protocol
19
19
@@ -12,8 +12,8 b''
12 # You should have received a copy of the GNU General Public License
12 # You should have received a copy of the GNU General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 """
14 """
15 kallithea.lib.middleware.simplegit
15 kallithea.config.middleware.simplegit
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17
17
18 SimpleGit middleware for handling Git protocol requests (push/clone etc.)
18 SimpleGit middleware for handling Git protocol requests (push/clone etc.)
19 It's implemented with basic auth function
19 It's implemented with basic auth function
@@ -12,8 +12,8 b''
12 # You should have received a copy of the GNU General Public License
12 # You should have received a copy of the GNU General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 """
14 """
15 kallithea.lib.middleware.simplehg
15 kallithea.config.middleware.simplehg
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17
17
18 SimpleHg middleware for handling Mercurial protocol requests (push/clone etc.).
18 SimpleHg middleware for handling Mercurial protocol requests (push/clone etc.).
19 It's implemented with basic auth function
19 It's implemented with basic auth function
@@ -12,8 +12,8 b''
12 # You should have received a copy of the GNU General Public License
12 # You should have received a copy of the GNU General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 """
14 """
15 kallithea.lib.middleware.wrapper
15 kallithea.config.middleware.wrapper
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17
17
18 Wrap app to measure request and response time ... all the way to the response
18 Wrap app to measure request and response time ... all the way to the response
19 WSGI iterator has been closed.
19 WSGI iterator has been closed.
@@ -13,7 +13,7 b''
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 """
14 """
15 kallithea.lib.conf
15 kallithea.lib.conf
16 ~~~~~~~~~~~~~~~~~~~~~
16 ~~~~~~~~~~~~~~~~~~
17
17
18 Various config settings for Kallithea
18 Various config settings for Kallithea
19
19
@@ -13,7 +13,7 b''
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 """
14 """
15 kallithea.lib.webutils
15 kallithea.lib.webutils
16 ~~~~~~~~~~~~~~~~~~~~
16 ~~~~~~~~~~~~~~~~~~~~~~
17
17
18 Helper functions that may rely on the current WSGI request, exposed in the TG2
18 Helper functions that may rely on the current WSGI request, exposed in the TG2
19 thread-local "global" variables. It should have few dependencies so it can be
19 thread-local "global" variables. It should have few dependencies so it can be
@@ -12,8 +12,8 b''
12 # You should have received a copy of the GNU General Public License
12 # You should have received a copy of the GNU General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 """
14 """
15 kallithea.model.db
15 kallithea.model.userlog
16 ~~~~~~~~~~~~~~~~~~
16 ~~~~~~~~~~~~~~~~~~~~~~~
17
17
18 Database Models for Kallithea
18 Database Models for Kallithea
19
19
@@ -8,6 +8,7 b' set -x'
8 scripts/docs-headings.py
8 scripts/docs-headings.py
9 scripts/generate-ini.py
9 scripts/generate-ini.py
10 scripts/whitespacecleanup.sh
10 scripts/whitespacecleanup.sh
11 hg files 'set:!binary()&grep("^#!.*python")' 'set:**.py' | xargs scripts/source_format.py
11
12
12 hg files 'set:!binary()&grep("^#!.*python")' 'set:**.py' | xargs scripts/pyflakes
13 hg files 'set:!binary()&grep("^#!.*python")' 'set:**.py' | xargs scripts/pyflakes
13 echo "no blocking problems found by $0"
14 echo "no blocking problems found by $0"
General Comments 0
You need to be logged in to leave comments. Login now