forked from pool/python-python-for-android
		
	Accepting request 1087411 from devel:languages:python
- 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.
OBS-URL: https://build.opensuse.org/request/show/1087411
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-python-for-android?expand=0&rev=6
			
			
This commit is contained in:
		@@ -1,3 +0,0 @@
 | 
			
		||||
version https://git-lfs.github.com/spec/v1
 | 
			
		||||
oid sha256:8e837b2ac1b45af968704edfc609d45614b587ce0cdf25c9337a76d6025e5ab0
 | 
			
		||||
size 1672609
 | 
			
		||||
							
								
								
									
										3
									
								
								python-for-android-2023.2.10.tar.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								python-for-android-2023.2.10.tar.gz
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
version https://git-lfs.github.com/spec/v1
 | 
			
		||||
oid sha256:850db49912e54ea4b099ecc7907b49a3838f18ac343a99abe72d7efb43b060c0
 | 
			
		||||
size 1678497
 | 
			
		||||
@@ -1,3 +1,35 @@
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
Tue May 16 12:08:13 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
 | 
			
		||||
 | 
			
		||||
- 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 <jayvdb@gmail.com>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
#
 | 
			
		||||
# spec file for package python-python-for-android
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2022 SUSE LLC
 | 
			
		||||
# Copyright (c) 2023 SUSE LLC
 | 
			
		||||
#
 | 
			
		||||
# All modifications and additions to the file contributed by third parties
 | 
			
		||||
# remain the property of their copyright owners, unless otherwise agreed
 | 
			
		||||
@@ -16,22 +16,25 @@
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
%define version_with_zeros 2022.09.04
 | 
			
		||||
%define version_with_zeros 2023.02.10
 | 
			
		||||
Name:           python-python-for-android
 | 
			
		||||
Version:        2022.9.4
 | 
			
		||||
Version:        2023.2.10
 | 
			
		||||
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/v%{version_with_zeros}.tar.gz#/python-for-android-%{version}.tar.gz
 | 
			
		||||
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-UPSTREAM Switch to using build rather than pep517
 | 
			
		||||
# Based on gh#kivy/python-for-android#2784, we do not need or want isolation
 | 
			
		||||
Patch0:         switch-to-build-from-pep517.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-pep517
 | 
			
		||||
Requires:       python-toml
 | 
			
		||||
Requires(post): update-alternatives
 | 
			
		||||
Requires(postun):update-alternatives
 | 
			
		||||
@@ -44,8 +47,8 @@ BuildArch:      noarch
 | 
			
		||||
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 pep517}
 | 
			
		||||
BuildRequires:  %{python_module pip}
 | 
			
		||||
BuildRequires:  %{python_module pytest}
 | 
			
		||||
BuildRequires:  %{python_module sh >= 1.10}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										209
									
								
								switch-to-build-from-pep517.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										209
									
								
								switch-to-build-from-pep517.patch
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,209 @@
 | 
			
		||||
From d2c091cd2ac233cf9cb056bd696e8aa8b3b88ebc Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Steve Kowalik <steven@wedontsleep.org>
 | 
			
		||||
Date: Thu, 27 Apr 2023 14:41:03 +1000
 | 
			
		||||
Subject: [PATCH] Use build rather than pep517 for building
 | 
			
		||||
 | 
			
		||||
pep517 has been renamed to pyproject-hooks, and as a consequence all of
 | 
			
		||||
the deprecated functionality has been removed. build now provides the
 | 
			
		||||
functionality required, and since we are only interested in the
 | 
			
		||||
metadata, we can leverage a helper function for that. I've also removed
 | 
			
		||||
all of the subprocess machinery for calling the wrapping function, since
 | 
			
		||||
it appears to not be as noisy as pep517.
 | 
			
		||||
---
 | 
			
		||||
 pythonforandroid/pythonpackage.py | 89 ++++---------------------------
 | 
			
		||||
 setup.py                          |  4 +-
 | 
			
		||||
 tests/test_pythonpackage.py       |  2 +-
 | 
			
		||||
 tests/test_pythonpackage_basic.py | 13 ++---
 | 
			
		||||
 4 files changed, 18 insertions(+), 90 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/pythonforandroid/pythonpackage.py b/pythonforandroid/pythonpackage.py
 | 
			
		||||
index 3b03a513f5..1275ff8501 100644
 | 
			
		||||
--- a/pythonforandroid/pythonpackage.py
 | 
			
		||||
+++ b/pythonforandroid/pythonpackage.py
 | 
			
		||||
@@ -40,7 +40,6 @@
 | 
			
		||||
 import sys
 | 
			
		||||
 import tarfile
 | 
			
		||||
 import tempfile
 | 
			
		||||
-import textwrap
 | 
			
		||||
 import time
 | 
			
		||||
 import zipfile
 | 
			
		||||
 from io import open  # needed for python 2
 | 
			
		||||
@@ -48,8 +47,7 @@
 | 
			
		||||
 from urllib.parse import urlparse
 | 
			
		||||
 
 | 
			
		||||
 import toml
 | 
			
		||||
-from pep517.envbuild import BuildEnvironment
 | 
			
		||||
-from pep517.wrappers import Pep517HookCaller
 | 
			
		||||
+import build.util
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
 def transform_dep_for_pip(dependency):
 | 
			
		||||
@@ -113,40 +111,7 @@ def extract_metainfo_files_from_package(
 | 
			
		||||
             )
 | 
			
		||||
             package = os.path.join(temp_folder, "package")
 | 
			
		||||
 
 | 
			
		||||
-        # Because PEP517 can be noisy and contextlib.redirect_* fails to
 | 
			
		||||
-        # contain it, we will run the actual analysis in a separate process:
 | 
			
		||||
-        try:
 | 
			
		||||
-            subprocess.check_output([
 | 
			
		||||
-                sys.executable,
 | 
			
		||||
-                "-c",
 | 
			
		||||
-                "import importlib\n"
 | 
			
		||||
-                "import json\n"
 | 
			
		||||
-                "import os\n"
 | 
			
		||||
-                "import sys\n"
 | 
			
		||||
-                "sys.path = [os.path.dirname(sys.argv[3])] + sys.path\n"
 | 
			
		||||
-                "m = importlib.import_module(\n"
 | 
			
		||||
-                "    os.path.basename(sys.argv[3]).partition('.')[0]\n"
 | 
			
		||||
-                ")\n"
 | 
			
		||||
-                "m._extract_metainfo_files_from_package_unsafe("
 | 
			
		||||
-                "    sys.argv[1],"
 | 
			
		||||
-                "    sys.argv[2],"
 | 
			
		||||
-                ")",
 | 
			
		||||
-                package, output_folder, os.path.abspath(__file__)],
 | 
			
		||||
-                stderr=subprocess.STDOUT,  # make sure stderr is muted.
 | 
			
		||||
-                cwd=os.path.join(os.path.dirname(__file__), "..")
 | 
			
		||||
-            )
 | 
			
		||||
-        except subprocess.CalledProcessError as e:
 | 
			
		||||
-            output = e.output.decode("utf-8", "replace")
 | 
			
		||||
-            if debug:
 | 
			
		||||
-                print("Got error obtaining meta info.")
 | 
			
		||||
-                print("Detail output:")
 | 
			
		||||
-                print(output)
 | 
			
		||||
-                print("End of Detail output.")
 | 
			
		||||
-            raise ValueError(
 | 
			
		||||
-                "failed to obtain meta info - "
 | 
			
		||||
-                "is '{}' a valid package? "
 | 
			
		||||
-                "Detailed output:\n{}".format(package, output)
 | 
			
		||||
-                )
 | 
			
		||||
+        _extract_metainfo_files_from_package_unsafe(package, output_folder)
 | 
			
		||||
     finally:
 | 
			
		||||
         shutil.rmtree(temp_folder)
 | 
			
		||||
 
 | 
			
		||||
@@ -461,51 +426,17 @@ def _extract_metainfo_files_from_package_unsafe(
 | 
			
		||||
         clean_up_path = True
 | 
			
		||||
 
 | 
			
		||||
     try:
 | 
			
		||||
-        build_requires = []
 | 
			
		||||
         metadata_path = None
 | 
			
		||||
 
 | 
			
		||||
         if path_type != "wheel":
 | 
			
		||||
-            # We need to process this first to get the metadata.
 | 
			
		||||
-
 | 
			
		||||
-            # Ensure pyproject.toml is available (pep517 expects it)
 | 
			
		||||
-            if not os.path.exists(os.path.join(path, "pyproject.toml")):
 | 
			
		||||
-                with open(os.path.join(path, "pyproject.toml"), "w") as f:
 | 
			
		||||
-                    f.write(textwrap.dedent(u"""\
 | 
			
		||||
-                    [build-system]
 | 
			
		||||
-                    requires = ["setuptools", "wheel"]
 | 
			
		||||
-                    build-backend = "setuptools.build_meta"
 | 
			
		||||
-                    """))
 | 
			
		||||
-
 | 
			
		||||
-            # Copy the pyproject.toml:
 | 
			
		||||
-            shutil.copyfile(
 | 
			
		||||
-                os.path.join(path, 'pyproject.toml'),
 | 
			
		||||
-                os.path.join(output_path, 'pyproject.toml')
 | 
			
		||||
-            )
 | 
			
		||||
-
 | 
			
		||||
-            # Get build backend and requirements from pyproject.toml:
 | 
			
		||||
-            with open(os.path.join(path, 'pyproject.toml')) as f:
 | 
			
		||||
-                build_sys = toml.load(f)['build-system']
 | 
			
		||||
-                backend = build_sys["build-backend"]
 | 
			
		||||
-                build_requires.extend(build_sys["requires"])
 | 
			
		||||
-
 | 
			
		||||
-            # Get a virtualenv with build requirements and get all metadata:
 | 
			
		||||
-            env = BuildEnvironment()
 | 
			
		||||
-            metadata = None
 | 
			
		||||
-            with env:
 | 
			
		||||
-                hooks = Pep517HookCaller(path, backend)
 | 
			
		||||
-                env.pip_install(
 | 
			
		||||
-                    [transform_dep_for_pip(req) for req in build_requires]
 | 
			
		||||
-                )
 | 
			
		||||
-                reqs = hooks.get_requires_for_build_wheel({})
 | 
			
		||||
-                env.pip_install([transform_dep_for_pip(req) for req in reqs])
 | 
			
		||||
-                try:
 | 
			
		||||
-                    metadata = hooks.prepare_metadata_for_build_wheel(path)
 | 
			
		||||
-                except Exception:  # sadly, pep517 has no good error here
 | 
			
		||||
-                    pass
 | 
			
		||||
-            if metadata is not None:
 | 
			
		||||
-                metadata_path = os.path.join(
 | 
			
		||||
-                    path, metadata, "METADATA"
 | 
			
		||||
-                )
 | 
			
		||||
+            # Use a build helper function to fetch the metadata directly
 | 
			
		||||
+            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:
 | 
			
		||||
+                for key in metadata.keys():
 | 
			
		||||
+                    for value in metadata.get_all(key):
 | 
			
		||||
+                        f.write("{}: {}\n".format(key, value))
 | 
			
		||||
         else:
 | 
			
		||||
             # This is a wheel, so metadata should be in *.dist-info folder:
 | 
			
		||||
             metadata_path = os.path.join(
 | 
			
		||||
diff --git a/setup.py b/setup.py
 | 
			
		||||
index 57bddc2593..c0539b48c0 100644
 | 
			
		||||
--- a/setup.py
 | 
			
		||||
+++ b/setup.py
 | 
			
		||||
@@ -22,9 +22,9 @@
 | 
			
		||||
 install_reqs = [
 | 
			
		||||
     'appdirs', 'colorama>=0.3.3', 'jinja2',
 | 
			
		||||
     'sh>=1.10, <2.0; sys_platform!="nt"',
 | 
			
		||||
-    'pep517', 'toml', 'packaging',
 | 
			
		||||
+    'build', 'toml', 'packaging',
 | 
			
		||||
 ]
 | 
			
		||||
-# (pep517 and toml are used by pythonpackage.py)
 | 
			
		||||
+# (build and toml are used by pythonpackage.py)
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
 # By specifying every file manually, package_data will be able to
 | 
			
		||||
diff --git a/tests/test_pythonpackage.py b/tests/test_pythonpackage.py
 | 
			
		||||
index 2f88cf2aa4..21412e9258 100644
 | 
			
		||||
--- a/tests/test_pythonpackage.py
 | 
			
		||||
+++ b/tests/test_pythonpackage.py
 | 
			
		||||
@@ -42,7 +42,7 @@ def test_get_package_dependencies():
 | 
			
		||||
         if "MarkupSafe" in dep
 | 
			
		||||
     ]
 | 
			
		||||
     # Check setuptools not being in non-recursive deps:
 | 
			
		||||
-    # (It will be in recursive ones due to p4a's pep517 dependency)
 | 
			
		||||
+    # (It will be in recursive ones due to p4a's build dependency)
 | 
			
		||||
     assert "setuptools" not in deps_nonrecursive
 | 
			
		||||
     # Check setuptools is present in non-recursive deps,
 | 
			
		||||
     # if we also add build requirements:
 | 
			
		||||
diff --git a/tests/test_pythonpackage_basic.py b/tests/test_pythonpackage_basic.py
 | 
			
		||||
index b05344b56b..e98a5f99b0 100644
 | 
			
		||||
--- a/tests/test_pythonpackage_basic.py
 | 
			
		||||
+++ b/tests/test_pythonpackage_basic.py
 | 
			
		||||
@@ -236,7 +236,7 @@ def run__get_system_python_executable(self, pybin):
 | 
			
		||||
             pybin,
 | 
			
		||||
             "-c",
 | 
			
		||||
             "import importlib\n"
 | 
			
		||||
-            "import json\n"
 | 
			
		||||
+            "import build.util\n"
 | 
			
		||||
             "import os\n"
 | 
			
		||||
             "import sys\n"
 | 
			
		||||
             "sys.path = [os.path.dirname(sys.argv[1])] + sys.path\n"
 | 
			
		||||
@@ -273,8 +273,8 @@ def test_systemwide_python(self):
 | 
			
		||||
             # Some deps may not be installed, so we just avoid to raise
 | 
			
		||||
             # an exception here, as a missing dep should not make the test
 | 
			
		||||
             # fail.
 | 
			
		||||
-            if "pep517" in str(e.args):
 | 
			
		||||
-                # System python probably doesn't have pep517 available!
 | 
			
		||||
+            if "build" in str(e.args):
 | 
			
		||||
+                # System python probably doesn't have build available!
 | 
			
		||||
                 pass
 | 
			
		||||
             elif "toml" in str(e.args):
 | 
			
		||||
                 # System python probably doesn't have toml available!
 | 
			
		||||
@@ -304,11 +304,8 @@ def test_venv(self):
 | 
			
		||||
             ])
 | 
			
		||||
             subprocess.check_output([
 | 
			
		||||
                 os.path.join(test_dir, "venv", "bin", "pip"),
 | 
			
		||||
-                "install", "-U", "pep517"
 | 
			
		||||
-            ])
 | 
			
		||||
-            subprocess.check_output([
 | 
			
		||||
-                os.path.join(test_dir, "venv", "bin", "pip"),
 | 
			
		||||
-                "install", "-U", "toml"
 | 
			
		||||
+                "install", "-U", "build", "toml", "sh<2.0", "colorama",
 | 
			
		||||
+                "appdirs", "jinja2", "packaging"
 | 
			
		||||
             ])
 | 
			
		||||
             sys_python_path = self.run__get_system_python_executable(
 | 
			
		||||
                 os.path.join(test_dir, "venv", "bin", "python")
 | 
			
		||||
		Reference in New Issue
	
	Block a user