summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d84bcecabea0a8646968cc36122c1a971356074a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Maintainer: Patrick Northon <northon_patrick3@yahoo.ca>

_pkgname=openandroidinstaller
pkgname=${_pkgname}-git
provides=("${_pkgname}")
conflicts=("${_pkgname}")
pkgver=v0.5.3.beta.r13.g562acd3
pkgrel=1
pkgdesc='Makes installing alternative Android distributions nice and easy.'
url="https://${_pkgname}.org/"
license=('GPL3')
depends=('python')
arch=('any')
optdepends=()
makedepends=('git' 'python-build' 'python-installer' 'python-wheel' 'python-poetry')
source=("git+https://github.com/${_pkgname}-dev/${_pkgname}.git")
sha256sums=('SKIP')

pkgver() {
	cd "${_pkgname}"
	( set -o pipefail
		git describe --tags --abbrev=7 --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
		printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
	)
}

prepare() {
	cd "${_pkgname}"
	sed -i 's/CountinuosRectangleBorder/ContinuousRectangleBorder/' 'openandroidinstaller/views/'{requirements_view.py,start_view.py,select_view.py,addon_view.py}
	sed -i 's/command_list = \[str(bin_path.joinpath(Path(f"{tool}")))\] + command/command_list = shlex.split(full_command)/' 'openandroidinstaller/tooling.py'
}

build() {
	cd "${_pkgname}"
	#python 'scripts/build.py'
	python -m build --wheel --no-isolation
}

package() {
	depends+=('android-tools' 'heimdall' 'python-altgraph' 'python-attrs' 'python-beartype' 'python-black' 'python-click' 'python-tomli'
		'python-colorama' 'python-aiohttp' 'python-brotli' 'python-brotlicffi' 'python-certifi' 'python-cffi'
		'python-charset-normalizer' 'python-exceptiongroup' 'python-flet' 'python-schema' 'python-yaml'
		'python-regex' 'python-loguru')
	
	cd "${_pkgname}"
	python -m installer --destdir="$pkgdir" 'dist/'*.whl
	
	local site_packages="$(python -c "import site; print(site.getsitepackages()[0])")"
	
	install -Dm755 <(cat <<- EOF
		#!/usr/bin/env sh
		python '$site_packages/openandroidinstaller/openandroidinstaller.py'
		EOF
	) "${pkgdir}/usr/bin/${_pkgname}"
	
	install -Dm644 'flatpak/org.openandroidinstaller.OpenAndroidInstaller.desktop' -t "${pkgdir}/usr/share/applications"
	install -Dm644 'flatpak/org.openandroidinstaller.OpenAndroidInstaller.png' -t "${pkgdir}/usr/share/pixmaps"
}