From 1789778673ddf31650ba36f9fbce25731ec1d0e5 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Fri, 14 Oct 2022 14:28:11 +0000 Subject: [PATCH] android build: p4a to build pyqt5 using "hostpython" instead of sys py The current system python in the docker baseimage is py3.9, while the targetpython and hostpython built by p4a are py3.8, and this was causing linker issues in the pyqt5 build. It is also cleaner IMHO to have p4a handle what is needed for a recipe instead of assuming it is available in the system. (and I think this is how other existing recipes work) fixes https://github.com/spesmilo/electrum/issues/8016 --- contrib/android/Dockerfile | 5 +++-- contrib/android/p4a_recipes/packaging/__init__.py | 13 +++++++++++++ contrib/android/p4a_recipes/pyparsing/__init__.py | 13 +++++++++++++ contrib/android/p4a_recipes/pyqt5/__init__.py | 2 +- .../android/p4a_recipes/pyqt_builder/__init__.py | 13 +++++++++++++ contrib/android/p4a_recipes/sip/__init__.py | 13 +++++++++++++ contrib/android/p4a_recipes/toml/__init__.py | 13 +++++++++++++ .../requirements-build-android.txt | 9 --------- contrib/requirements/requirements-build-android.txt | 2 +- 9 files changed, 70 insertions(+), 13 deletions(-) create mode 100644 contrib/android/p4a_recipes/packaging/__init__.py create mode 100644 contrib/android/p4a_recipes/pyparsing/__init__.py create mode 100644 contrib/android/p4a_recipes/pyqt_builder/__init__.py create mode 100644 contrib/android/p4a_recipes/sip/__init__.py create mode 100644 contrib/android/p4a_recipes/toml/__init__.py diff --git a/contrib/android/Dockerfile b/contrib/android/Dockerfile index 247a8775b..d485441b0 100644 --- a/contrib/android/Dockerfile +++ b/contrib/android/Dockerfile @@ -176,10 +176,11 @@ RUN cd /opt \ && git remote add sombernight https://github.com/SomberNight/python-for-android \ && git remote add accumulator https://github.com/accumulator/python-for-android \ && git fetch --all \ - # commit: from branch sombernight/qt5-wip - && git checkout "c6e39ae1fb4eb8d547eb70b26b89beda7e6ff4b6^{commit}" \ + # commit: from branch sombernight/electrum_20210421d + && git checkout "4535a333f9928e894caedefc4f746f9c6a0dc50f^{commit}" \ && python3 -m pip install --no-build-isolation --no-dependencies --user -e . # build env vars ENV USE_SDK_WRAPPER=1 ENV GRADLE_OPTS="-Xmx1536M -Dorg.gradle.jvmargs='-Xmx1536M'" +#ENV P4A_FULL_DEBUG=1 diff --git a/contrib/android/p4a_recipes/packaging/__init__.py b/contrib/android/p4a_recipes/packaging/__init__.py new file mode 100644 index 000000000..04905cbcd --- /dev/null +++ b/contrib/android/p4a_recipes/packaging/__init__.py @@ -0,0 +1,13 @@ +from pythonforandroid.recipes.packaging import PackagingRecipe + + +assert PackagingRecipe._version == "21.3" +assert PackagingRecipe.depends == ["setuptools", "pyparsing", "python3"] +assert PackagingRecipe.python_depends == [] + + +class PackagingRecipePinned(PackagingRecipe): + sha512sum = "2e3aa276a4229ac7dc0654d586799473ced9761a83aa4159660d37ae1a2a8f30e987248dd0e260e2834106b589f259a57ce9936eef0dcc3c430a99ac6b663e05" + + +recipe = PackagingRecipePinned() diff --git a/contrib/android/p4a_recipes/pyparsing/__init__.py b/contrib/android/p4a_recipes/pyparsing/__init__.py new file mode 100644 index 000000000..102dc1520 --- /dev/null +++ b/contrib/android/p4a_recipes/pyparsing/__init__.py @@ -0,0 +1,13 @@ +from pythonforandroid.recipes.pyparsing import PyparsingRecipe + + +assert PyparsingRecipe._version == "3.0.7" +assert PyparsingRecipe.depends == ["setuptools", "python3"] +assert PyparsingRecipe.python_depends == [] + + +class PyparsingRecipePinned(PyparsingRecipe): + sha512sum = "1e692f4cdaa6b6e8ca2729d0a3e2ba16d978f1957c538b6de3a4220ec7d996bdbe87c41c43abab851fffa3b0498a05841373e435602917b8c095042e273badb5" + + +recipe = PyparsingRecipePinned() diff --git a/contrib/android/p4a_recipes/pyqt5/__init__.py b/contrib/android/p4a_recipes/pyqt5/__init__.py index 16e74e5d8..a3e16e5a3 100644 --- a/contrib/android/p4a_recipes/pyqt5/__init__.py +++ b/contrib/android/p4a_recipes/pyqt5/__init__.py @@ -7,7 +7,7 @@ util = load_source('util', os.path.join(os.path.dirname(os.path.dirname(__file__ assert PyQt5Recipe._version == "5.15.6" -assert PyQt5Recipe.depends == ['qt5', 'pyjnius', 'setuptools', 'pyqt5sip'] +assert PyQt5Recipe.depends == ['qt5', 'pyjnius', 'setuptools', 'pyqt5sip', 'hostpython3', 'pyqt_builder'] assert PyQt5Recipe.python_depends == [] diff --git a/contrib/android/p4a_recipes/pyqt_builder/__init__.py b/contrib/android/p4a_recipes/pyqt_builder/__init__.py new file mode 100644 index 000000000..d29acfa8d --- /dev/null +++ b/contrib/android/p4a_recipes/pyqt_builder/__init__.py @@ -0,0 +1,13 @@ +from pythonforandroid.recipes.pyqt_builder import PyQtBuilderRecipe + + +assert PyQtBuilderRecipe._version == "1.12.2" +assert PyQtBuilderRecipe.depends == ["sip", "packaging", "python3"] +assert PyQtBuilderRecipe.python_depends == [] + + +class PyQtBuilderRecipePinned(PyQtBuilderRecipe): + sha512sum = "022f2cd40c100543c4b442fc5b27bbf2ec853d94b531f8f6dc1d7f92b07bcc20e8f0a4eb64feb96d094ba0d5f01fddcc8aed23ddf67a61417e07983a73918230" + + +recipe = PyQtBuilderRecipePinned() diff --git a/contrib/android/p4a_recipes/sip/__init__.py b/contrib/android/p4a_recipes/sip/__init__.py new file mode 100644 index 000000000..9f2d16c0c --- /dev/null +++ b/contrib/android/p4a_recipes/sip/__init__.py @@ -0,0 +1,13 @@ +from pythonforandroid.recipes.sip import SipRecipe + + +assert SipRecipe._version == "6.5.1" +assert SipRecipe.depends == ["setuptools", "packaging", "toml", "python3"] +assert SipRecipe.python_depends == [] + + +class SipRecipePinned(SipRecipe): + sha512sum = "2d6f225e653873462d97dfdc85bd308a26b66996e1bb98e2c3aa60a3b260db745021f1d3182db8e943fd216ee27a2f65731b96d287e94f8f2e7972c5df971c69" + + +recipe = SipRecipePinned() diff --git a/contrib/android/p4a_recipes/toml/__init__.py b/contrib/android/p4a_recipes/toml/__init__.py new file mode 100644 index 000000000..21f903564 --- /dev/null +++ b/contrib/android/p4a_recipes/toml/__init__.py @@ -0,0 +1,13 @@ +from pythonforandroid.recipes.toml import TomlRecipe + + +assert TomlRecipe._version == "0.10.2" +assert TomlRecipe.depends == ["setuptools", "python3"] +assert TomlRecipe.python_depends == [] + + +class TomlRecipePinned(TomlRecipe): + sha512sum = "ede2c8fed610a3827dba828f6e7ab7a8dbd5745e8ef7c0cd955219afdc83b9caea714deee09e853627f05ad1c525dc60426a6e9e16f58758aa028cb4d3db4b39" + + +recipe = TomlRecipePinned() diff --git a/contrib/deterministic-build/requirements-build-android.txt b/contrib/deterministic-build/requirements-build-android.txt index 74be7a056..cbd188375 100644 --- a/contrib/deterministic-build/requirements-build-android.txt +++ b/contrib/deterministic-build/requirements-build-android.txt @@ -115,9 +115,6 @@ ptyprocess==0.7.0 \ pyparsing==3.0.7 \ --hash=sha256:18ee9022775d270c55187733956460083db60b37d0d0fb357445f3094eed3eea \ --hash=sha256:a6c06a88f252e6c322f65faf8f418b16213b51bdfaece0524c1c1bc30c63c484 -PyQt-builder==1.12.2 \ - --hash=sha256:48f754394d235307201ec2b5355934858741201af09433ff543ca40ae57b7865 \ - --hash=sha256:f62bb688d70e0afd88c413a8d994bda824e6cebd12b612902d1945c5a67edcd7 pytoml==0.1.21 \ --hash=sha256:57a21e6347049f73bfb62011ff34cd72774c031b9828cb628a752225136dfc33 \ --hash=sha256:8eecf7c8d0adcff3b375b09fe403407aa9b645c499e5ab8cac670ac4a35f61e7 @@ -127,12 +124,6 @@ setuptools==61.3.1 \ sh==1.14.2 \ --hash=sha256:4921ac9c1a77ec8084bdfaf152fe14138e2b3557cc740002c1a97076321fce8a \ --hash=sha256:9d7bd0334d494b2a4609fe521b2107438cdb21c0e469ffeeb191489883d6fe0d -sip==6.5.1 \ - --hash=sha256:01a637b44c5918505801c3d56e1e010b8e86a4edee71c0bd8541c54387b57ae2 \ - --hash=sha256:13b09357615c2d8bcb23bf21c1637941ac8ff5f28b346c1ccad7efafa57673e9 \ - --hash=sha256:204f0240db8999a749d638a987b351861843e69239b811ec3d1881412c3706a6 \ - --hash=sha256:57e5ac40744c0f10a6c53dd45d2ef2c90e52f34a0210d8309e6563a07f914d0d \ - --hash=sha256:de1cb4004d75a3a236f82a69cd7a3e51ff76b414df412fea22bf433b28876e3f six==1.16.0 \ --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 diff --git a/contrib/requirements/requirements-build-android.txt b/contrib/requirements/requirements-build-android.txt index a845fd510..07927a6ce 100644 --- a/contrib/requirements/requirements-build-android.txt +++ b/contrib/requirements/requirements-build-android.txt @@ -18,5 +18,5 @@ pep517<0.7.0 toml # needed for the Qt/QML Android GUI: -PyQt-builder +# TODO double-check this typing-extensions