##// END OF EJS Templates
py3: officially support Python 3...
Mads Kiilerich -
r8089:01aca0a4 default
parent child Browse files
Show More
@@ -24,7 +24,7 b' Kallithea was forked from RhodeCode in J'
24 Installation
24 Installation
25 ------------
25 ------------
26
26
27 Kallithea requires Python_ 2.7 and it is recommended to install it in a
27 Kallithea requires Python_ 3 and it is recommended to install it in a
28 virtualenv. Official releases of Kallithea can be installed with::
28 virtualenv. Official releases of Kallithea can be installed with::
29
29
30 pip install kallithea
30 pip install kallithea
@@ -135,10 +135,10 b' Certificate Checks : optional'
135 .. _Custom CA Certificates:
135 .. _Custom CA Certificates:
136
136
137 Custom CA Certificates : optional
137 Custom CA Certificates : optional
138 Directory used by OpenSSL to find CAs for validating the LDAP server certificate.
138 Directory used by OpenSSL to find CAs for validating the LDAP server
139 Python 2.7.10 and later default to using the system certificate store, and
139 certificate. It defaults to using the system certificate store, and it
140 this should thus not be necessary when using certificates signed by a CA
140 should thus not be necessary to specify *Custom CA Certificates* when using
141 trusted by the system.
141 certificates signed by a CA trusted by the system.
142 It can be set to something like `/etc/openldap/cacerts` on older systems or
142 It can be set to something like `/etc/openldap/cacerts` on older systems or
143 if using self-signed certificates.
143 if using self-signed certificates.
144
144
@@ -92,8 +92,7 b' Note that on unix systems, the temporary'
92 and the test suite creates repositories in the temporary directory. Linux
92 and the test suite creates repositories in the temporary directory. Linux
93 systems with /tmp mounted noexec will thus fail.
93 systems with /tmp mounted noexec will thus fail.
94
94
95 You can also use ``tox`` to run the tests with all supported Python versions
95 You can also use ``tox`` to run the tests with all supported Python versions.
96 (currently only Python 2.7).
97
96
98 When running tests, Kallithea generates a `test.ini` based on template values
97 When running tests, Kallithea generates a `test.ini` based on template values
99 in `kallithea/tests/conftest.py` and populates the SQLite database specified
98 in `kallithea/tests/conftest.py` and populates the SQLite database specified
@@ -199,8 +198,7 b" of Mercurial's (https://www.mercurial-sc"
199 consistency with existing code. Run ``scripts/run-all-cleanup`` before
198 consistency with existing code. Run ``scripts/run-all-cleanup`` before
200 committing to ensure some basic code formatting consistency.
199 committing to ensure some basic code formatting consistency.
201
200
202 We currently only support Python 2.7.x and nothing else. For now we don't care
201 We support Python 3.6 and later.
203 about Python 3 compatibility.
204
202
205 We try to support the most common modern web browsers. IE9 is still supported
203 We try to support the most common modern web browsers. IE9 is still supported
206 to the extent it is feasible, IE8 is not.
204 to the extent it is feasible, IE8 is not.
@@ -35,12 +35,12 b' Git and development packages for the dat'
35 For Debian and Ubuntu, the following command will ensure that a reasonable
35 For Debian and Ubuntu, the following command will ensure that a reasonable
36 set of dependencies is installed::
36 set of dependencies is installed::
37
37
38 sudo apt-get install build-essential git python-pip python-virtualenv libffi-dev python-dev
38 sudo apt-get install build-essential git libffi-dev python3-dev
39
39
40 For Fedora and RHEL-derivatives, the following command will ensure that a
40 For Fedora and RHEL-derivatives, the following command will ensure that a
41 reasonable set of dependencies is installed::
41 reasonable set of dependencies is installed::
42
42
43 sudo yum install gcc git python-pip python-virtualenv libffi-devel python-devel
43 sudo yum install gcc git libffi-devel python3-devel
44
44
45 .. _installation-source:
45 .. _installation-source:
46
46
@@ -57,7 +57,7 b' repository, follow the instructions belo'
57 . ../kallithea-venv/bin/activate
57 . ../kallithea-venv/bin/activate
58 pip install --upgrade pip setuptools
58 pip install --upgrade pip setuptools
59 pip install --upgrade -e .
59 pip install --upgrade -e .
60 python2 setup.py compile_catalog # for translation of the UI
60 python3 setup.py compile_catalog # for translation of the UI
61
61
62 You can now proceed to :ref:`setup`.
62 You can now proceed to :ref:`setup`.
63
63
@@ -1,5 +1,7 b''
1 .. _installation_iis:
1 .. _installation_iis:
2
2
3 .. warning:: This section is outdated and needs updating for Python 3.
4
3 =====================================================================
5 =====================================================================
4 Installing Kallithea on Microsoft Internet Information Services (IIS)
6 Installing Kallithea on Microsoft Internet Information Services (IIS)
5 =====================================================================
7 =====================================================================
@@ -66,7 +68,7 b' the necessary components to finalize an '
66 has been generated, it is necessary to run the following command due to the way
68 has been generated, it is necessary to run the following command due to the way
67 that ISAPI-WSGI is made::
69 that ISAPI-WSGI is made::
68
70
69 python2 dispatch.py install
71 python3 dispatch.py install
70
72
71 This accomplishes two things: generating an ISAPI compliant DLL file,
73 This accomplishes two things: generating an ISAPI compliant DLL file,
72 ``_dispatch.dll``, and installing a script map handler into IIS for the
74 ``_dispatch.dll``, and installing a script map handler into IIS for the
@@ -119,7 +121,7 b' ISAPI-WSGI wrapper above uses ``win32tra'
119 In order to dump output from WSGI using ``win32traceutil`` it is sufficient to
121 In order to dump output from WSGI using ``win32traceutil`` it is sufficient to
120 type the following in a console window::
122 type the following in a console window::
121
123
122 python2 -m win32traceutil
124 python3 -m win32traceutil
123
125
124 and any exceptions occurring in the WSGI layer and below (i.e. in the Kallithea
126 and any exceptions occurring in the WSGI layer and below (i.e. in the Kallithea
125 application itself) that are uncaught, will be printed here complete with stack
127 application itself) that are uncaught, will be printed here complete with stack
@@ -1,5 +1,7 b''
1 .. _installation_win:
1 .. _installation_win:
2
2
3 .. warning:: This section is outdated and needs updating for Python 3.
4
3 ====================================================
5 ====================================================
4 Installation on Windows (7/Server 2008 R2 and newer)
6 Installation on Windows (7/Server 2008 R2 and newer)
5 ====================================================
7 ====================================================
@@ -17,18 +19,16 b' To install on an older version of Window'
17 Step 1 -- Install Python
19 Step 1 -- Install Python
18 ^^^^^^^^^^^^^^^^^^^^^^^^
20 ^^^^^^^^^^^^^^^^^^^^^^^^
19
21
20 Install Python 2.7.x. Latest version is recommended. If you need another version, they can run side by side.
22 Install Python 3. Latest version is recommended. If you need another version, they can run side by side.
21
23
22 .. warning:: Python 3.x is not supported.
24 - Download Python 3 from http://www.python.org/download/
23
24 - Download Python 2.7.x from http://www.python.org/download/
25 - Choose and click on the version
25 - Choose and click on the version
26 - Click on "Windows X86-64 Installer" for x64 or "Windows x86 MSI installer" for Win32.
26 - Click on "Windows X86-64 Installer" for x64 or "Windows x86 MSI installer" for Win32.
27 - Disable UAC or run the installer with admin privileges. If you chose to disable UAC, do not forget to reboot afterwards.
27 - Disable UAC or run the installer with admin privileges. If you chose to disable UAC, do not forget to reboot afterwards.
28
28
29 While writing this guide, the latest version was v2.7.9.
29 While writing this guide, the latest version was v3.8.1.
30 Remember the specific major and minor versions installed, because they will
30 Remember the specific major and minor versions installed, because they will
31 be needed in the next step. In this case, it is "2.7".
31 be needed in the next step. In this case, it is "3.8".
32
32
33 Step 2 -- Python BIN
33 Step 2 -- Python BIN
34 ^^^^^^^^^^^^^^^^^^^^
34 ^^^^^^^^^^^^^^^^^^^^
@@ -42,7 +42,7 b' Open a CMD and type::'
42 SETX PATH "%PATH%;[your-python-path]" /M
42 SETX PATH "%PATH%;[your-python-path]" /M
43
43
44 Please substitute [your-python-path] with your Python installation
44 Please substitute [your-python-path] with your Python installation
45 path. Typically this is ``C:\\Python27``.
45 path. Typically this is ``C:\\Python38``.
46
46
47 Step 3 -- Install pywin32 extensions
47 Step 3 -- Install pywin32 extensions
48 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -52,38 +52,14 b' http://sourceforge.net/projects/pywin32/'
52
52
53 - Click on "pywin32" folder
53 - Click on "pywin32" folder
54 - Click on the first folder (in this case, Build 219, maybe newer when you try)
54 - Click on the first folder (in this case, Build 219, maybe newer when you try)
55 - Choose the file ending with ".amd64-py2.x.exe" (".win32-py2.x.exe"
55 - Choose the file ending with ".amd64-py3.x.exe" (".win32-py3.x.exe"
56 for Win32) where x is the minor version of Python you installed.
56 for Win32) where x is the minor version of Python you installed.
57 When writing this guide, the file was:
57 When writing this guide, the file was:
58 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win-amd64-py2.7.exe/download
58 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win-amd64-py3.8.exe/download
59 (x64)
59 (x64)
60 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win32-py2.7.exe/download
60 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win32-py3.8.exe/download
61 (Win32)
61 (Win32)
62
62
63 Step 4 -- Install pip
64 ^^^^^^^^^^^^^^^^^^^^^
65
66 pip is a package management system for Python. You will need it to install Kallithea and its dependencies.
67
68 If you installed Python 2.7.9+, you already have it (as long as you ran the installer with admin privileges or disabled UAC).
69
70 If it was not installed or if you are using Python < 2.7.9:
71
72 - Go to https://bootstrap.pypa.io
73 - Right-click on get-pip.py and choose Saves as...
74 - Run "python2 get-pip.py" in the folder where you downloaded get-pip.py (may require admin access).
75
76 .. note::
77
78 See http://stackoverflow.com/questions/4750806/how-to-install-pip-on-windows
79 for details and alternative methods.
80
81 Note that pip.exe will be placed inside your Python installation's
82 Scripts folder, which is likely not on your path. To correct this,
83 open a CMD and type::
84
85 SETX PATH "%PATH%;[your-python-path]\Scripts" /M
86
87 Step 5 -- Kallithea folder structure
63 Step 5 -- Kallithea folder structure
88 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
64 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
89
65
@@ -117,9 +93,9 b' Step 7 -- Install Kallithea'
117
93
118 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.
94 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.
119 Some Python packages use managed code and need to be compiled.
95 Some Python packages use managed code and need to be compiled.
120 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.
96 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.
121
97
122 Download and install "Microsoft Visual C++ Compiler for Python 2.7" from http://aka.ms/vcpython27
98 Download and install "Microsoft Visual C++ Compiler for Python 3.8" from http://aka.ms/vcpython27
123
99
124 .. note::
100 .. note::
125 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.
101 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.
@@ -1,5 +1,7 b''
1 .. _installation_win_old:
1 .. _installation_win_old:
2
2
3 .. warning:: This section is outdated and needs updating for Python 3.
4
3 ==========================================================
5 ==========================================================
4 Installation on Windows (XP/Vista/Server 2003/Server 2008)
6 Installation on Windows (XP/Vista/Server 2003/Server 2008)
5 ==========================================================
7 ==========================================================
@@ -60,14 +62,11 b' choose "Visual C++ 2008 Express" when in'
60 Step 2 -- Install Python
62 Step 2 -- Install Python
61 ^^^^^^^^^^^^^^^^^^^^^^^^
63 ^^^^^^^^^^^^^^^^^^^^^^^^
62
64
63 Install Python 2.7.x x86 version (32-bit). DO NOT USE A 3.x version.
65 Install Python 3.8.x from:
64 Download Python 2.7.x from:
65 http://www.python.org/download/
66 http://www.python.org/download/
66
67
67 Choose "Windows Installer" (32-bit version) not "Windows X86-64
68 Installer". While writing this guide, the latest version was v2.7.3.
69 Remember the specific major and minor version installed, because it will
68 Remember the specific major and minor version installed, because it will
70 be needed in the next step. In this case, it is "2.7".
69 be needed in the next step. In this case, it is "3.8".
71
70
72 .. note::
71 .. note::
73
72
@@ -80,17 +79,17 b' Download pywin32 from:'
80 http://sourceforge.net/projects/pywin32/files/
79 http://sourceforge.net/projects/pywin32/files/
81
80
82 - Click on "pywin32" folder
81 - Click on "pywin32" folder
83 - Click on the first folder (in this case, Build 217, maybe newer when you try)
82 - Click on the first folder (in this case, Build 218, maybe newer when you try)
84 - Choose the file ending with ".win32-py2.x.exe" -> x being the minor
83 - Choose the file ending with ".win32-py3.x.exe" -> x being the minor
85 version of Python you installed (in this case, 7)
84 version of Python you installed (in this case, 7)
86 When writing this guide, the file was:
85 When writing this guide, the file was:
87 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20217/pywin32-217.win32-py2.7.exe/download
86 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/pywin32-218.win-amd64-py3.8.exe/download
88
87
89 .. note::
88 .. note::
90
89
91 64-bit: Download and install the 64-bit version.
90 64-bit: Download and install the 64-bit version.
92 At the time of writing you can find this at:
91 At the time of writing you can find this at:
93 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/pywin32-218.win-amd64-py2.7.exe/download
92 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/pywin32-218.win-amd64-py3.8.exe/download
94
93
95 Step 4 -- Python BIN
94 Step 4 -- Python BIN
96 ^^^^^^^^^^^^^^^^^^^^
95 ^^^^^^^^^^^^^^^^^^^^
@@ -117,7 +116,7 b' that came preinstalled in Vista/7 and ca'
117 SETX PATH "%PATH%;[your-python-path]" /M
116 SETX PATH "%PATH%;[your-python-path]" /M
118
117
119 Please substitute [your-python-path] with your Python installation path.
118 Please substitute [your-python-path] with your Python installation path.
120 Typically: C:\\Python27
119 Typically: C:\\Python38
121
120
122 Step 5 -- Kallithea folder structure
121 Step 5 -- Kallithea folder structure
123 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
122 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -12,7 +12,7 b' Python environment'
12 ------------------
12 ------------------
13
13
14 **Kallithea** is written entirely in Python_ and requires Python version
14 **Kallithea** is written entirely in Python_ and requires Python version
15 2.7 or higher. Python 3.x is currently not supported.
15 3.6 or higher.
16
16
17 Given a Python installation, there are different ways of providing the
17 Given a Python installation, there are different ways of providing the
18 environment for running Python applications. Each of them pretty much
18 environment for running Python applications. Each of them pretty much
@@ -98,7 +98,7 b' installed.'
98 installed with all dependencies using ``pip install kallithea``.
98 installed with all dependencies using ``pip install kallithea``.
99
99
100 With this method, Kallithea is installed in the Python environment as any
100 With this method, Kallithea is installed in the Python environment as any
101 other package, usually as a ``.../site-packages/Kallithea-X-py2.7.egg/``
101 other package, usually as a ``.../site-packages/Kallithea-X-py3.8.egg/``
102 directory with Python files and everything else that is needed.
102 directory with Python files and everything else that is needed.
103
103
104 (``pip install kallithea`` from a source tree will do pretty much the same
104 (``pip install kallithea`` from a source tree will do pretty much the same
@@ -557,7 +557,7 b" that, you'll need to:"
557 os.chdir('/srv/kallithea/')
557 os.chdir('/srv/kallithea/')
558
558
559 import site
559 import site
560 site.addsitedir("/srv/kallithea/venv/lib/python2.7/site-packages")
560 site.addsitedir("/srv/kallithea/venv/lib/python3.7/site-packages")
561
561
562 ini = '/srv/kallithea/my.ini'
562 ini = '/srv/kallithea/my.ini'
563 from logging.config import fileConfig
563 from logging.config import fileConfig
@@ -8,7 +8,7 b' Troubleshooting'
8 :A: Make sure either to set the ``static_files = true`` in the .ini file or
8 :A: Make sure either to set the ``static_files = true`` in the .ini file or
9 double check the root path for your http setup. It should point to
9 double check the root path for your http setup. It should point to
10 for example:
10 for example:
11 ``/home/my-virtual-python/lib/python2.7/site-packages/kallithea/public``
11 ``/home/my-virtual-python/lib/python3.7/site-packages/kallithea/public``
12
12
13 |
13 |
14
14
@@ -55,9 +55,9 b' the translation files (`*.po`).'
55
55
56 First update the translation strings::
56 First update the translation strings::
57
57
58 python2 setup.py extract_messages
58 python3 setup.py extract_messages
59
59
60 Then regenerate the translation files. This could either be done with `python2
60 Then regenerate the translation files. This could either be done with `python3
61 setup.py update_catalog` or with `msgmerge` from the `gettext` package. As
61 setup.py update_catalog` or with `msgmerge` from the `gettext` package. As
62 Weblate is also touching these translation files, it is preferred to use the
62 Weblate is also touching these translation files, it is preferred to use the
63 same tools (`msgmerge`) and settings as Weblate to minimize the diff::
63 same tools (`msgmerge`) and settings as Weblate to minimize the diff::
@@ -73,11 +73,11 b' Manual creation of a new language transl'
73 In the prepared development environment, run the following to ensure
73 In the prepared development environment, run the following to ensure
74 all translation strings are extracted and up-to-date::
74 all translation strings are extracted and up-to-date::
75
75
76 python2 setup.py extract_messages
76 python3 setup.py extract_messages
77
77
78 Create new language by executing following command::
78 Create new language by executing following command::
79
79
80 python2 setup.py init_catalog -l <new_language_code>
80 python3 setup.py init_catalog -l <new_language_code>
81
81
82 This creates a new translation under directory `kallithea/i18n/<new_language_code>`
82 This creates a new translation under directory `kallithea/i18n/<new_language_code>`
83 based on the translation template file, `kallithea/i18n/kallithea.pot`.
83 based on the translation template file, `kallithea/i18n/kallithea.pot`.
@@ -90,7 +90,7 b' translation file for errors by executing'
90
90
91 Finally, compile the translations::
91 Finally, compile the translations::
92
92
93 python2 setup.py compile_catalog -l <new_language_code>
93 python3 setup.py compile_catalog -l <new_language_code>
94
94
95
95
96 Manually updating translations
96 Manually updating translations
@@ -98,11 +98,11 b' Manually updating translations'
98
98
99 Extract the latest versions of strings for translation by running::
99 Extract the latest versions of strings for translation by running::
100
100
101 python2 setup.py extract_messages
101 python3 setup.py extract_messages
102
102
103 Update the PO file by doing::
103 Update the PO file by doing::
104
104
105 python2 setup.py update_catalog -l <new_language_code>
105 python3 setup.py update_catalog -l <new_language_code>
106
106
107 Edit the newly updated translation file. Repeat all steps after the
107 Edit the newly updated translation file. Repeat all steps after the
108 `init_catalog` step from the 'new translation' instructions above.
108 `init_catalog` step from the 'new translation' instructions above.
@@ -125,11 +125,7 b' class InputStreamChunker(threading.Threa'
125 if len(t) > ccm:
125 if len(t) > ccm:
126 kr.clear()
126 kr.clear()
127 kr.wait(2)
127 kr.wait(2)
128 # # this only works on 2.7.x and up
128 if not kr.wait(10):
129 # if not kr.wait(10):
130 # raise Exception("Timed out while waiting for input to be read.")
131 # instead we'll use this
132 if len(t) > ccm + 3:
133 raise IOError(
129 raise IOError(
134 "Timed out while waiting for input from subprocess.")
130 "Timed out while waiting for input from subprocess.")
135 t.append(b)
131 t.append(b)
@@ -35,6 +35,7 b" headermatch = re.compile(r'''\\n*(.+)\\n(["
35 def main():
35 def main():
36 filenames = subprocess.check_output(['hg', 'loc', 'set:**.rst+kallithea/i18n/how_to']).splitlines()
36 filenames = subprocess.check_output(['hg', 'loc', 'set:**.rst+kallithea/i18n/how_to']).splitlines()
37 for fn in filenames:
37 for fn in filenames:
38 fn = fn.decode()
38 print('processing %s' % fn)
39 print('processing %s' % fn)
39 s = open(fn).read()
40 s = open(fn).read()
40
41
@@ -33,9 +33,6 b' source "$venv/bin/activate"'
33 pip install --upgrade pip setuptools
33 pip install --upgrade pip setuptools
34 pip install -e . -r "$min_requirements" python-ldap python-pam 2> >(tee "$log" >&2)
34 pip install -e . -r "$min_requirements" python-ldap python-pam 2> >(tee "$log" >&2)
35
35
36 # Strip out the known Python 2.7 deprecation message.
37 sed -i '/DEPRECATION: Python 2\.7 /d' "$log"
38
39 # Treat any message on stderr as a problem, for the caller to interpret.
36 # Treat any message on stderr as a problem, for the caller to interpret.
40 if [ -s "$log" ]; then
37 if [ -s "$log" ]; then
41 echo
38 echo
@@ -9,9 +9,6 b' import setuptools'
9 from setuptools.command import sdist
9 from setuptools.command import sdist
10
10
11
11
12 if sys.version_info < (2, 6) or sys.version_info >= (3,):
13 raise Exception('Kallithea requires python 2.7')
14 # But temporarily, at the same time:
15 if sys.version_info < (3, 6):
12 if sys.version_info < (3, 6):
16 raise Exception('Kallithea requires Python 3.6 or later')
13 raise Exception('Kallithea requires Python 3.6 or later')
17
14
@@ -88,8 +85,9 b' classifiers = ['
88 'Intended Audience :: Developers',
85 'Intended Audience :: Developers',
89 'License :: OSI Approved :: GNU General Public License (GPL)',
86 'License :: OSI Approved :: GNU General Public License (GPL)',
90 'Operating System :: OS Independent',
87 'Operating System :: OS Independent',
91 'Programming Language :: Python',
88 'Programming Language :: Python :: 3.6',
92 'Programming Language :: Python :: 2.7',
89 'Programming Language :: Python :: 3.7',
90 'Programming Language :: Python :: 3.8',
93 'Topic :: Software Development :: Version Control',
91 'Topic :: Software Development :: Version Control',
94 ]
92 ]
95
93
General Comments 0
You need to be logged in to leave comments. Login now