Changeset - aa6f17a53b49
[Not reviewed]
default
0 14 0
Mads Kiilerich - 6 years ago 2019-11-23 22:08:18
mads@kiilerich.com
Grafted from: 3f8e198b4b77
py3: switch to use Python 3 interpreter, temporarily leaving many things very broken until they have been migrated/fixed in a reviewable way

Bump Mercurial minimum version to 5.2 - the first version that claim stable py3
support.
14 files changed with 23 insertions and 17 deletions:
0 comments (0 inline, 0 general)
development.ini
Show inline comments
 
@@ -123,13 +123,13 @@ commit_parse_limit = 25
 
## This value will be written inside the git hook scripts as the text
 
## after '#!' (shebang). When empty or not defined, the value of
 
## 'sys.executable' at the time of installation of the git hooks is
 
## used, which is correct in many cases but for example not when using uwsgi.
 
## If you change this setting, you should reinstall the Git hooks via
 
## Admin > Settings > Remap and Rescan.
 
# git_hook_interpreter = /srv/kallithea/venv/bin/python2
 
# git_hook_interpreter = /srv/kallithea/venv/bin/python3
 

	
 
## path to git executable
 
git_path = git
 

	
 
## git rev filter option, --all is the default filter, if you need to
 
## hide all refs in changelog switch this to --branches --tags
kallithea/__init__.py
Show inline comments
 
@@ -28,12 +28,15 @@ Original author and date, and relevant c
 
"""
 

	
 
import platform
 
import sys
 

	
 

	
 
if sys.version_info < (3, 6):
 
    raise Exception('Kallithea requires python 3.6 or later')
 

	
 
VERSION = (0, 5, 99)
 
BACKENDS = {
 
    'hg': 'Mercurial repository',
 
    'git': 'Git repository',
 
}
 

	
kallithea/lib/paster_commands/template.ini.mako
Show inline comments
 
@@ -217,13 +217,13 @@ commit_parse_limit = 25
 
<%text>## This value will be written inside the git hook scripts as the text</%text>
 
<%text>## after '#!' (shebang). When empty or not defined, the value of</%text>
 
<%text>## 'sys.executable' at the time of installation of the git hooks is</%text>
 
<%text>## used, which is correct in many cases but for example not when using uwsgi.</%text>
 
<%text>## If you change this setting, you should reinstall the Git hooks via</%text>
 
<%text>## Admin > Settings > Remap and Rescan.</%text>
 
# git_hook_interpreter = /srv/kallithea/venv/bin/python2
 
# git_hook_interpreter = /srv/kallithea/venv/bin/python3
 
%if git_hook_interpreter:
 
git_hook_interpreter = ${git_hook_interpreter}
 
%endif
 

	
 
<%text>## path to git executable</%text>
 
git_path = git
kallithea/model/scm.py
Show inline comments
 
@@ -697,13 +697,13 @@ class ScmModel(object):
 
        """
 
        # Note: sys.executable might not point at a usable Python interpreter. For
 
        # example, when using uwsgi, it will point at the uwsgi program itself.
 
        # FIXME This may not work on Windows and may need a shell wrapper script.
 
        return (kallithea.CONFIG.get('git_hook_interpreter')
 
                or sys.executable
 
                or '/usr/bin/env python2')
 
                or '/usr/bin/env python3')
 

	
 
    def install_git_hooks(self, repo, force_create=False):
 
        """
 
        Creates a kallithea hook inside a git repository
 

	
 
        :param repo: Instance of VCS repo
kallithea/tests/scripts/manual_test_crawler.py
Show inline comments
 
#!/usr/bin/env python2
 
#!/usr/bin/env python3
 
# -*- coding: utf-8 -*-
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
scripts/docs-headings.py
Show inline comments
 
#!/usr/bin/env python2
 
#!/usr/bin/env python3
 

	
 
"""
 
Consistent formatting of rst section titles
 
"""
 

	
 
from __future__ import print_function
scripts/generate-ini.py
Show inline comments
 
#!/usr/bin/env python2
 
#!/usr/bin/env python3
 
"""
 
Based on kallithea/lib/paster_commands/template.ini.mako, generate development.ini
 
"""
 

	
 
from __future__ import print_function
 

	
scripts/logformat.py
Show inline comments
 
#!/usr/bin/env python2
 
#!/usr/bin/env python3
 

	
 
from __future__ import print_function
 

	
 
import re
 
import sys
 

	
scripts/make-release
Show inline comments
 
@@ -12,13 +12,13 @@ echo "Checking that you are NOT inside a
 
[ -z "$VIRTUAL_ENV" ]
 

	
 
venv=$(mktemp -d --tmpdir kallithea-release-XXXXX)
 
trap cleanup EXIT
 

	
 
echo "Setting up a fresh virtualenv in $venv"
 
virtualenv -p python2 "$venv"
 
virtualenv -p python3 "$venv"
 
. "$venv/bin/activate"
 

	
 
echo "Install/verify tools needed for building and uploading stuff"
 
pip install --upgrade -e . -r dev_requirements.txt twine python-ldap python-pam
 

	
 
echo "Cleanup and update copyrights ... and clean checkout"
 
@@ -32,27 +32,27 @@ hg archive build
 
cd build
 

	
 
echo "Check that each entry in MANIFEST.in match something"
 
sed -e 's/[^ ]*[ ]*\([^ ]*\).*/\1/g' MANIFEST.in | xargs ls -lad
 

	
 
echo "Build dist"
 
python2 setup.py compile_catalog
 
python2 setup.py sdist
 
python3 setup.py compile_catalog
 
python3 setup.py sdist
 

	
 
echo "Verify VERSION from kallithea/__init__.py"
 
namerel=$(cd dist && echo Kallithea-*.tar.gz)
 
namerel=${namerel%.tar.gz}
 
version=${namerel#Kallithea-}
 
ls -l $(pwd)/dist/$namerel.tar.gz
 
echo "Releasing Kallithea $version in directory $namerel"
 

	
 
echo "Verify dist file content"
 
diff -u <((hg mani | grep -v '^\.hg\|^kallithea/i18n/en/LC_MESSAGES/kallithea.mo$') | LANG=C sort) <(tar tf dist/Kallithea-$version.tar.gz | sed "s|^$namerel/||" | grep . | grep -v '^kallithea/i18n/.*/LC_MESSAGES/kallithea.mo$\|^Kallithea.egg-info/\|^PKG-INFO$\|/$' | LANG=C sort)
 

	
 
echo "Verify docs build"
 
python2 setup.py build_sphinx # the results are not actually used, but we want to make sure it builds
 
python3 setup.py build_sphinx # the results are not actually used, but we want to make sure it builds
 

	
 
echo "Shortlog for inclusion in the release announcement"
 
scripts/shortlog.py "only('.', branch('stable') & tagged() & public() & not '.')"
 

	
 
cat - << EOT
 

	
scripts/shortlog.py
Show inline comments
 
#!/usr/bin/env python2
 
#!/usr/bin/env python3
 
# -*- coding: utf-8 -*-
 

	
 
"""
 
Kallithea script for generating a quick overview of contributors and their
 
commit counts in a given revision set.
 
"""
scripts/update-copyrights.py
Show inline comments
 
#!/usr/bin/env python2
 
#!/usr/bin/env python3
 
# -*- coding: utf-8 -*-
 

	
 
"""
 
Kallithea script for maintaining contributor lists from version control
 
history.
 

	
scripts/validate-commits
Show inline comments
 
@@ -31,13 +31,13 @@ trap finish EXIT
 

	
 
for rev in $(hg log -r "$1" -T '{node}\n'); do
 
    hg log -r "$rev"
 
    hg update "$rev"
 

	
 
    cleanup
 
    virtualenv -p "$(command -v python2)" "$venv"
 
    virtualenv -p "$(command -v python3)" "$venv"
 
    source "$venv/bin/activate"
 
    pip install --upgrade pip setuptools
 
    pip install -e . -r dev_requirements.txt python-ldap python-pam
 

	
 
    # run-all-cleanup
 
    scripts/run-all-cleanup
scripts/validate-minimum-dependency-versions
Show inline comments
 
@@ -25,13 +25,13 @@ mkdir -p "$venv"
 
# Make a light weight parsing of setup.py and dev_requirements.txt,
 
# finding all >= requirements and dumping into a custom requirements.txt
 
# while fixating the requirement at the lower bound.
 
sed -n 's/.*"\(.*\)>=\(.*\)".*/\1==\2/p' setup.py > "$min_requirements"
 
sed 's/>=/==/p' dev_requirements.txt >> "$min_requirements"
 

	
 
virtualenv -p "$(command -v python2)" "$venv"
 
virtualenv -p "$(command -v python3)" "$venv"
 
source "$venv/bin/activate"
 
pip install --upgrade pip setuptools
 
pip install -e . -r "$min_requirements" python-ldap python-pam 2> >(tee "$log" >&2)
 

	
 
# Strip out the known Python 2.7 deprecation message.
 
sed -i '/DEPRECATION: Python 2\.7 /d' "$log"
setup.py
Show inline comments
 
#!/usr/bin/env python2
 
#!/usr/bin/env python3
 
# -*- coding: utf-8 -*-
 
import os
 
import platform
 
import sys
 

	
 
import setuptools
 
# monkey patch setuptools to use distutils owner/group functionality
 
from setuptools.command import sdist
 

	
 

	
 
if sys.version_info < (2, 6) or sys.version_info >= (3,):
 
    raise Exception('Kallithea requires python 2.7')
 
# But temporarily, at the same time:
 
if sys.version_info < (3, 6):
 
    raise Exception('Kallithea requires Python 3.6 or later')
 

	
 

	
 
here = os.path.abspath(os.path.dirname(__file__))
 

	
 

	
 
def _get_meta_var(name, data, callback_handler=None):
 
@@ -59,13 +62,13 @@ requirements = [
 
    "python-dateutil >= 2.1.0, < 2.9",
 
    "Markdown >= 2.2.1, < 3.2",
 
    "docutils >= 0.11, < 0.15",
 
    "URLObject >= 2.3.4, < 2.5",
 
    "Routes >= 2.0, < 2.5",
 
    "dulwich >= 0.19.0, < 0.20",
 
    "mercurial >= 5.1, < 5.4",
 
    "mercurial >= 5.2, < 5.4",
 
    "decorator >= 4.2.1, < 4.5",
 
    "Paste >= 2.0.3, < 3.1",
 
    "bleach >= 3.0, < 3.2",
 
    "Click >= 7.0, < 8",
 
    "ipaddr >= 2.2.0, < 2.3",
 
    "paginate >= 0.5, < 0.6",
0 comments (0 inline, 0 general)