hatchling, new python recipe (#8675)

Co-authored-by: Oscar Lesta <oscar.lesta@gmail.com>
This commit is contained in:
Schrijvers Luc
2023-05-19 09:06:24 +02:00
committed by GitHub
parent 560b9bdc06
commit e714bec19d

View File

@@ -0,0 +1,82 @@
SUMMARY="Modern, extensible Python build backend"
DESCRIPTION="This is the extensible, standards compliant build backend used by Hatch."
HOMEPAGE="https://hatch.pypa.io/dev/history/hatchling/"
COPYRIGHT="2021-present Ofek Lev"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://files.pythonhosted.org/packages/source/h/$portName/$portName-$portVersion.tar.gz"
CHECKSUM_SHA256="b1244db3f45b4ef5a00106a46612da107cdfaf85f1580b8e1c059fefc98b0930"
ARCHITECTURES="any"
PROVIDES="
$portName = $portVersion
"
REQUIRES="
haiku
"
BUILD_REQUIRES="
haiku_devel
"
PYTHON_PACKAGES=(python39 python310)
PYTHON_VERSIONS=(3.9 3.10)
defaultVersion=3.9
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
eval "PROVIDES_$pythonPackage=\"
${portName}_$pythonPackage = $portVersion
cmd:hatchling_$pythonVersion
\""
# Provide non-suffixed cmd only for the default Python version
if [ $pythonVersion = $defaultVersion ]; then
eval "PROVIDES_$pythonPackage+=\"
cmd:hatchling
\""
fi
eval "REQUIRES_$pythonPackage=\"
haiku
editables_$pythonPackage >= 0.3
packaging_$pythonPackage >= 21.3
pathspec_$pythonPackage >= 0.10.1
pluggy_$pythonPackage >= 1.0.0
tomli_$pythonPackage > 1.2.2 # Only for Python < 3.11
trove_classifiers_$pythonPackage
cmd:python$pythonVersion
\""
BUILD_REQUIRES+="
build_$pythonPackage
installer_$pythonPackage
pathspec_$pythonPackage >= 0.10.1
pluggy_$pythonPackage >= 1.0.0
trove_classifiers_$pythonPackage
"
BUILD_PREREQUIRES+="
cmd:python$pythonVersion
"
done
INSTALL()
{
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonVersion=${PYTHON_VERSIONS[$i]}
python=python$pythonVersion
$python -m build --wheel --skip-dependency-check --no-isolation
$python -m installer -p $prefix dist/*.whl
mv $prefix/bin/hatchling $prefix/bin/hatchling-$pythonVersion
# Provide non-suffixed cmd only for the default Python version
if [ $pythonVersion = $defaultVersion ]; then
ln -sr $prefix/bin/hatchling-$pythonVersion $prefix/bin/hatchling
fi
packageEntries ${PYTHON_PACKAGES[i]} \
$prefix/lib/python* \
$prefix/bin
done
}