PKGBUILD 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Maintainer: Carlos Aznarán <caznaranl@uni.pe>
  2. _base=ufl
  3. pkgname=python-fenics-${_base}
  4. pkgdesc="UFL - Unified Form Language"
  5. pkgver=2024.2.0.dev0_r3607.effa67e
  6. pkgrel=1
  7. arch=(any)
  8. url="https://github.com/FEniCS/${_base}"
  9. license=(MIT)
  10. depends=("python-numpy" "python-setuptools")
  11. makedepends=("python-build" "python-installer" "python-wheel")
  12. checkdepends=("python-cppimport" "python-pytest")
  13. source=("git+${url}#branch=main")
  14. sha512sums=('SKIP')
  15. provides=("python-${_base}")
  16. conflicts=("python-${_base}" "python-${_base}-git")
  17. _base_dir="${startdir}"/src/"${_base}"
  18. prepare() {
  19. cd "${_base_dir}"/
  20. git clean -dfx
  21. }
  22. pkgver() {
  23. cd "${_base_dir}"
  24. for i in pyproject.toml setup.cfg setup.py; do
  25. # Check if /version/ exists in any of these files
  26. if [[ -n $(grep 'version.*=' $i) ]]; then
  27. # Get version by removing " , ', spaces and =
  28. tag="$(grep -m 1 'version[[:space:]]*=' "${i}" |
  29. tr -d '", ' | tr -d "'" | cut -d'=' -f2)"
  30. break;
  31. fi;
  32. done
  33. printf "%s_r%s.%s" \
  34. ${tag%%.} \
  35. "$(git rev-list --count HEAD)" \
  36. "$(git rev-parse --short=7 HEAD)"
  37. }
  38. build() {
  39. cd "${_base_dir}"
  40. python -m build --wheel --skip-dependency-check --no-isolation
  41. }
  42. check() {
  43. cd "${_base_dir}"
  44. python -m venv --system-site-packages test-env
  45. test-env/bin/python -m installer dist/*.whl
  46. test-env/bin/python -m pytest
  47. }
  48. package() {
  49. cd "${_base_dir}"
  50. PYTHONPYCACHEPREFIX="${PWD}/.cache/cpython/" python -m installer --destdir="${pkgdir}" dist/*.whl --compile-bytecode 1
  51. install -Dm 644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}"
  52. }