From 6131daeabea77d22b32b5956c0e1b19cfa4f25a0 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 11 Apr 2023 10:44:54 +0800 Subject: [PATCH 1/4] Add note about linting docs on M1. --- docs/how-to/contribute-docs.rst | 38 +++++++++++++++++++++++++++++++++ tox.ini | 10 +++++++++ 2 files changed, 48 insertions(+) diff --git a/docs/how-to/contribute-docs.rst b/docs/how-to/contribute-docs.rst index 65b58a4c42..52ab405e81 100644 --- a/docs/how-to/contribute-docs.rst +++ b/docs/how-to/contribute-docs.rst @@ -34,6 +34,13 @@ You'll also need to install the Enchant spell checking library. (venv) $ brew install enchant + If you're on an M1 machine, you'll also need to manually set the location + of the Enchant library: + + .. code-block:: bash + + (venv) $ export PYENCHANT_LIBRARY_PATH=/opt/homebrew/lib/libenchant-2.2.dylib + .. group-tab:: Linux Enchant can be installed as a system package: @@ -123,6 +130,37 @@ If a valid spelling of a word is identified as misspelled, then add the word to the list in ``docs/spelling_wordlist``. This will add the word to the spellchecker's dictionary. +If you get an error related to SSL certificate verification:: + + Exception occurred: + File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1342, in do_handshake + self._sslobj.do_handshake() + ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007) + +The root certificate on your machine is out of date. You can correct this by +installing the Python package `certifi`, and using that package to provide your +SSL root certificate: + +.. tabs:: + + .. group-tab:: macOS + + .. code-block:: bash + + (venv) $ pip install certifi + (venv) $ export SSL_CERT_FILE=$(python -m certifi) + + .. group-tab:: Linux + + .. code-block:: bash + + (venv) $ pip install certifi + (venv) $ export SSL_CERT_FILE=$(python -m certifi) + + .. group-tab:: Windows + + ??? + Rebuilding all documentation ---------------------------- diff --git a/tox.ini b/tox.ini index 26d80f4c8a..268efcbc6c 100644 --- a/tox.ini +++ b/tox.ini @@ -56,6 +56,16 @@ skip_install = True change_dir = docs deps = ./core[docs] +passenv = + # On macOS M1, you need to manually set the location of the PyEnchant + # library: + # export PYENCHANT_LIBRARY_PATH/opt/homebrew/lib/libenchant-2.2.dylib + PYENCHANT_LIBRARY_PATH + # It is sometimes necessary to override the default certificate store + # so that PyPI can be contacted with XMLRPC: + # pip install certifi + # export SSL_CERT_FILE=$(python -m certifi) + SSL_CERT_FILE commands = !lint-!all : python -m sphinx {[docs]sphinx_args} -b html . {[docs]build_dir}/html lint : python -m sphinx {[docs]sphinx_args_extra} -b linkcheck . {[docs]build_dir}/links From f430115a14c27195afd1c2d51a2cc6078f6bfebc Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 11 Apr 2023 10:47:21 +0800 Subject: [PATCH 2/4] Add changenote. --- changes/1861.misc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/1861.misc.rst diff --git a/changes/1861.misc.rst b/changes/1861.misc.rst new file mode 100644 index 0000000000..849d90f17f --- /dev/null +++ b/changes/1861.misc.rst @@ -0,0 +1 @@ +A workaround for linting docs on M1 machines was documented. From 80557c8bf4d628db62c9917a760cb2abc48a1957 Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Tue, 11 Apr 2023 16:23:41 +0100 Subject: [PATCH 3/4] Fix end of line whitespace --- core/src/toga/style/applicator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/toga/style/applicator.py b/core/src/toga/style/applicator.py index 33e733c15b..4f9a7552db 100644 --- a/core/src/toga/style/applicator.py +++ b/core/src/toga/style/applicator.py @@ -31,10 +31,10 @@ def set_hidden(self, hidden): # grandchildren. # # parent hidden child hidden style child final hidden state - # ============= ================== ======================== + # ============= ================== ======================== # True True True # True False True - # False True True + # False True True # False False False child.applicator.set_hidden(hidden or child.style._hidden) From 135fccc6e1c8c80da1fa7b67c0eb575fbfd576c8 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Wed, 12 Apr 2023 07:11:25 +0800 Subject: [PATCH 4/4] Add windows instructions for setting root cert. --- docs/how-to/contribute-docs.rst | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/how-to/contribute-docs.rst b/docs/how-to/contribute-docs.rst index 52ab405e81..fba23132bb 100644 --- a/docs/how-to/contribute-docs.rst +++ b/docs/how-to/contribute-docs.rst @@ -89,7 +89,7 @@ Once your development environment is set up, run: .. code-block:: powershell - C:\...>tox -e docs + (venv) C:\...>tox -e docs The output of the file should be in the ``docs/_build/html`` folder. If there are any markup problems, they'll raise an error. @@ -118,7 +118,7 @@ documentation: .. code-block:: powershell - C:\...>tox -e docs-lint + (venv) C:\...>tox -e docs-lint This will validate the documentation does not contain: @@ -147,19 +147,22 @@ SSL root certificate: .. code-block:: bash - (venv) $ pip install certifi + (venv) $ python -m pip install certifi (venv) $ export SSL_CERT_FILE=$(python -m certifi) .. group-tab:: Linux .. code-block:: bash - (venv) $ pip install certifi + (venv) $ python -m pip install certifi (venv) $ export SSL_CERT_FILE=$(python -m certifi) .. group-tab:: Windows - ??? + .. code-block:: powershell + + (venv) C:\...>python -m pip install certifi + (venv) C:\...>FOR /f "delims=" %i IN ('python -m certifi') DO SET SSL_CERT_FILE=%i Rebuilding all documentation ---------------------------- @@ -184,7 +187,7 @@ To force a rebuild for all of the documentation: .. code-block:: powershell - C:\...>tox -e docs-all + (venv) C:\...>tox -e docs-all The documentation should be fully rebuilt in the ``docs/_build/html`` folder. If there are any markup problems, they'll raise an error.