From e0dfa9eb8ca54d2bf4c0af4d220b9ec06c58d17c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Pola=C5=84ski?= <michal@polanski.me>
Date: Fri, 20 May 2022 02:21:12 +0200
Subject: [PATCH] testing/esptool: upgrade to 4.0

and build with py3-build
---
 testing/esptool/APKBUILD                      | 29 ++++++++++---------
 .../esptool/remove-py-wheel-requirement.patch | 14 ---------
 2 files changed, 16 insertions(+), 27 deletions(-)
 delete mode 100644 testing/esptool/remove-py-wheel-requirement.patch

diff --git a/testing/esptool/APKBUILD b/testing/esptool/APKBUILD
index 314f1948b236..c9100de57dec 100644
--- a/testing/esptool/APKBUILD
+++ b/testing/esptool/APKBUILD
@@ -1,35 +1,38 @@
 # Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
+# Contributor: Michał Polański <michal@polanski.me>
 # Maintainer: Michał Polański <michal@polanski.me>
 pkgname=esptool
-pkgver=3.3.1
+pkgver=4.0
 pkgrel=0
 pkgdesc="ESP8266 and ESP32 serial bootloader utility"
 url="https://docs.espressif.com/projects/esptool"
 license="GPL-2.0-or-later"
 arch="noarch"
 depends="python3 py3-cryptography py3-ecdsa py3-pyserial py3-bitstring py3-reedsolo"
-makedepends="py3-setuptools"
+makedepends="py3-build py3-installer py3-setuptools py3-wheel"
 checkdepends="py3-elftools"
-source="$pkgname-$pkgver.tar.gz::https://github.com/espressif/esptool/archive/v$pkgver.tar.gz
-	remove-py-wheel-requirement.patch
-	"
+source="https://github.com/espressif/esptool/archive/v$pkgver/esptool-$pkgver.tar.gz"
 
 build() {
-	python3 setup.py build
+	python3 -m build --no-isolation --wheel
 }
 
 check() {
-	python3 test/test_imagegen.py
-	python3 test/test_espsecure.py
-	python3 test/test_merge_bin.py
-	python3 test/test_modules.py
+	python3 -m installer -d testenv \
+		dist/esptool-$pkgver-py3-none-any.whl
+
+	local sitedir="$(python3 -c 'import site;print(site.getsitepackages()[0])')"
+
+	for test in imagegen espsecure merge_bin modules; do
+		PYTHONPATH="$PWD/testenv/$sitedir" python3 test/test_$test.py
+	done
 }
 
 package() {
-	python3 setup.py install --root="$pkgdir" --skip-build
+	python3 -m installer -d "$pkgdir" \
+		dist/esptool-$pkgver-py3-none-any.whl
 }
 
 sha512sums="
-8da34f7b555513d499141ce403f19c3e77b6944eecde440c757faf3bbf5e915e44ff0bcabf1b2cb7f5fe26caa717bb47104ad808c46feaf1dea254d548048095  esptool-3.3.1.tar.gz
-3474afb4b455c93d705334ea81450b21f2ff29858d266a9a4c157857cc7cc35ef7e8fe36758b64679f93d02b3d6647c32b36926051f2b8afa7dfeb0de82b3c4a  remove-py-wheel-requirement.patch
+79964c42b812af58cdcb4ddf67fd9f54645d5027bb0c48da545e759465201d14e9b87558e2424aace063b1db37ac6af57b414752b10864adc9d611a5c9b337ea  esptool-4.0.tar.gz
 "
diff --git a/testing/esptool/remove-py-wheel-requirement.patch b/testing/esptool/remove-py-wheel-requirement.patch
deleted file mode 100644
index 2ed13eeb6c90..000000000000
--- a/testing/esptool/remove-py-wheel-requirement.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/setup.py
-+++ b/setup.py
-@@ -110,11 +110,6 @@
-         'Programming Language :: Python :: 3.8',
-         'Programming Language :: Python :: 3.9',
-     ],
--    setup_requires=(
--        ['wheel']
--        if 'bdist_wheel' in sys.argv and sys.version_info[0:2] not in [(3, 4), (3, 5)] else
--        []
--    ),
-     extras_require={
-         "dev": [
-             'flake8>=3.2.0',
-- 
GitLab