|
1 | 1 | :orphan:
|
2 | 2 |
|
3 |
| -======================================= |
4 |
| - How to update to a new Python version |
5 |
| -======================================= |
| 3 | +How to update to a new Python version |
| 4 | +===================================== |
6 | 5 |
|
7 |
| -We are currently in branch 3.7, and we want to update the strings from 3.8. |
| 6 | +We are currently in branch 3.10, and we want to update the strings from 3.11. |
8 | 7 |
|
9 | 8 |
|
10 |
| -#. Fetch the `lastet commit of 3.8 branch <https://github.com/python/cpython/commit/70fe95cdc9ac1b00d4f86b7525dca80caf7003e1>`_:: |
| 9 | +#. Make sure you are in a clean state of the branch 3.10 |
| 10 | + |
| 11 | +#. Create a new branch |
| 12 | + |
| 13 | +#. Fetch the `latest commit of 3.10 branch <https://github.com/python/cpython/commit/69b6b56d857440183e227ca0b10c84bca4239985>`_:: |
11 | 14 |
|
12 | 15 | cd cpython/
|
13 |
| - git fetch --depth 1 origin 70fe95cdc9ac1b00d4f86b7525dca80caf7003e1 |
| 16 | + git fetch --depth 1 origin 69b6b56d857440183e227ca0b10c84bca4239985 |
| 17 | + |
| 18 | + .. note:: you could also base the hash on the 'git tag' from the desired |
| 19 | + version: `git checkout tags/v3.11.0 -b 3.11` considering that |
| 20 | + `3.11` doesn't exist locally. |
14 | 21 |
|
15 | 22 | #. Checkout that commit locally::
|
16 | 23 |
|
17 |
| - git checkout 70fe95cdc9ac1b00d4f86b7525dca80caf7003e1 |
| 24 | + git checkout 69b6b56d857440183e227ca0b10c84bca4239985 |
| 25 | + |
| 26 | +#. Update the branch on the `Makefile` and check the `requirements.txt` from |
| 27 | + the cpython repository, to see if upgrades on the modules like sphinx is |
| 28 | + needed. |
| 29 | + |
| 30 | +#. Verify that the docs build with the new versions you changed from |
| 31 | + `requirements.txt` mainly the sphinx version. |
| 32 | + |
| 33 | +#. Commit the update of the submodule change:: |
| 34 | + |
| 35 | + git add cpython |
| 36 | + git commit -m "Update the cpython submodule" |
| 37 | + |
| 38 | + .. note:: This is important, so the later `make build` step will not reset |
| 39 | + the cpython submodule to the previous hash on the old branch. |
18 | 40 |
|
19 | 41 | #. Clean possible garbage (form previous builds)::
|
20 | 42 |
|
21 | 43 | rm -rf _build ../python-docs-es-pot cpython/Doc/CONTRIBUTING.rst cpython/Doc/upgrade-python-version.rst
|
22 | 44 |
|
| 45 | + .. note: the 'python-docs-es-pot' is a temporary directory that is created |
| 46 | + in the next step. It's included here because it might be a leftover |
| 47 | + from previous attempts on your machine. |
| 48 | + |
| 49 | +#. Create a virtual environment and install the dependencies of the project:: |
| 50 | + |
| 51 | + python -m venv env |
| 52 | + source env/bin/activate # Windows: env\Scripts\activate.bat |
| 53 | + pip install -r requirements.txt |
| 54 | + |
| 55 | + |
23 | 56 | #. Create the .po files from the new source code. This will generate all the .po files for version 3.8::
|
24 | 57 |
|
25 | 58 | SPHINX_GETTEXT=True sphinx-build -j auto -b gettext -d _build/doctrees . ../python-docs-es-pot
|
26 | 59 |
|
27 | 60 | .. note::
|
28 | 61 |
|
29 |
| - In `../python-docs-es-pot` directory, we will have the new .pot files with new strings from 3.8 branch. |
30 |
| - All these strings will be *unstranslated* at this point. |
| 62 | + In `../python-docs-es-pot` directory, we will have the new .pot files with new strings from 3.11 branch. |
| 63 | + All these strings will be *untranslated* at this point. |
31 | 64 |
|
32 | 65 | #. Now, we update our translated files form the source language (English) with new strings::
|
33 | 66 |
|
34 | 67 | sphinx-intl update --language es --pot-dir ../python-docs-es-pot --locale-dir cpython/locales/
|
35 | 68 |
|
36 |
| -#. Remove `python-docs-cpython/` prefix added by `sphinx-build` to avoid clazy diffs:: |
| 69 | +#. At this point, all the `.po` files will have a different comment on each translation phrase, |
| 70 | + for example:: |
| 71 | + |
| 72 | + -#: ../Doc/whatsnew/3.9.rst:3 |
| 73 | + +#: ../python-docs-es/cpython/Doc/whatsnew/3.9.rst:3 |
| 74 | + |
| 75 | + As you can see, it added the path of the local repository, but you can |
| 76 | + remove it from it with this regular expression:: |
37 | 77 |
|
38 | 78 | sed -i **/*.po -e "s|python-docs-es/cpython/||g"
|
39 | 79 |
|
| 80 | + ..note:: if you have your local repository cloned with a different name, |
| 81 | + please make sure to adapt the expression. |
| 82 | + |
40 | 83 | #. Pass `powrap` to make the column widths consistent::
|
41 | 84 |
|
42 | 85 | powrap --modified
|
| 86 | + |
| 87 | +#. Prepare for fireworks! Now it's time for an initial build:: |
| 88 | + |
| 89 | + make build |
| 90 | + |
| 91 | + you will find many warnings that needs to be fixed before the push |
| 92 | + of the new branch is done. So prepare a cup of any hot beverage |
| 93 | + and fix them. |
0 commit comments