diff options
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 166 |
1 files changed, 39 insertions, 127 deletions
@@ -1,138 +1,50 @@ -# Maintainer: Unknown Packager - -export PIP_CONFIG_FILE=/dev/null -export PIP_DISABLE_PIP_VERSION_CHECK=true +# Maintainer: Luis Martinez <luis dot martinez at disroot dot org> pkgname=python-enaml -epoch= -pkgver=0.12.0 -pkgrel=00 +_pkg=enaml +pkgver=0.15.2 +pkgrel=1 pkgdesc='Declarative DSL for building rich user interfaces in Python' -arch=(x86_64) +arch=('x86_64') url=https://github.com/nucleic/enaml -license=(BSD) -depends=(python python-ply python-atom python-bytecode python-kiwisolver) -depends+=() -makedepends=(python-pip python-wheel) -checkdepends=() -provides=() -conflicts=(${provides%=*}) # No quotes, to avoid an empty entry. -source=(PKGBUILD_EXTRAS) -md5sums=(SKIP) -noextract=() -source+=(https://files.pythonhosted.org/packages/d5/d5/b3e88ac554ea36b77d08b612e3259d998ad9868ac60f3c60918377c9999f/enaml-0.12.0.tar.gz) -md5sums+=(8e77a894b8546ee8a4678dfb3aad25a3) -source+=(LICENSE) -md5sums+=(9498cbdb4d81d88314d3baca05dcbe5f) - -_first_source() { - echo " ${source_i686[@]} ${source_x86_64[@]} ${source[@]}" | - tr ' ' '\n' | grep -Pv '^(PKGBUILD_EXTRAS)?$' | head -1 -} - -_vcs="$(grep -Po '^[a-z]+(?=\+)' <<< "$(_first_source)")" -if [[ "$_vcs" ]]; then - makedepends+=("$(pkgfile --quiet /usr/bin/$_vcs)") - provides+=("${pkgname%-$_vcs}") - conflicts+=("${pkgname%-$_vcs}") -fi - -_is_wheel() { - [[ $(_first_source) =~ \.whl$ ]] -} - -if [[ _is_wheel && - $(basename "$(_first_source)" | rev | cut -d- -f1 | rev) =~ ^manylinux ]]; then - options=(!strip) # https://github.com/pypa/manylinux/issues/119 -fi - -_dist_name() { - find "$srcdir" -mindepth 1 -maxdepth 1 -type d -printf '%f -' | - grep -v '^_tmpenv$' +license=('BSD') +depends=('python>=3.8' 'python-ply' 'python-atom' 'python-bytecode' 'python-kiwisolver') +makedepends=( + 'python-build' + 'python-cppy' + 'python-installer' + 'python-setuptools' + 'python-setuptools-scm' + 'python-sphinx' + 'python-wheel') +optdepends=('python-pyqt5' 'pyside2' 'python-pyqt6' 'pyside6') +checkdepends=('python-pytest') +source=("$pkgname-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/e/$_pkg/$_pkg-$pkgver.tar.gz") +sha256sums=('75ba5b120fe1a90418ff03103acdc6a25d1b044dc4e42bcc42cb7f2e76f6d95b') + +prepare() { + cd "$_pkg-$pkgver" + sed -i '/sphinx.ext.graphviz/d;152d' docs/source/conf.py } -if [[ $(_first_source) =~ ^git+ ]]; then - _pkgver() { - ( set -o pipefail - cd "$srcdir/$(_dist_name)" - git describe --long --tags 2>/dev/null | - sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' || - printf "r%s.%s" \ - "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" - ) - } - - pkgver() { _pkgver; } -fi - -_build() { - if _is_wheel; then return; fi - cd "$srcdir" - # See Arch Wiki/PKGBUILD/license. - # Get the first filename that matches. - local test_name - if [[ ${license[0]} =~ ^(BSD|MIT|ZLIB|Python)$ ]]; then - for test_name in LICENSE LICENSE.txt license.txt COPYING COPYING.md COPYING.rst COPYING.txt COPYRIGHT; do - if cp "$srcdir/$(_dist_name)/$test_name" "$srcdir/LICENSE" 2>/dev/null; then - break - fi - done - fi - # Use the latest version of pip, as Arch's version is historically out of - # date(!) and newer versions do fix bugs (sometimes). - python -mvenv --clear --system-site-packages _tmpenv - _tmpenv/bin/pip --quiet install -U pip - # Build the wheel (which we allow to fail) only after fetching the license. - # In order to isolate from ~/.pydistutils.cfg, we need to set $HOME to a - # temporary directory, and thus first $XDG_CACHE_HOME back to its real - # location, so that pip inserts the wheel in the wheel cache. We cannot - # use --global-option=--no-user-cfg instead because that fully disables - # wheels, causing a from-source build of build dependencies such as - # numpy/scipy. - XDG_CACHE_HOME="${XDG_CACHE_HOME:-"$HOME/.cache"}" HOME=_tmpenv \ - _tmpenv/bin/pip wheel -v --no-deps --wheel-dir="$srcdir" \ - "./$(_dist_name)" || true +build() { + cd "$_pkg-$pkgver" + python -m build --wheel --no-isolation + local python_version="$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')" + PYTHONPATH="$PWD/build/lib.linux-$CARCH-cpython-$python_version" make -C docs man } -build() { _build; } - -_check() { - # Define check(), possibly using _check as a helper, to run the tests. - # You may need to call `python setup.py build_ext -i` first. - if _is_wheel; then return; fi - cd "$srcdir/$(_dist_name)" - /usr/bin/python setup.py -q test +check() { + cd "$_pkg-$pkgver" + local python_version="$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')" + PYTHONPATH="$PWD/build/lib.linux-$CARCH-cpython-$python_version" pytest -x } -_package() { - cd "$srcdir" - # pypa/pip#3063: pip always checks for a globally installed version. - python -mvenv --clear --system-site-packages _tmpenv - _tmpenv/bin/pip install --prefix="$pkgdir/usr" \ - --no-deps --ignore-installed --no-warn-script-location \ - "$(ls ./*.whl 2>/dev/null || echo ./"$(_dist_name)")" - if [[ -d "$pkgdir/usr/bin" ]]; then # Fix entry points. - for f in "$pkgdir/usr/bin/"*; do - if [[ $(head -n1 "$f") = "#!$(readlink -f _tmpenv)/bin/python" ]]; then - sed -i '1c#!/usr/bin/python' "$f" - fi - done - fi - if [[ -d "$pkgdir/usr/etc" ]]; then - mv "$pkgdir/usr/etc" "$pkgdir/etc" - fi - if [[ -f LICENSE ]]; then - install -D -m644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" - fi +package() { + cd "$_pkg-$pkgver" + PYTHONHASHSEED=0 python -m installer --destdir="$pkgdir" dist/*.whl + install -Dm644 docs/build/man/enaml.1 -t "$pkgdir/usr/share/man/man1/" + local _site="$(python -c 'import site; print(site.getsitepackages()[0])')" + install -d "$pkgdir/usr/share/licenses/$pkgname/" + ln -s "$_site/$_pkg-$pkgver.dist-info/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/" } - -package() { _package; } - -. "$(dirname "$BASH_SOURCE")/PKGBUILD_EXTRAS" - -# Remove makedepends already in depends (which may have been listed for the -# first build, but autodetected on the second. -makedepends=($(printf '%s\n' "${makedepends[@]}" | - grep -Pwv "^($(IFS='|'; echo "${depends[*]}"))$")) -: # Apparently ending with makedepends assignment sometimes fails. |