python-xlib.SlackBuild 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/sh
  2. # Slackware build script for python-xlib
  3. # Written by Vasilis Papavasileiou <el03020 at mail dot ntua dot gr>
  4. # Copyright 2018-2020 Hunter Sezen California, USA
  5. PRGNAM=python-xlib
  6. VERSION=${VERSION:-0.26}
  7. BUILD=${BUILD:-1}
  8. TAG=${TAG:-_SBo}
  9. if [ -z "$ARCH" ]; then
  10. case "$( uname -m )" in
  11. i?86) ARCH=i586 ;;
  12. arm*) ARCH=arm ;;
  13. *) ARCH=$( uname -m ) ;;
  14. esac
  15. fi
  16. CWD=$(pwd)
  17. TMP=${TMP:-/tmp/SBo}
  18. PKG=$TMP/package-$PRGNAM
  19. OUTPUT=${OUTPUT:-/tmp}
  20. set -eu
  21. rm -rf $PKG
  22. mkdir -p $TMP $PKG $OUTPUT
  23. cd $TMP
  24. rm -rf $PRGNAM-$VERSION
  25. tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
  26. cd $PRGNAM-$VERSION
  27. chown -R root:root .
  28. find -L . \
  29. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  30. -o -perm 511 \) -exec chmod 755 {} \; -o \
  31. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  32. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  33. # Partially revert: fixup metadata
  34. # Revert: setup: check setuptools is recent enough to support `setup.cfg`
  35. # https://github.com/python-xlib/python-xlib/commit/22a8e1929ad58b8168bcf5d931e8f6067ebdec0a
  36. # https://github.com/python-xlib/python-xlib/commit/376b4739cedc4eee32e60e7b158d20ed18dfddc1
  37. # https://github.com/python-xlib/python-xlib/issues/106
  38. sed -i 's/\r$//g' setup.py
  39. patch -p1 < $CWD/setup.patch
  40. python setup.py install --root $PKG
  41. # Python 3 support.
  42. if python3 -c 'import sys' 2>/dev/null; then
  43. python3 setup.py install --root=$PKG
  44. fi
  45. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  46. cp -a CHANGELOG.md LICENSE PKG-INFO README.rst TODO $PKG/usr/doc/$PRGNAM-$VERSION
  47. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  48. mkdir -p $PKG/install
  49. cat $CWD/slack-desc > $PKG/install/slack-desc
  50. cd $PKG
  51. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}