diff --git a/dev-python/pyserial/pyserial-3.5~20211205.recipe b/dev-python/pyserial/pyserial-3.5~20211205.recipe index 0879dac39..77bd31982 100644 --- a/dev-python/pyserial/pyserial-3.5~20211205.recipe +++ b/dev-python/pyserial/pyserial-3.5~20211205.recipe @@ -6,7 +6,7 @@ The module named "serial" automatically selects the appropriate backend." HOMEPAGE="https://github.com/pyserial/pyserial" COPYRIGHT="2001-2020 Chris Liechti" LICENSE="BSD (3-clause)" -REVISION="3" +REVISION="4" srcGitRev="31fa4807d73ed4eb9891a88a15817b439c4eea2d" SOURCE_URI="https://github.com/pyserial/pyserial/archive/$srcGitRev.tar.gz" CHECKSUM_SHA256="d77a5431db2d1d8e1c7d99bc2d736981c7ae9f73d0ffff9861be94589b1c14b3" @@ -27,41 +27,66 @@ BUILD_REQUIRES=" haiku_devel " -PYTHON_PACKAGES=(python39 python310) -PYTHON_VERSIONS=(3.9 3.10) -for i in "${!PYTHON_PACKAGES[@]}"; do -pythonPackage=${PYTHON_PACKAGES[i]} -pythonVersion=${PYTHON_VERSIONS[$i]} -eval "PROVIDES_${pythonPackage}=\"\ - ${portName}_$pythonPackage = $portVersion\n\ - cmd:pyserial_miniterm\n\ - cmd:pyserial_ports\n\ - \"; \ -REQUIRES_$pythonPackage=\"\ - haiku\n\ - cmd:python$pythonVersion\ - \"" -BUILD_REQUIRES="$BUILD_REQUIRES - setuptools_$pythonPackage" -BUILD_PREREQUIRES="$BUILD_PREREQUIRES - cmd:python$pythonVersion" +PYTHON_VERSIONS=(3.10) +defaultVersion=3.10 + +for pythonVersion in ${PYTHON_VERSIONS[@]}; do + pythonPackage=python${pythonVersion//.} + + eval "PROVIDES_$pythonPackage=\" + ${portName}_$pythonPackage = $portVersion + cmd:pyserial_miniterm_$pythonVersion = $portVersion + cmd:pyserial_ports_$pythonVersion = $portVersion + \"" + # Provide non-suffixed cmd only for the default Python version + if [ $pythonVersion = $defaultVersion ]; then + eval "PROVIDES_$pythonPackage+=\" + cmd:pyserial_miniterm = $portVersion + cmd:pyserial_ports = $portVersion + \"" + fi + + eval "REQUIRES_$pythonPackage=\" + haiku + 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]} + for pythonVersion in ${PYTHON_VERSIONS[@]}; do + pythonPackage=python${pythonVersion//.} 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 - packageEntries $pythonPackage \ + # 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 + ln -sr $f ${f%-$pythonVersion} + done + fi + + packageEntries $pythonPackage \ $prefix/lib/python* \ $prefix/bin done