changeset 8173:aa6f17a53b49

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.
author Mads Kiilerich <mads@kiilerich.com>
date Sat, 23 Nov 2019 22:08:18 +0100
parents c440bfd49e12
children ebc21c229371
files development.ini kallithea/__init__.py kallithea/lib/paster_commands/template.ini.mako kallithea/model/scm.py kallithea/tests/scripts/manual_test_crawler.py scripts/docs-headings.py scripts/generate-ini.py scripts/logformat.py scripts/make-release scripts/shortlog.py scripts/update-copyrights.py scripts/validate-commits scripts/validate-minimum-dependency-versions setup.py
diffstat 14 files changed, 23 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/development.ini	Sat Jan 25 22:13:43 2020 +0100
+++ b/development.ini	Sat Nov 23 22:08:18 2019 +0100
@@ -126,7 +126,7 @@
 ## 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
--- a/kallithea/__init__.py	Sat Jan 25 22:13:43 2020 +0100
+++ b/kallithea/__init__.py	Sat Nov 23 22:08:18 2019 +0100
@@ -31,6 +31,9 @@
 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',
--- a/kallithea/lib/paster_commands/template.ini.mako	Sat Jan 25 22:13:43 2020 +0100
+++ b/kallithea/lib/paster_commands/template.ini.mako	Sat Nov 23 22:08:18 2019 +0100
@@ -220,7 +220,7 @@
 <%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
--- a/kallithea/model/scm.py	Sat Jan 25 22:13:43 2020 +0100
+++ b/kallithea/model/scm.py	Sat Nov 23 22:08:18 2019 +0100
@@ -700,7 +700,7 @@
         # 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):
         """
--- a/kallithea/tests/scripts/manual_test_crawler.py	Sat Jan 25 22:13:43 2020 +0100
+++ b/kallithea/tests/scripts/manual_test_crawler.py	Sat Nov 23 22:08:18 2019 +0100
@@ -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
--- a/scripts/docs-headings.py	Sat Jan 25 22:13:43 2020 +0100
+++ b/scripts/docs-headings.py	Sat Nov 23 22:08:18 2019 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
 
 """
 Consistent formatting of rst section titles
--- a/scripts/generate-ini.py	Sat Jan 25 22:13:43 2020 +0100
+++ b/scripts/generate-ini.py	Sat Nov 23 22:08:18 2019 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
 """
 Based on kallithea/lib/paster_commands/template.ini.mako, generate development.ini
 """
--- a/scripts/logformat.py	Sat Jan 25 22:13:43 2020 +0100
+++ b/scripts/logformat.py	Sat Nov 23 22:08:18 2019 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
 
 from __future__ import print_function
 
--- a/scripts/make-release	Sat Jan 25 22:13:43 2020 +0100
+++ b/scripts/make-release	Sat Nov 23 22:08:18 2019 +0100
@@ -15,7 +15,7 @@
 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 @@
 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 @@
 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 '.')"
--- a/scripts/shortlog.py	Sat Jan 25 22:13:43 2020 +0100
+++ b/scripts/shortlog.py	Sat Nov 23 22:08:18 2019 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 
 """
--- a/scripts/update-copyrights.py	Sat Jan 25 22:13:43 2020 +0100
+++ b/scripts/update-copyrights.py	Sat Nov 23 22:08:18 2019 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 
 """
--- a/scripts/validate-commits	Sat Jan 25 22:13:43 2020 +0100
+++ b/scripts/validate-commits	Sat Nov 23 22:08:18 2019 +0100
@@ -34,7 +34,7 @@
     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
--- a/scripts/validate-minimum-dependency-versions	Sat Jan 25 22:13:43 2020 +0100
+++ b/scripts/validate-minimum-dependency-versions	Sat Nov 23 22:08:18 2019 +0100
@@ -28,7 +28,7 @@
 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)
--- a/setup.py	Sat Jan 25 22:13:43 2020 +0100
+++ b/setup.py	Sat Nov 23 22:08:18 2019 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 import os
 import platform
@@ -11,6 +11,9 @@
 
 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 @@
     "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",