remove explicit python3.9 reference due to pylint

3.8 will be used if available
This commit is contained in:
Damien Elmes 2020-12-02 11:23:01 +10:00
parent 339a353f3d
commit 1566a9be98
5 changed files with 26 additions and 12 deletions

View file

@ -26,11 +26,9 @@ $ pyenv/bin/python -c 'import aqt; aqt.run()'
From Anki 2.1.36 onwards:
- Make sure your pip version is 20 or later (pip install --upgrade pip).
- Then:
```
$ python -m venv pyenv
$ pyenv/bin/pip install --upgrade pip
$ pyenv/bin/pip install aqt
$ pyenv/bin/python -c 'import aqt; aqt.run()'
```
@ -58,6 +56,8 @@ From inside the source folder:
bazel test //...
```
Pylint will currently fail if you're using Python 3.9.
## Fixing formatting
If the format tests fail, most can be fixed by running `format`
@ -84,8 +84,8 @@ bazel build -c opt //pylib/anki:wheel
bazel build -c opt //qt/aqt:wheel
```
The generated wheel paths will be printed as the build completes. To install
them, see earlier in this document.
The generated wheel paths will be printed as the build completes. You can install
them with pip.
## Audio

View file

@ -20,13 +20,14 @@ If you're on a modern distribution, you may be able to install Python from the r
$ sudo apt install python3.8
```
If python3.8 is not available in your distro, you can download it from python.org.
If Python 3.8 is not available in your distro, you can download it from python.org,
compile it, and install in in /usr/local.
Notes:
If your system only has Python 3.9, you should be able to build Anki with it,
but the pylint tests will currently fail, as pylint does not yet support Python 3.9.
- The build scripts expect to find 'python3.8' on your path, so Python 3.7 or 3.9 will
not work.
- An active Python venv is not required, and may cause problems.
Anki's build system will not place packages in system locations, so you do not
need to build with an active Python virtual environmental.
**Install Bazelisk**:

View file

@ -22,6 +22,8 @@ $ brew install rsync bazelisk
Install Python 3.8 from <https://python.org>. You may be able to use
the Homebrew version instead, but this is untested.
Python 3.9 is not currently recommended, as pylint does not support it yet.
You do not need to set up a Python venv prior to building Anki.
When you run "python" in a shell, if it shows Python 2.x, you may get a
@ -32,6 +34,9 @@ pointing python to python3.8:
$ ln -sf /usr/local/bin/{python3.8,python}
```
This linking will not work if you're using the system Python from Big Sur,
which is one of the reasons why we recommend using Python from python.org.
## Running Anki during development
From the top level of Anki's source folder:
@ -42,7 +47,7 @@ From the top level of Anki's source folder:
This will build Anki and run it in place.
The first build will take while, as it downloads and builds a bunch of
The first build will take a while, as it downloads and builds a bunch of
dependencies. When the build is complete, Anki will automatically start.
To play audio, use Homebrew to install mpv. At the time of writing, recording is

View file

@ -24,6 +24,8 @@ Python to be installed in that location.
When the install is done, click on the "remove the path limit" button.
Python 3.9 is not currently recommended, as pylint does not support it yet.
**MSYS**:
Install [msys2](https://www.msys2.org/) into the default folder location.

View file

@ -1,6 +1,12 @@
def _impl(rctx):
# locate python on path, and export it
names = ["python3.9", "python3.8", "python3", "python.exe"]
names = [
# prefer 3.8 over 3.9, as pylint currently fails on 3.9
# (due to issues like https://github.com/PyCQA/pylint/pull/3890)
"python3.8",
"python3",
"python.exe",
]
path = None
for name in names:
path = rctx.which(name)