changeset 8209:01aca0a4f876

py3: officially support Python 3 All tests pass and no known regressions.
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 05 Feb 2020 22:28:20 +0100
parents 9948ed9916c4
children d3b1cdb8179d
files README.rst docs/administrator_guide/auth.rst docs/contributing.rst docs/installation.rst docs/installation_iis.rst docs/installation_win.rst docs/installation_win_old.rst docs/overview.rst docs/setup.rst docs/usage/troubleshooting.rst kallithea/i18n/how_to kallithea/lib/vcs/subprocessio.py scripts/docs-headings.py scripts/validate-minimum-dependency-versions setup.py
diffstat 15 files changed, 51 insertions(+), 84 deletions(-) [+]
line wrap: on
line diff
--- a/README.rst	Fri Jan 31 19:38:09 2020 +0100
+++ b/README.rst	Wed Feb 05 22:28:20 2020 +0100
@@ -24,7 +24,7 @@
 Installation
 ------------
 
-Kallithea requires Python_ 2.7 and it is recommended to install it in a
+Kallithea requires Python_ 3 and it is recommended to install it in a
 virtualenv. Official releases of Kallithea can be installed with::
 
     pip install kallithea
--- a/docs/administrator_guide/auth.rst	Fri Jan 31 19:38:09 2020 +0100
+++ b/docs/administrator_guide/auth.rst	Wed Feb 05 22:28:20 2020 +0100
@@ -135,10 +135,10 @@
 .. _Custom CA Certificates:
 
 Custom CA Certificates : optional
-    Directory used by OpenSSL to find CAs for validating the LDAP server certificate.
-    Python 2.7.10 and later default to using the system certificate store, and
-    this should thus not be necessary when using certificates signed by a CA
-    trusted by the system.
+    Directory used by OpenSSL to find CAs for validating the LDAP server
+    certificate. It defaults to using the system certificate store, and it
+    should thus not be necessary to specify *Custom CA Certificates* when using
+    certificates signed by a CA trusted by the system.
     It can be set to something like `/etc/openldap/cacerts` on older systems or
     if using self-signed certificates.
 
--- a/docs/contributing.rst	Fri Jan 31 19:38:09 2020 +0100
+++ b/docs/contributing.rst	Wed Feb 05 22:28:20 2020 +0100
@@ -92,8 +92,7 @@
 and the test suite creates repositories in the temporary directory. Linux
 systems with /tmp mounted noexec will thus fail.
 
-You can also use ``tox`` to run the tests with all supported Python versions
-(currently only Python 2.7).
+You can also use ``tox`` to run the tests with all supported Python versions.
 
 When running tests, Kallithea generates a `test.ini` based on template values
 in `kallithea/tests/conftest.py` and populates the SQLite database specified
@@ -199,8 +198,7 @@
 consistency with existing code. Run ``scripts/run-all-cleanup`` before
 committing to ensure some basic code formatting consistency.
 
-We currently only support Python 2.7.x and nothing else. For now we don't care
-about Python 3 compatibility.
+We support Python 3.6 and later.
 
 We try to support the most common modern web browsers. IE9 is still supported
 to the extent it is feasible, IE8 is not.
--- a/docs/installation.rst	Fri Jan 31 19:38:09 2020 +0100
+++ b/docs/installation.rst	Wed Feb 05 22:28:20 2020 +0100
@@ -35,12 +35,12 @@
 For Debian and Ubuntu, the following command will ensure that a reasonable
 set of dependencies is installed::
 
-    sudo apt-get install build-essential git python-pip python-virtualenv libffi-dev python-dev
+    sudo apt-get install build-essential git libffi-dev python3-dev
 
 For Fedora and RHEL-derivatives, the following command will ensure that a
 reasonable set of dependencies is installed::
 
-    sudo yum install gcc git python-pip python-virtualenv libffi-devel python-devel
+    sudo yum install gcc git libffi-devel python3-devel
 
 .. _installation-source:
 
@@ -57,7 +57,7 @@
         . ../kallithea-venv/bin/activate
         pip install --upgrade pip setuptools
         pip install --upgrade -e .
-        python2 setup.py compile_catalog   # for translation of the UI
+        python3 setup.py compile_catalog   # for translation of the UI
 
 You can now proceed to :ref:`setup`.
 
--- a/docs/installation_iis.rst	Fri Jan 31 19:38:09 2020 +0100
+++ b/docs/installation_iis.rst	Wed Feb 05 22:28:20 2020 +0100
@@ -1,5 +1,7 @@
 .. _installation_iis:
 
+.. warning:: This section is outdated and needs updating for Python 3.
+
 =====================================================================
 Installing Kallithea on Microsoft Internet Information Services (IIS)
 =====================================================================
@@ -66,7 +68,7 @@
 has been generated, it is necessary to run the following command due to the way
 that ISAPI-WSGI is made::
 
-    python2 dispatch.py install
+    python3 dispatch.py install
 
 This accomplishes two things: generating an ISAPI compliant DLL file,
 ``_dispatch.dll``, and installing a script map handler into IIS for the
@@ -119,7 +121,7 @@
 In order to dump output from WSGI using ``win32traceutil`` it is sufficient to
 type the following in a console window::
 
-    python2 -m win32traceutil
+    python3 -m win32traceutil
 
 and any exceptions occurring in the WSGI layer and below (i.e. in the Kallithea
 application itself) that are uncaught, will be printed here complete with stack
--- a/docs/installation_win.rst	Fri Jan 31 19:38:09 2020 +0100
+++ b/docs/installation_win.rst	Wed Feb 05 22:28:20 2020 +0100
@@ -1,5 +1,7 @@
 .. _installation_win:
 
+.. warning:: This section is outdated and needs updating for Python 3.
+
 ====================================================
 Installation on Windows (7/Server 2008 R2 and newer)
 ====================================================
@@ -17,18 +19,16 @@
 Step 1 -- Install Python
 ^^^^^^^^^^^^^^^^^^^^^^^^
 
-Install Python 2.7.x. Latest version is recommended. If you need another version, they can run side by side.
+Install Python 3. Latest version is recommended. If you need another version, they can run side by side.
 
-.. warning:: Python 3.x is not supported.
-
-- Download Python 2.7.x from http://www.python.org/download/
+- Download Python 3 from http://www.python.org/download/
 - Choose and click on the version
 - Click on "Windows X86-64 Installer" for x64 or "Windows x86 MSI installer" for Win32.
 - Disable UAC or run the installer with admin privileges. If you chose to disable UAC, do not forget to reboot afterwards.
 
-While writing this guide, the latest version was v2.7.9.
+While writing this guide, the latest version was v3.8.1.
 Remember the specific major and minor versions installed, because they will
-be needed in the next step. In this case, it is "2.7".
+be needed in the next step. In this case, it is "3.8".
 
 Step 2 -- Python BIN
 ^^^^^^^^^^^^^^^^^^^^
@@ -42,7 +42,7 @@
   SETX PATH "%PATH%;[your-python-path]" /M
 
 Please substitute [your-python-path] with your Python installation
-path. Typically this is ``C:\\Python27``.
+path. Typically this is ``C:\\Python38``.
 
 Step 3 -- Install pywin32 extensions
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -52,38 +52,14 @@
 
 - Click on "pywin32" folder
 - Click on the first folder (in this case, Build 219, maybe newer when you try)
-- Choose the file ending with ".amd64-py2.x.exe" (".win32-py2.x.exe"
+- Choose the file ending with ".amd64-py3.x.exe" (".win32-py3.x.exe"
   for Win32) where x is the minor version of Python you installed.
   When writing this guide, the file was:
-  http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win-amd64-py2.7.exe/download
+  http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win-amd64-py3.8.exe/download
   (x64)
-  http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win32-py2.7.exe/download
+  http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win32-py3.8.exe/download
   (Win32)
 
-Step 4 -- Install pip
-^^^^^^^^^^^^^^^^^^^^^
-
-pip is a package management system for Python. You will need it to install Kallithea and its dependencies.
-
-If you installed Python 2.7.9+, you already have it (as long as you ran the installer with admin privileges or disabled UAC).
-
-If it was not installed or if you are using Python < 2.7.9:
-
-- Go to https://bootstrap.pypa.io
-- Right-click on get-pip.py and choose Saves as...
-- Run "python2 get-pip.py" in the folder where you downloaded get-pip.py (may require admin access).
-
-.. note::
-
-   See http://stackoverflow.com/questions/4750806/how-to-install-pip-on-windows
-   for details and alternative methods.
-
-Note that pip.exe will be placed inside your Python installation's
-Scripts folder, which is likely not on your path. To correct this,
-open a CMD and type::
-
-  SETX PATH "%PATH%;[your-python-path]\Scripts" /M
-
 Step 5 -- Kallithea folder structure
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
@@ -117,9 +93,9 @@
 
 In order to install Kallithea, you need to be able to run "pip install kallithea". It will use pip to install the Kallithea Python package and its dependencies.
 Some Python packages use managed code and need to be compiled.
-This can be done on Linux without any special steps. On Windows, you will need to install Microsoft Visual C++ compiler for Python 2.7.
+This can be done on Linux without any special steps. On Windows, you will need to install Microsoft Visual C++ compiler for Python 3.8.
 
-Download and install "Microsoft Visual C++ Compiler for Python 2.7" from http://aka.ms/vcpython27
+Download and install "Microsoft Visual C++ Compiler for Python 3.8" from http://aka.ms/vcpython27
 
 .. note::
   You can also install the dependencies using already compiled Windows binaries packages. A good source of compiled Python packages is http://www.lfd.uci.edu/~gohlke/pythonlibs/. However, not all of the necessary packages for Kallithea are on this site and some are hard to find, so we will stick with using the compiler.
--- a/docs/installation_win_old.rst	Fri Jan 31 19:38:09 2020 +0100
+++ b/docs/installation_win_old.rst	Wed Feb 05 22:28:20 2020 +0100
@@ -1,5 +1,7 @@
 .. _installation_win_old:
 
+.. warning:: This section is outdated and needs updating for Python 3.
+
 ==========================================================
 Installation on Windows (XP/Vista/Server 2003/Server 2008)
 ==========================================================
@@ -60,14 +62,11 @@
 Step 2 -- Install Python
 ^^^^^^^^^^^^^^^^^^^^^^^^
 
-Install Python 2.7.x x86 version (32-bit). DO NOT USE A 3.x version.
-Download Python 2.7.x from:
+Install Python 3.8.x from:
 http://www.python.org/download/
 
-Choose "Windows Installer" (32-bit version) not "Windows X86-64
-Installer". While writing this guide, the latest version was v2.7.3.
 Remember the specific major and minor version installed, because it will
-be needed in the next step. In this case, it is "2.7".
+be needed in the next step. In this case, it is "3.8".
 
 .. note::
 
@@ -80,17 +79,17 @@
 http://sourceforge.net/projects/pywin32/files/
 
 - Click on "pywin32" folder
-- Click on the first folder (in this case, Build 217, maybe newer when you try)
-- Choose the file ending with ".win32-py2.x.exe" -> x being the minor
+- Click on the first folder (in this case, Build 218, maybe newer when you try)
+- Choose the file ending with ".win32-py3.x.exe" -> x being the minor
   version of Python you installed (in this case, 7)
   When writing this guide, the file was:
-  http://sourceforge.net/projects/pywin32/files/pywin32/Build%20217/pywin32-217.win32-py2.7.exe/download
+  http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/pywin32-218.win-amd64-py3.8.exe/download
 
   .. note::
 
      64-bit: Download and install the 64-bit version.
      At the time of writing you can find this at:
-     http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/pywin32-218.win-amd64-py2.7.exe/download
+     http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/pywin32-218.win-amd64-py3.8.exe/download
 
 Step 4 -- Python BIN
 ^^^^^^^^^^^^^^^^^^^^
@@ -117,7 +116,7 @@
     SETX PATH "%PATH%;[your-python-path]" /M
 
   Please substitute [your-python-path] with your Python installation path.
-  Typically: C:\\Python27
+  Typically: C:\\Python38
 
 Step 5 -- Kallithea folder structure
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--- a/docs/overview.rst	Fri Jan 31 19:38:09 2020 +0100
+++ b/docs/overview.rst	Wed Feb 05 22:28:20 2020 +0100
@@ -12,7 +12,7 @@
 ------------------
 
 **Kallithea** is written entirely in Python_ and requires Python version
-2.7 or higher. Python 3.x is currently not supported.
+3.6 or higher.
 
 Given a Python installation, there are different ways of providing the
 environment for running Python applications. Each of them pretty much
@@ -98,7 +98,7 @@
   installed with all dependencies using ``pip install kallithea``.
 
   With this method, Kallithea is installed in the Python environment as any
-  other package, usually as a ``.../site-packages/Kallithea-X-py2.7.egg/``
+  other package, usually as a ``.../site-packages/Kallithea-X-py3.8.egg/``
   directory with Python files and everything else that is needed.
 
   (``pip install kallithea`` from a source tree will do pretty much the same
--- a/docs/setup.rst	Fri Jan 31 19:38:09 2020 +0100
+++ b/docs/setup.rst	Wed Feb 05 22:28:20 2020 +0100
@@ -557,7 +557,7 @@
       os.chdir('/srv/kallithea/')
 
       import site
-      site.addsitedir("/srv/kallithea/venv/lib/python2.7/site-packages")
+      site.addsitedir("/srv/kallithea/venv/lib/python3.7/site-packages")
 
       ini = '/srv/kallithea/my.ini'
       from logging.config import fileConfig
--- a/docs/usage/troubleshooting.rst	Fri Jan 31 19:38:09 2020 +0100
+++ b/docs/usage/troubleshooting.rst	Wed Feb 05 22:28:20 2020 +0100
@@ -8,7 +8,7 @@
 :A: Make sure either to set the ``static_files = true`` in the .ini file or
    double check the root path for your http setup. It should point to
    for example:
-   ``/home/my-virtual-python/lib/python2.7/site-packages/kallithea/public``
+   ``/home/my-virtual-python/lib/python3.7/site-packages/kallithea/public``
 
 |
 
--- a/kallithea/i18n/how_to	Fri Jan 31 19:38:09 2020 +0100
+++ b/kallithea/i18n/how_to	Wed Feb 05 22:28:20 2020 +0100
@@ -55,9 +55,9 @@
 
 First update the translation strings::
 
-    python2 setup.py extract_messages
+    python3 setup.py extract_messages
 
-Then regenerate the translation files. This could either be done with `python2
+Then regenerate the translation files. This could either be done with `python3
 setup.py update_catalog` or with `msgmerge` from the `gettext` package. As
 Weblate is also touching these translation files, it is preferred to use the
 same tools (`msgmerge`) and settings as Weblate to minimize the diff::
@@ -73,11 +73,11 @@
 In the prepared development environment, run the following to ensure
 all translation strings are extracted and up-to-date::
 
-    python2 setup.py extract_messages
+    python3 setup.py extract_messages
 
 Create new language by executing following command::
 
-    python2 setup.py init_catalog -l <new_language_code>
+    python3 setup.py init_catalog -l <new_language_code>
 
 This creates a new translation under directory `kallithea/i18n/<new_language_code>`
 based on the translation template file, `kallithea/i18n/kallithea.pot`.
@@ -90,7 +90,7 @@
 
 Finally, compile the translations::
 
-    python2 setup.py compile_catalog -l <new_language_code>
+    python3 setup.py compile_catalog -l <new_language_code>
 
 
 Manually updating translations
@@ -98,11 +98,11 @@
 
 Extract the latest versions of strings for translation by running::
 
-    python2 setup.py extract_messages
+    python3 setup.py extract_messages
 
 Update the PO file by doing::
 
-    python2 setup.py update_catalog -l <new_language_code>
+    python3 setup.py update_catalog -l <new_language_code>
 
 Edit the newly updated translation file. Repeat all steps after the
 `init_catalog` step from the 'new translation' instructions above.
--- a/kallithea/lib/vcs/subprocessio.py	Fri Jan 31 19:38:09 2020 +0100
+++ b/kallithea/lib/vcs/subprocessio.py	Wed Feb 05 22:28:20 2020 +0100
@@ -125,11 +125,7 @@
             if len(t) > ccm:
                 kr.clear()
                 kr.wait(2)
-                # # this only works on 2.7.x and up
-                # if not kr.wait(10):
-                #     raise Exception("Timed out while waiting for input to be read.")
-                # instead we'll use this
-                if len(t) > ccm + 3:
+                if not kr.wait(10):
                     raise IOError(
                         "Timed out while waiting for input from subprocess.")
             t.append(b)
--- a/scripts/docs-headings.py	Fri Jan 31 19:38:09 2020 +0100
+++ b/scripts/docs-headings.py	Wed Feb 05 22:28:20 2020 +0100
@@ -35,6 +35,7 @@
 def main():
     filenames = subprocess.check_output(['hg', 'loc', 'set:**.rst+kallithea/i18n/how_to']).splitlines()
     for fn in filenames:
+        fn = fn.decode()
         print('processing %s' % fn)
         s = open(fn).read()
 
--- a/scripts/validate-minimum-dependency-versions	Fri Jan 31 19:38:09 2020 +0100
+++ b/scripts/validate-minimum-dependency-versions	Wed Feb 05 22:28:20 2020 +0100
@@ -33,9 +33,6 @@
 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"
-
 # Treat any message on stderr as a problem, for the caller to interpret.
 if [ -s "$log" ]; then
     echo
--- a/setup.py	Fri Jan 31 19:38:09 2020 +0100
+++ b/setup.py	Wed Feb 05 22:28:20 2020 +0100
@@ -9,9 +9,6 @@
 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')
 
@@ -88,8 +85,9 @@
     'Intended Audience :: Developers',
     'License :: OSI Approved :: GNU General Public License (GPL)',
     'Operating System :: OS Independent',
-    'Programming Language :: Python',
-    'Programming Language :: Python :: 2.7',
+    'Programming Language :: Python :: 3.6',
+    'Programming Language :: Python :: 3.7',
+    'Programming Language :: Python :: 3.8',
     'Topic :: Software Development :: Version Control',
 ]