From 80330aca6ba357f3031dd69294cb37b8a895aebc6114080641b3d63ad6a5e59b Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Mon, 30 Sep 2024 06:33:22 +0000 Subject: [PATCH] - Add patch fix-mock-assertion.patch: * Correct mock has_calls call. - Skip recalcitrant test. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-for-android?expand=0&rev=18 --- .gitattributes | 23 ++++ .gitignore | 1 + fix-mock-assertion.patch | 35 ++++++ no-isolation-for-metadata-build.patch | 13 ++ python-for-android-2024.1.21.tar.gz | 3 + python-python-for-android-rpmlintrc | 4 + python-python-for-android.changes | 174 ++++++++++++++++++++++++++ python-python-for-android.spec | 134 ++++++++++++++++++++ 8 files changed, 387 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 fix-mock-assertion.patch create mode 100644 no-isolation-for-metadata-build.patch create mode 100644 python-for-android-2024.1.21.tar.gz create mode 100644 python-python-for-android-rpmlintrc create mode 100644 python-python-for-android.changes create mode 100644 python-python-for-android.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/fix-mock-assertion.patch b/fix-mock-assertion.patch new file mode 100644 index 0000000..7e749b6 --- /dev/null +++ b/fix-mock-assertion.patch @@ -0,0 +1,35 @@ +From 5d5ca2b57aa49c508950c927eb42d2ffe14c3cf6 Mon Sep 17 00:00:00 2001 +From: Steve Kowalik +Date: Tue, 9 Apr 2024 15:36:24 +1000 +Subject: [PATCH] Fix mock assertion in ICU recipe + +Python 3.12 now does not blindly any methods on mocked objects, which +masks issues. Correct the assertion of has_calls to assert_has_calls in +the ICU recipe. + +Fixes #3002 +--- + tests/recipes/test_icu.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/tests/recipes/test_icu.py b/tests/recipes/test_icu.py +index 239b99e4c1..dacf65a0b4 100644 +--- a/tests/recipes/test_icu.py ++++ b/tests/recipes/test_icu.py +@@ -52,13 +52,14 @@ def test_build_arch( + + # We expect some calls to `sh.Command` + build_root = self.recipe.get_build_dir(self.arch.arch) +- mock_sh_command.has_calls( ++ mock_sh_command.assert_has_calls( + [ + mock.call( + os.path.join(build_root, "source", "runConfigureICU") + ), + mock.call(os.path.join(build_root, "source", "configure")), +- ] ++ ], ++ any_order=True + ) + mock_ensure_dir.assert_called() + mock_chdir.assert_called() diff --git a/no-isolation-for-metadata-build.patch b/no-isolation-for-metadata-build.patch new file mode 100644 index 0000000..a7e47bb --- /dev/null +++ b/no-isolation-for-metadata-build.patch @@ -0,0 +1,13 @@ +Index: python-for-android-2024.01.21/pythonforandroid/pythonpackage.py +=================================================================== +--- python-for-android-2024.01.21.orig/pythonforandroid/pythonpackage.py ++++ python-for-android-2024.01.21/pythonforandroid/pythonpackage.py +@@ -432,7 +432,7 @@ def _extract_metainfo_files_from_package + + if path_type != "wheel": + # Use a build helper function to fetch the metadata directly +- metadata = build.util.project_wheel_metadata(path) ++ metadata = build.util.project_wheel_metadata(path, isolated=False) + # And write it to a file + metadata_path = os.path.join(output_path, "built_metadata") + with open(metadata_path, 'w') as f: diff --git a/python-for-android-2024.1.21.tar.gz b/python-for-android-2024.1.21.tar.gz new file mode 100644 index 0000000..8e919e0 --- /dev/null +++ b/python-for-android-2024.1.21.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c512c36ea3e49c2383248904a5a144fb379ea590acbb0930b62d13664fa67892 +size 1299943 diff --git a/python-python-for-android-rpmlintrc b/python-python-for-android-rpmlintrc new file mode 100644 index 0000000..b52bbe8 --- /dev/null +++ b/python-python-for-android-rpmlintrc @@ -0,0 +1,4 @@ +addFilter("devel-file-in-non-devel-package") +addFilter("zero-length") +addFilter("hidden-file-or-dir") +addFilter("script-without-shebang .*/site-packages/pythonforandroid/recipes/android/src/setup.py") \ No newline at end of file diff --git a/python-python-for-android.changes b/python-python-for-android.changes new file mode 100644 index 0000000..38ccc08 --- /dev/null +++ b/python-python-for-android.changes @@ -0,0 +1,174 @@ +------------------------------------------------------------------- +Mon Sep 30 06:32:03 UTC 2024 - Steve Kowalik + +- Add patch fix-mock-assertion.patch: + * Correct mock has_calls call. +- Skip recalcitrant test. + +------------------------------------------------------------------- +Mon Apr 8 05:32:06 UTC 2024 - Steve Kowalik + +- Update to 2024.01.21: + * Update Lottie player version + * Remove distutils usage, as is not available anymore on Python 3.12 + * enable json1 extenstion in sqlite3 + * Bump pyjnius version to 1.6.1 + * Add (now mandatory) .readthedocs.yaml file, add docs requirements.txt + and update sphinx conf + * Update Android gradle plugin to 8.1.1 and gradle to 8.0.2 + * Add support for Python 3.11 and make it the default while building + hostpython3 and python3 + * Remove redundant append into WHITELIST_PATTERNS + * sourceCompatibility 1.7 and targetCompatibility 1.7 are obsolete, use 1.8 + * Update sdl2 deps to reflect the same targeted in kivy/kivy + * Initial support for PySide6 and Qt + * Bump Kivy version to 2.3.0 + * Update OpenSSL version to 1.1.1w +- Stop replacing pep517 in files, we have moved off of it +- Remove patch switch-to-build-from-pep517.patch: + * Now included. +- Add patch no-isolation-for-metadata-build.patch: + * However, we still don't need isolated builds. +- Switch to pyproject macros. +- Skip a test that breaks with Python 3.12. + +------------------------------------------------------------------- +Tue Jan 9 22:09:21 UTC 2024 - Dirk Müller + +- update to 2023.09.16: + * Cffi update + * Use build rather than pep517 for building + * Removes `mysqldb` recipe as does not support Python 3 + * Removes `Babel` recipe as it's not needed anymore. + * Remove `dateutil` recipe, as it's not needed anymore + * Optimize CI runs, by avoiding unnecessary rebuilds + * Remove `pytz` recipe, as it's not needed anymore + * Changed the url to use https as http fails + * vlc: fix build + * Correct sys_platform + * Docs: Fix code string - quickstart.rst + * Bump `kivy` version to `2.2.1` + * Use a pinned version of `Cython` for now, as most of the + recipes are incompatible with `Cython==3.x.x` + * Automatically generate required pre-requisites + * Use platform.uname instead of os.uname + * Fix simple typos in comments + * `build_platform` should be all-lowercase + * Docs: Fix typos and updated command to build apk - README + * Patching cleanup + * Python versions: Update documentation & CI testing + * Correct check for --sdk option + * Factor out dependency checking. Use modern version handling + * :rotating_light: linter fixes + * Remove deprecated FlatDir in Gradle template + * Standardise ensure_dir and rmdir + * Standardise on move + * Use Python's touch() rather than shelling out. +- update to 2023.05.21: + * Add support for Python 3.10 and make it the default while + building hostpython3 and python3 + * Add PyAV recipe + * Add debug loggings for identifying a matching dist + * Home app functionality + * Use io.IOBase for LogFile + * android_api to integer + * fix #2768 smallIconName null can t be compared to String + * fix tools/liblink: syntax error + * Update `pyjnius` version to `1.5.0` + * Update Kivy recipe for 2.2.0 + +------------------------------------------------------------------- +Tue May 16 12:08:13 UTC 2023 - Steve Kowalik + +- Update to v2023.02.10: + * pydantic recipe has been updated. + * scypt recipe has been updated. + * --orientation option controls the allowed orientations (portrait, + landscape, portrait-reverse, landscape-reverse). + * --manifest-orientation option has been added to keep the + android:screenOrientation personalisation functionality. + * If --manifest-orientation is not set, and only (one of multiple) + --orientation options are passed, the value for + android:screenOrientationis guessed and synthesized from the + --orientation option. + * Introduced support for permission properties (maxSdkVersion and + usesPermissionFlags) + * Minimal and recommended Android NDK version is now 25b + * MIN_TARGET_API has been updated to 30 and RECOMMENDED_TARGET_API in + order to comply with Google Play Store requirements. + * android.activity now offers Application.ActivityLifecycleCallbacks helpers. + * secp256k1 Update "--host=" #2714 (RobertFlatt) + * recipe.download_file: implement shallow git cloning #2682 (SomberNight) + * Resize webview when keyboard is shown #2674 (dbnicholson) + * Fixes libvpx build #2672 (misl6) + * toml may not be available on systemwide python #2670 (misl6) + * android/activity: Add Application.ActivityLifecycleCallbacks + helpers #2669 (dbnicholson) + * Bump minimal and recommended Android NDK version to 25b #2668 (misl6) + * Include HOME in build environment #2582 (dbnicholson) +- Add patch switch-to-build-from-pep517.patch: + * Do not use pep517 methods, switch to build. + +------------------------------------------------------------------- +Wed Dec 14 22:37:51 UTC 2022 - John Vandenberg + +- Remove arch-tests.patch that was removed from spec in previous change + +------------------------------------------------------------------- +Mon Dec 12 17:33:31 UTC 2022 - pgajdos@suse.com + +- really use 2022.09.04 tarball +- six is not required + +------------------------------------------------------------------- +Thu Oct 6 22:26:44 UTC 2022 - Yogalakshmi Arunachalam + +- Update to version v2022.09.04 + Fixed bugs: + Matplotlib failed to import properly on an APK from Buildozer and Kivy #2643 + Closed issues: + KeyError: Matplotlib with kivy android #2658 + KeyError: Matplotlib #2659 + Upgrade from NDK 19b to 23b causes problems with Pandas library #2654 + Update Dockerfile for ARM #2653 + Apple M2 chip doesn't generate apk: compiling error on liblzma #2652 + aiohttp/_http_parser.pyx:46:0: '_headers.pxi' not found #2651 + [Question] Pip SSL ? #2649 + Colab gives me as error "No module named 'typing_extensions' ", even if before with the same compilation it worked #2648 + [Question] Java Files #2646 + Using foreground services will cause wired behaviour on Android 8 #2641 + Can't apply patches with relative paths for local recipe #2623 + Compile for x86 on MacOS #2215 + splash always loading #1907 + python-for-android.readthedocs.io has problems updating, apparently #1709 + Webview apps not working on Android #1644 + Merged pull requests: + liblzma: Use p4a_install instead of install, as a file named INSTALL is already present. #2663 (misl6) + Force --platform=linux/amd64 in Dockerfile #2660 (misl6) + Remove six and enum34 dependency #2657 (misl6) + Update supported Python versions #2656 (misl6) + Fixes some E275 - assert is a keyword. #2647 (misl6) + Updates matplotlib, fixes an issue related to shared libc++ #2645 (misl6) + RTSP support for ffmpeg #2644 (alicakici1234) + Fixes TypeError: str.join() takes exactly one argument (2 given) in hostpython3/__init__.py", line 69 #2642 (Furtif) + Resolve absolute path to local recipes #2640 (dbnicholson) + Merges master into develop after release 2022.07.20 #2639 (misl6) + Fix webview Back button behaviour #2636 (interlark) + Add icon-bg and icon-fg to fix_args #2633 (danigm) + Remove stray - in output file name #2581 (dbnicholson) + Add option for adding files to res/xml without touching manifest #2330 (rambo) + +------------------------------------------------------------------- +Tue Aug 9 00:15:47 UTC 2022 - John Vandenberg + +- Add test dependencies and mark one test skipped + +------------------------------------------------------------------- +Fri Jun 17 13:29:45 UTC 2022 - Dominique Leuenberger + +- Properly fix shebangs to inject path to python interpreter. + +------------------------------------------------------------------- +Sun Nov 15 01:29:33 AM UTC 2020 - John Vandenberg + +- Initial spec for v2020.6.2 diff --git a/python-python-for-android.spec b/python-python-for-android.spec new file mode 100644 index 0000000..2e5dea4 --- /dev/null +++ b/python-python-for-android.spec @@ -0,0 +1,134 @@ +# +# spec file for package python-python-for-android +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define version_with_zeros 2024.01.21 +Name: python-python-for-android +Version: 2024.1.21 +Release: 0 +Summary: Android APK packager for Python scripts and apps +License: MIT +URL: https://github.com/kivy/python-for-android +Source: https://github.com/kivy/python-for-android/archive/refs/tags/v%{version_with_zeros}.tar.gz#/python-for-android-%{version}.tar.gz +Source1: python-python-for-android-rpmlintrc +# PATCH-FIX-OPENSUSE We don't need or want isolation when determining metadata +Patch0: no-isolation-for-metadata-build.patch +# PATCH-FIX-UPSTREAM gh#kivy/python-for-android#3003 +Patch1: fix-mock-assertion.patch +BuildRequires: %{python_module setuptools} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-Jinja2 +Requires: python-appdirs +Requires: python-build +Requires: python-colorama >= 0.3.3 +Requires: python-packaging +Requires: python-setuptools +Requires: python-sh >= 2 +Requires: python-toml +Requires(post): update-alternatives +Requires(postun): update-alternatives +Recommends: cmake +Recommends: python-pip +Recommends: python-wheel +BuildArch: noarch +# SECTION test requirements +BuildRequires: %{python_module Jinja2} +BuildRequires: %{python_module Cython} +BuildRequires: %{python_module appdirs} +BuildRequires: %{python_module build} +BuildRequires: %{python_module colorama >= 0.3.3} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module sh >= 1.10} +BuildRequires: %{python_module toml} +BuildRequires: %{python_module wheel} +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: ccache +BuildRequires: clang +BuildRequires: cmake +BuildRequires: dos2unix +BuildRequires: gcc-c++ +BuildRequires: libtool +BuildRequires: lld +BuildRequires: unzip +# /SECTION +%python_subpackages + +%description +Android APK packager for Python scripts and apps + +%prep +%autosetup -p1 -n python-for-android-%{version_with_zeros} + +sed -i "1{s:#!.*$:#!%{_bindir}/bash:}" pythonforandroid/bootstraps/common/build/gradlew + +find pythonforandroid/bootstraps/common/build/src/ -type f | xargs dos2unix +find pythonforandroid/bootstraps/common/build/src/ -type f | xargs chmod a-x + +chmod a+x pythonforandroid/bootstraps/common/build/build.py + +touch tests/__init__.py tests/recipes/__init__.py + +sed -i 's/from backports import tempfile/import tempfile/' tests/test_recipe.py + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_clone -a %{buildroot}%{_bindir}/python-for-android +%python_clone -a %{buildroot}%{_bindir}/p4a +%{python_expand rm -r %{buildroot}%{$python_sitelib}/ci/ %{buildroot}%{$python_sitelib}/tests/ + +sed -i "1{s:#!.*$:#!%{_bindir}/python%{$python_bin_suffix}:}" \ + %{buildroot}%{$python_sitelib}/pythonforandroid/tools/*link \ + %{buildroot}%{$python_sitelib}/pythonforandroid/bootstraps/common/build/build.py \ + %{buildroot}%{$python_sitelib}/pythonforandroid/toolchain.py + +chmod a+x %{buildroot}%{$python_sitelib}/pythonforandroid/toolchain.py + +%fdupes %{buildroot}%{$python_sitelib} +} + +%check +export PYTHONPATH=${PWD}:${PWD}/tests/ +# Five failures due to venv attempting download of pip, wheel, setuptools +skip_tests="test_get_dep_names_of_package or test_get_package_dependencies or test_venv or test_get_package_as_folder or test_extract_metainfo_files_from_package" +# Unable to download NDK +skip_tests="$skip_tests or (TestToolchainCL and test_create) or test_create_python_bundle" +# build_dir is somehow None +skip_tests="$skip_tests or (TestSDL2MixerRecipe and test_get_include_dirs)" + +%pytest -rs tests -k "not ($skip_tests)" + +%post +%python_install_alternative python-for-android p4a + +%postun +%python_uninstall_alternative python-for-android + +%files %{python_files} +%doc README.md +%license LICENSE +%python_alternative %{_bindir}/python-for-android +%python_alternative %{_bindir}/p4a +%{python_sitelib}/pythonforandroid +%{python_sitelib}/python_for_android-%{version}.dist-info + +%changelog