newapkbuild: add gpep517 buildtype

This commit is contained in:
Lauren N. Liberda 2023-03-31 02:48:47 +02:00 committed by alice
parent 19d620e8b4
commit a9e06de217
1 changed files with 38 additions and 4 deletions

View File

@ -102,6 +102,14 @@ build_python() {
__EOF__
}
build_python_gpep517() {
cat >>APKBUILD<<__EOF__
gpep517 build-wheel \\
--wheel-dir dist \\
--output-fd 3 3>&1 >&2
__EOF__
}
build_rust() {
cat >>APKBUILD<<__EOF__
cargo auditable build --frozen --release
@ -134,6 +142,14 @@ check_python() {
__EOF__
}
check_python_gpep517() {
cat >>APKBUILD<<__EOF__
python3 -m venv --clear --without-pip --system-site-packages testenv
testenv/bin/python3 -m installer dist/*.whl
testenv/bin/python3 -m pytest
__EOF__
}
check_empty() {
cat >>APKBUILD<<__EOF__
# Replace with proper check command(s)
@ -189,6 +205,13 @@ package_python() {
__EOF__
}
package_python_gpep517() {
cat >>APKBUILD<<__EOF__
python3 -m installer -d "\$pkgdir" \\
dist/*.whl
__EOF__
}
package_empty() {
cat >>APKBUILD<<__EOF__
# Replace with proper package command(s)
@ -237,7 +260,7 @@ newaport() {
source="https://downloads.sourceforge.net/$pn/$pn-$pv.tar.gz"
fi
if [ -z "$depends" ] && [ "$buildtype" = "python" ]; then
if [ -z "$depends" ] && [ "$buildtype" = "python"* ]; then
depends="python3"
fi
@ -245,12 +268,13 @@ newaport() {
depends="perl"
fi
if [ -z "$checkdepends" ] && [ "$buildtype" = "python" ]; then
if [ -z "$checkdepends" ] && [ "$buildtype" = "python"* ]; then
checkdepends="py3-pytest"
fi
case "$buildtype" in
python) makedepends="py3-setuptools";;
python_gpep517) makedepends="py3-gpep517 py3-setuptools py3-wheel";;
cmake) makedepends="cmake samurai";;
meson) makedepends="meson";;
rust) makedepends="cargo cargo-auditable";;
@ -327,6 +351,8 @@ __EOF__
buildtype="make"
elif [ -r "$sdir"/setup.py ] || [ "${pn#py[0-9]-}" != "$pn" ]; then
buildtype="python"
elif [ -r "$sdir"/pyproject.toml ] || [ "${pn#py[0-9]-}" != "$pn" ]; then
buildtype="python_gpep517"
elif [ -r "$sdir"/Cargo.toml ]; then
buildtype="rust"
fi
@ -365,6 +391,8 @@ __EOF__
build_perl;;
python)
build_python;;
python_gpep517)
build_python_gpep517;;
rust)
build_rust;;
*)
@ -390,6 +418,8 @@ __EOF__
check_meson;;
python)
check_python;;
python_gpep517)
check_python_gpep517;;
rust)
check_rust;;
*)
@ -419,6 +449,8 @@ __EOF__
package_perl;;
python)
package_python;;
python_gpep517)
package_python_gpep517;;
rust)
package_rust;;
*)
@ -459,7 +491,8 @@ usage() {
-C Create CMake package (Assume cmake/ is there)
-m Create meson package (Assume meson.build is there)
-p Create perl package (Assume Makefile.PL is there)
-y Create python package (Assume setup.py is there)
-y Create python setuptools package (Assume setup.py is there)
-e Create python gpep517 package (Assume pyproject.toml is there)
-r Create rust package (Assume Cargo.toml is there)
-s Use sourceforge source URL
-c Copy a sample init.d, conf.d, and install script
@ -496,7 +529,7 @@ check_arguments() {
fi
}
while getopts "acCmd:fhl:n:pyu:sr" opt; do
while getopts "acCmd:fhl:n:pyeu:sr" opt; do
case $opt in
'a') set_buildtype "autotools";;
'c') cpinitd=1;;
@ -509,6 +542,7 @@ while getopts "acCmd:fhl:n:pyu:sr" opt; do
'n') pkgname="$OPTARG";;
'p') set_buildtype "perl";;
'y') set_buildtype "python";;
'e') set_buildtype "python_gpep517";;
'r') set_buildtype "rust";;
'u') url="$OPTARG";;
's') sourceforge=1;;