mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 05:10:05 +02:00
134 lines
3.3 KiB
Bash
134 lines
3.3 KiB
Bash
SUMMARY="Automatically build man-pages for your Python project"
|
|
DESCRIPTION="Avoid documenting your Python script arguments on two places! This is typically done \
|
|
in an argparse.ArgumentParser help configuration (help=, description=, etc.), and also in a \
|
|
manually crafted manual page.
|
|
|
|
The good thing about an ArgumentParser objects is that it actually provides a traversable \
|
|
\"tree-like\" structure, with all the necessary info needed to automatically generate \
|
|
documentation, for example in a groff typesetting system (manual pages). And this is where this \
|
|
project can help.
|
|
|
|
There are two supported ways to generate the manual, either script it using the installed command \
|
|
argparse-manpage, or via setup.py build automation (with a slight bonus of automatic manual page \
|
|
installation with setup.py install)."
|
|
HOMEPAGE="https://github.com/praiskup/argparse-manpage"
|
|
COPYRIGHT="Gabriele Giammatteo
|
|
Pavel Raiskup"
|
|
LICENSE="Apache v2"
|
|
REVISION="2"
|
|
SOURCE_URI="https://github.com/praiskup/argparse-manpage/releases/download/v$portVersion/argparse-manpage-$portVersion.tar.gz"
|
|
CHECKSUM_SHA256="0b659d70fd142876da41c2918bd6de4d027875720b0e4672d6443b51198dbb62"
|
|
SOURCE_DIR="argparse-manpage-$portVersion"
|
|
PATCHES="argparse_manpage-$portVersion.patchset"
|
|
|
|
ARCHITECTURES="any"
|
|
|
|
PROVIDES="
|
|
$portName = $portVersion
|
|
"
|
|
REQUIRES="
|
|
haiku
|
|
"
|
|
|
|
BUILD_REQUIRES="
|
|
haiku_devel
|
|
"
|
|
|
|
PYTHON_VERSIONS=(3.10)
|
|
defaultVersion=3.10
|
|
for i in "${!PYTHON_VERSIONS[@]}"; do
|
|
pythonVersion=${PYTHON_VERSIONS[$i]}
|
|
pythonPackage=python${pythonVersion//.}
|
|
|
|
eval "PROVIDES_$pythonPackage=\"
|
|
${portName}_$pythonPackage = $portVersion
|
|
cmd:argparse_manpage_$pythonVersion = $portVersion
|
|
\""
|
|
|
|
if [ $pythonVersion = $defaultVersion ]; then
|
|
eval "PROVIDES_$pythonPackage+=\"
|
|
cmd:argparse_manpage = $portVersion
|
|
\""
|
|
fi
|
|
|
|
eval "REQUIRES_$pythonPackage=\"
|
|
haiku
|
|
cmd:python$pythonVersion
|
|
\""
|
|
|
|
if [ ${pythonVersion:2} -lt 11 ]; then
|
|
eval "REQUIRES_$pythonPackage+=\"
|
|
tomli_$pythonPackage
|
|
\""
|
|
fi
|
|
|
|
BUILD_REQUIRES+="
|
|
build_$pythonPackage
|
|
installer_$pythonPackage
|
|
setuptools_$pythonPackage
|
|
wheel_$pythonPackage
|
|
"
|
|
BUILD_PREREQUIRES+="
|
|
cmd:python$pythonVersion
|
|
"
|
|
|
|
TEST_REQUIRES+="
|
|
pip_$pythonPackage
|
|
pytest_$pythonPackage
|
|
"
|
|
done
|
|
|
|
PATCH()
|
|
{
|
|
sed -i "s,share/man,$relativeManDir,g" \
|
|
build_manpages/build_manpages.py \
|
|
tests/test_examples.py
|
|
}
|
|
|
|
INSTALL()
|
|
{
|
|
for i in "${!PYTHON_VERSIONS[@]}"; do
|
|
pythonVersion=${PYTHON_VERSIONS[$i]}
|
|
pythonPackage=python${pythonVersion//.}
|
|
|
|
python=python$pythonVersion
|
|
|
|
$python -m build --wheel --skip-dependency-check --no-isolation
|
|
$python -m installer -p $prefix dist/*.whl
|
|
|
|
# Version suffix all the scripts and man pages
|
|
for f in $binDir/*; do
|
|
mv $f $f-$pythonVersion
|
|
done
|
|
for f in $manDir/man1/*; do
|
|
mv $f ${f%.1}-$pythonVersion.1
|
|
done
|
|
|
|
# And provide suffix-less symlinks for the default version
|
|
if [ $pythonVersion = $defaultVersion ]; then
|
|
for f in $binDir/*; do
|
|
ln -sr $f ${f%-$pythonVersion}
|
|
done
|
|
for f in $manDir/man1/*; do
|
|
ln -sr $f ${f%-$pythonVersion.1}.1
|
|
done
|
|
fi
|
|
|
|
packageEntries $pythonPackage \
|
|
$prefix/lib/python* \
|
|
$binDir \
|
|
$manDir
|
|
done
|
|
}
|
|
|
|
TEST() {
|
|
for i in "${!PYTHON_VERSIONS[@]}"; do
|
|
pythonVersion=${PYTHON_VERSIONS[$i]}
|
|
pythonPackage=python${pythonVersion//.}
|
|
|
|
python=python$pythonVersion
|
|
|
|
$python -m pytest
|
|
done
|
|
}
|