Files
haikuports/dev-python/qrcode/qrcode-7.2.recipe
OscarL e5eed8823c qrcode: switch to "any" arch, recipe cleanups. (#8818)
* qrcode: switch to "any" arch, recipe cleanups.

* Update dev-python/qrcode/qrcode-7.2.recipe

Co-authored-by: OscarL <oscar.lesta@gmail.com>

---------

Co-authored-by: Schrijvers Luc <begasus@gmail.com>
2023-06-08 16:00:46 +02:00

92 lines
2.2 KiB
Bash

SUMMARY="Pure python QR Code generator"
DESCRIPTION="This module uses the Python Imaging Library (PIL) to allow for \
the generation of QR Codes."
HOMEPAGE="https://github.com/lincolnloop/python-qrcode/"
COPYRIGHT="2011 Lincoln Loop"
LICENSE="BSD (3-clause)"
REVISION="3"
SOURCE_URI="https://github.com/lincolnloop/python-qrcode/archive/refs/tags/v$portVersion.tar.gz"
CHECKSUM_SHA256="051935ae06d8180a5a2413192dd236fdc6a2f3da3ef04af682afbe9d5c3286f4"
SOURCE_FILENAME="qrcode-v$portVersion.tar.gz"
SOURCE_DIR="python-qrcode-$portVersion"
ARCHITECTURES="any"
PROVIDES="
$portName = $portVersion
"
REQUIRES="
haiku
"
BUILD_REQUIRES="
haiku_devel
"
PYTHON_PACKAGES=(python38 python39 python310)
PYTHON_VERSIONS=(3.8 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:qr_$pythonVersion = $portVersion
\""
# Provide non-suffixed cmd only for the default Python version
if [ $pythonVersion = $defaultVersion ]; then
eval "PROVIDES_$pythonPackage+=\"
cmd:qr = $portVersion
\""
fi
if [ "$targetArchitecture" = x86_gcc2 ]; then
eval "PROVIDES_$pythonPackage+=\"
qrcode_$pythonPackage = $portVersion
\""
fi
eval "REQUIRES_$pythonPackage=\"
haiku
pillow_$pythonPackage
cmd:python$pythonVersion
\""
BUILD_REQUIRES+="
setuptools_$pythonPackage
"
BUILD_PREREQUIRES+="
cmd:python$pythonVersion
"
done
INSTALL()
{
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
python=python$pythonVersion
installLocation=$prefix/lib/$python/vendor-packages/
export PYTHONPATH=$installLocation:$PYTHONPATH
mkdir -p $installLocation
rm -rf build
$python setup.py build install \
--root=/ --prefix=$prefix
mv $binDir/qr $binDir/qr-$pythonVersion
# Provide suffix-less symlinks for the default version:
if [ $pythonVersion = $defaultVersion ]; then
ln -sr $binDir/qr-$pythonVersion $binDir/qr
fi
mkdir -p $(dirname $manDir)
mv $prefix/share/man $manDir
rmdir $prefix/share
packageEntries $pythonPackage \
$prefix/bin \
$prefix/lib/python* \
$manDir
done
}