Changeset - 01aca0a4f876
[Not reviewed]
default
0 15 0
Mads Kiilerich (kiilerix) - 5 years ago 2020-02-05 21:28:20
mads@kiilerich.com
Grafted from: 3f8e198b4b77
py3: officially support Python 3

All tests pass and no known regressions.
15 files changed with 51 insertions and 84 deletions:
0 comments (0 inline, 0 general) First comment
README.rst
Show inline comments
 
@@ -24,7 +24,7 @@ Kallithea was forked from RhodeCode in J
 
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
docs/administrator_guide/auth.rst
Show inline comments
 
@@ -135,10 +135,10 @@ Certificate Checks : optional
 
.. _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.
 

	
docs/contributing.rst
Show inline comments
 
@@ -92,8 +92,7 @@ Note that on unix systems, the temporary
 
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 @@ of Mercurial's (https://www.mercurial-sc
 
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.
docs/installation.rst
Show inline comments
 
@@ -35,12 +35,12 @@ Git and development packages for the dat
 
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 @@ repository, follow the instructions belo
 
        . ../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`.
 

	
docs/installation_iis.rst
Show inline comments
 
.. _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 @@ the necessary components to finalize an 
 
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 @@ ISAPI-WSGI wrapper above uses ``win32tra
 
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
docs/installation_win.rst
Show inline comments
 
.. _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 @@ To install on an older version of Window
 
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 @@ Open a CMD and type::
 
  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 @@ http://sourceforge.net/projects/pywin32/
 

	
 
- 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 @@ Step 7 -- Install Kallithea
 

	
 
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.
docs/installation_win_old.rst
Show inline comments
 
.. _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 @@ choose "Visual C++ 2008 Express" when in
 
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 @@ Download pywin32 from:
 
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 @@ that came preinstalled in Vista/7 and ca
 
    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
 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
docs/overview.rst
Show inline comments
 
@@ -12,7 +12,7 @@ Python environment
 
------------------
 

	
 
**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.
 
  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
docs/setup.rst
Show inline comments
 
@@ -557,7 +557,7 @@ that, you'll need to:
 
      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
docs/usage/troubleshooting.rst
Show inline comments
 
@@ -8,7 +8,7 @@ Troubleshooting
 
: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``
 

	
 
|
 

	
kallithea/i18n/how_to
Show inline comments
 
@@ -55,9 +55,9 @@ the translation files (`*.po`).
 

	
 
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 @@ Manual creation of a new language transl
 
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 @@ translation file for errors by executing
 

	
 
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 @@ Manually updating translations
 

	
 
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.
kallithea/lib/vcs/subprocessio.py
Show inline comments
 
@@ -125,11 +125,7 @@ class InputStreamChunker(threading.Threa
 
            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)
scripts/docs-headings.py
Show inline comments
 
@@ -35,6 +35,7 @@ headermatch = re.compile(r'''\n*(.+)\n([
 
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()
 

	
scripts/validate-minimum-dependency-versions
Show inline comments
 
@@ -33,9 +33,6 @@ 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"
 

	
 
# Treat any message on stderr as a problem, for the caller to interpret.
 
if [ -s "$log" ]; then
 
    echo
setup.py
Show inline comments
 
@@ -9,9 +9,6 @@ import setuptools
 
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 @@ classifiers = [
 
    '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',
 
]
 

	
0 comments (0 inline, 0 general) First comment
You need to be logged in to comment. Login now