Changeset - f8971422795e
[Not reviewed]
default
0 11 1
Mads Kiilerich (mads) - 5 years ago 2020-11-07 02:29:41
mads@kiilerich.com
Grafted from: a0cb3480068a
scripts: introduce source_format.py to fix up the module name in file headers
12 files changed with 42 insertions and 17 deletions:
0 comments (0 inline, 0 general)
kallithea/bin/vcs_hooks.py
Show inline comments
 
@@ -13,7 +13,7 @@
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""
 
kallithea.bin.vcs_hooks
 
~~~~~~~~~~~~~~~~~~~
 
~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
Entry points for Kallithea hooking into Mercurial and Git.
 

	
kallithea/config/middleware/https_fixup.py
Show inline comments
 
@@ -12,8 +12,8 @@
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""
 
kallithea.lib.middleware.https_fixup
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
kallithea.config.middleware.https_fixup
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
middleware to handle https correctly
 

	
kallithea/config/middleware/permanent_repo_url.py
Show inline comments
 
@@ -12,8 +12,8 @@
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""
 
kallithea.lib.middleware.permanent_repo_url
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
kallithea.config.middleware.permanent_repo_url
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
middleware to handle permanent repo URLs, replacing PATH_INFO '/_123/yada' with
 
'/name/of/repo/yada' after looking 123 up in the database.
kallithea/config/middleware/pygrack.py
Show inline comments
 
@@ -12,8 +12,8 @@
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""
 
kallithea.lib.middleware.pygrack
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
kallithea.config.middleware.pygrack
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
Python implementation of git-http-backend's Smart HTTP protocol
 

	
kallithea/config/middleware/simplegit.py
Show inline comments
 
@@ -12,8 +12,8 @@
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""
 
kallithea.lib.middleware.simplegit
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
kallithea.config.middleware.simplegit
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
SimpleGit middleware for handling Git protocol requests (push/clone etc.)
 
It's implemented with basic auth function
kallithea/config/middleware/simplehg.py
Show inline comments
 
@@ -12,8 +12,8 @@
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""
 
kallithea.lib.middleware.simplehg
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
kallithea.config.middleware.simplehg
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
SimpleHg middleware for handling Mercurial protocol requests (push/clone etc.).
 
It's implemented with basic auth function
kallithea/config/middleware/wrapper.py
Show inline comments
 
@@ -12,8 +12,8 @@
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""
 
kallithea.lib.middleware.wrapper
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
kallithea.config.middleware.wrapper
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
Wrap app to measure request and response time ... all the way to the response
 
WSGI iterator has been closed.
kallithea/lib/conf.py
Show inline comments
 
@@ -13,7 +13,7 @@
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""
 
kallithea.lib.conf
 
~~~~~~~~~~~~~~~~~~~~~
 
~~~~~~~~~~~~~~~~~~
 

	
 
Various config settings for Kallithea
 

	
kallithea/lib/webutils.py
Show inline comments
 
@@ -13,7 +13,7 @@
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""
 
kallithea.lib.webutils
 
~~~~~~~~~~~~~~~~~~~~
 
~~~~~~~~~~~~~~~~~~~~~~
 

	
 
Helper functions that may rely on the current WSGI request, exposed in the TG2
 
thread-local "global" variables. It should have few dependencies so it can be
kallithea/model/userlog.py
Show inline comments
 
@@ -12,8 +12,8 @@
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""
 
kallithea.model.db
 
~~~~~~~~~~~~~~~~~~
 
kallithea.model.userlog
 
~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
Database Models for Kallithea
 

	
scripts/run-all-cleanup
Show inline comments
 
@@ -8,6 +8,7 @@ set -x
 
scripts/docs-headings.py
 
scripts/generate-ini.py
 
scripts/whitespacecleanup.sh
 
hg files 'set:!binary()&grep("^#!.*python")' 'set:**.py' | xargs scripts/source_format.py
 

	
 
hg files 'set:!binary()&grep("^#!.*python")' 'set:**.py' | xargs scripts/pyflakes
 
echo "no blocking problems found by $0"
scripts/source_format.py
Show inline comments
 
new file 100755
 
#!/usr/bin/env python3
 

	
 
# hg files 'set:!binary()&grep("^#!.*python")' 'set:**.py' | xargs scripts/source_format.py
 

	
 
import re
 
import sys
 

	
 

	
 
filenames = sys.argv[1:]
 

	
 
for fn in filenames:
 
    with open(fn) as f:
 
        org_content = f.read()
 

	
 
    mod_name = fn[:-3] if fn.endswith('.py') else fn
 
    mod_name = mod_name[:-9] if mod_name.endswith('/__init__') else mod_name
 
    mod_name = mod_name.replace('/', '.')
 
    def f(m):
 
        return '"""\n%s\n%s\n' % (mod_name, '~' * len(mod_name))
 
    new_content = re.sub(r'^"""\n(kallithea\..*\n)(~+\n)?', f, org_content, count=1, flags=re.MULTILINE)
 

	
 
    if new_content != org_content:
 
        with open(fn, 'w') as f:
 
            f.write(new_content)
0 comments (0 inline, 0 general)