pygments: recipe clean ups, fix build. (#9855)

This commit is contained in:
OscarL
2023-12-09 03:35:11 -03:00
committed by GitHub
parent 0be19fb8ae
commit 4bec58437d

View File

@@ -14,7 +14,7 @@ ANSI sequences
HOMEPAGE="https://pygments.org/"
COPYRIGHT="2006-2023 by the Pygments team"
LICENSE="BSD (2-clause)"
REVISION="3"
REVISION="4"
SOURCE_URI="https://pypi.org/packages/source/P/Pygments/Pygments-$portVersion.tar.gz"
CHECKSUM_SHA256="b3ed06a9e8ac9a9aae5a6f5dbe78a8a58655d17b43b93c078f094ddc476ae297"
SOURCE_DIR="Pygments-$portVersion"
@@ -32,36 +32,47 @@ BUILD_REQUIRES="
haiku_devel
"
PYTHON_PACKAGES=(python39 python310)
# Add more versions here as necessary:
PYTHON_VERSIONS=(3.9 3.10)
commandSuffixes=(3.9 "" 3.10)
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
commandSuffix=${commandSuffixes[$i]}
eval "PROVIDES_${pythonPackage}=\"\
${portName}_$pythonPackage = $portVersion\n\
cmd:pygmentize$commandSuffix = $portVersion\n\
\"; \
REQUIRES_$pythonPackage=\"\
haiku\n\
cmd:python$pythonVersion\
\""
BUILD_REQUIRES="$BUILD_REQUIRES
setuptools_$pythonPackage"
BUILD_PREREQUIRES="$BUILD_PREREQUIRES
cmd:python$pythonVersion"
# And don't forget to change this if the default Python version on Haiku changes:
defaultVersion=3.10
for i in "${!PYTHON_VERSIONS[@]}"; do
pythonVersion=${PYTHON_VERSIONS[$i]}
pythonPackage=python${pythonVersion//.}
eval "PROVIDES_${pythonPackage}=\"
${portName}_$pythonPackage = $portVersion
cmd:pygmentize_$pythonVersion = $portVersion
\""
if [ $pythonVersion = $defaultVersion ]; then
eval "PROVIDES_$pythonPackage+=\"
cmd:pygmentize = $portVersion
\""
fi
eval "REQUIRES_$pythonPackage=\"
$REQUIRES
cmd:python$pythonVersion
\""
BUILD_REQUIRES+="
setuptools_$pythonPackage
"
BUILD_PREREQUIRES+="
cmd:python$pythonVersion
"
done
INSTALL()
{
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
for i in "${!PYTHON_VERSIONS[@]}"; do
pythonVersion=${PYTHON_VERSIONS[$i]}
commandSuffix=${commandSuffixes[$i]}
pythonPackage=python${pythonVersion//.}
python=python$pythonVersion
installLocation=$prefix/lib/$python/vendor-packages/
export PYTHONPATH=$installLocation:$PYTHONPATH
@@ -74,9 +85,15 @@ INSTALL()
mkdir -p $manDir/man1
cp doc/pygmentize.1 $manDir/man1
if [ "$pythonVersion" = "$commandSuffix" ]; then
# Version suffix all the scripts
for f in $binDir/*; do
mv $f $f-$pythonVersion
done
# And provide suffix-less symlinks for the default version
if [ $pythonVersion = $defaultVersion ]; then
for f in $binDir/*; do
mv $f ${f}$commandSuffix
ln -sr $f ${f%-$pythonVersion}
done
fi