# HG changeset patch # User Mads Kiilerich # Date 2019-11-23 21:08:18 # Node ID aa6f17a53b49e40730cb702957db99a74e7b3cb5 # Parent c440bfd49e120d8541cae531dbf825a91dd148bc 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. diff --git a/development.ini b/development.ini --- a/development.ini +++ b/development.ini @@ -126,7 +126,7 @@ commit_parse_limit = 25 ## 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 diff --git a/kallithea/__init__.py b/kallithea/__init__.py --- a/kallithea/__init__.py +++ b/kallithea/__init__.py @@ -31,6 +31,9 @@ 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', diff --git a/kallithea/lib/paster_commands/template.ini.mako b/kallithea/lib/paster_commands/template.ini.mako --- a/kallithea/lib/paster_commands/template.ini.mako +++ b/kallithea/lib/paster_commands/template.ini.mako @@ -220,7 +220,7 @@ commit_parse_limit = 25 <%text>## used, which is correct in many cases but for example not when using uwsgi. <%text>## If you change this setting, you should reinstall the Git hooks via <%text>## Admin > Settings > Remap and Rescan. -# 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 diff --git a/kallithea/model/scm.py b/kallithea/model/scm.py --- a/kallithea/model/scm.py +++ b/kallithea/model/scm.py @@ -700,7 +700,7 @@ class ScmModel(object): # 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): """ diff --git a/kallithea/tests/scripts/manual_test_crawler.py b/kallithea/tests/scripts/manual_test_crawler.py --- a/kallithea/tests/scripts/manual_test_crawler.py +++ b/kallithea/tests/scripts/manual_test_crawler.py @@ -1,4 +1,4 @@ -#!/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 diff --git a/scripts/docs-headings.py b/scripts/docs-headings.py --- a/scripts/docs-headings.py +++ b/scripts/docs-headings.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ Consistent formatting of rst section titles diff --git a/scripts/generate-ini.py b/scripts/generate-ini.py --- a/scripts/generate-ini.py +++ b/scripts/generate-ini.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ Based on kallithea/lib/paster_commands/template.ini.mako, generate development.ini """ diff --git a/scripts/logformat.py b/scripts/logformat.py --- a/scripts/logformat.py +++ b/scripts/logformat.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 from __future__ import print_function diff --git a/scripts/make-release b/scripts/make-release --- a/scripts/make-release +++ b/scripts/make-release @@ -15,7 +15,7 @@ venv=$(mktemp -d --tmpdir kallithea-rele 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" @@ -35,8 +35,8 @@ echo "Check that each entry in MANIFEST. 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) @@ -49,7 +49,7 @@ 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 '.')" diff --git a/scripts/shortlog.py b/scripts/shortlog.py --- a/scripts/shortlog.py +++ b/scripts/shortlog.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ diff --git a/scripts/update-copyrights.py b/scripts/update-copyrights.py --- a/scripts/update-copyrights.py +++ b/scripts/update-copyrights.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ diff --git a/scripts/validate-commits b/scripts/validate-commits --- a/scripts/validate-commits +++ b/scripts/validate-commits @@ -34,7 +34,7 @@ for rev in $(hg log -r "$1" -T '{node}\n 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 diff --git a/scripts/validate-minimum-dependency-versions b/scripts/validate-minimum-dependency-versions --- a/scripts/validate-minimum-dependency-versions +++ b/scripts/validate-minimum-dependency-versions @@ -28,7 +28,7 @@ mkdir -p "$venv" 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) diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import platform @@ -11,6 +11,9 @@ 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__)) @@ -62,7 +65,7 @@ requirements = [ "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",