Date: Wednesday, April 12, 2023 @ 14:20:53
  Author: dvzrv
Revision: 1444894

upgpkg: python-pycuda 2022.2.2-2: Rebuild to cleanup package.

Remove unnecessary quotes and curly braces.
Consolidate dependencies.
Switch to PEP517.
Provide custom build config to build against system boost.

Modified:
  python-pycuda/trunk/PKGBUILD

----------+
 PKGBUILD |  100 ++++++++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 73 insertions(+), 27 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2023-04-12 14:14:22 UTC (rev 1444893)
+++ PKGBUILD    2023-04-12 14:20:53 UTC (rev 1444894)
@@ -1,39 +1,85 @@
-# Maintainer: Felix Yan <[email protected]>
+# Maintainer:
+# Contributor: Felix Yan <[email protected]>
 # Contributor: Stéphane Gaudreault <[email protected]>
 
+_name=pycuda
 pkgname=python-pycuda
 pkgver=2022.2.2
-pkgrel=1
+pkgrel=2
 pkgdesc="Python wrapper for Nvidia CUDA"
-arch=('x86_64')
-url="https://mathema.tician.de/software/pycuda";
-license=('MIT' 'Apache')
-depends=('boost-libs' 'cuda' 'nvidia-utils' 'python' 'python-numpy' 
'python-pytools')
-provides=('pycuda-headers')
-conflicts=('pycuda-headers')
-replaces=('pycuda-headers')
-source=("https://pypi.io/packages/source/p/pycuda/pycuda-$pkgver.tar.gz";)
-makedepends=('ctags' 'python-setuptools' 'python-numpy' 'mesa' 'cuda' 'boost' 
'nvidia-utils')
+arch=(x86_64)
+url="https://documen.tician.de/pycuda/";
+license=(
+  Apache
+  MIT
+)
+depends=(
+  boost-libs
+  cuda
+  gcc-libs
+  glibc
+  nvidia-utils
+  python
+  python-numpy
+  python-pytools
+)
+makedepends=(
+  boost
+  ctags
+  mesa
+  python-build
+  python-installer
+  python-setuptools
+  python-wheel
+)
+checkdepends=(
+  python-pytest
+)
+provides=(pycuda-headers)
+conflicts=(pycuda-headers)
+replaces=(pycuda-headers)
+source=(https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz)
 
sha512sums=('c62aafe473e44339ac2147d86b51fc9bc2429310450b6d99e78a127828cc3a42dc74f20e1bdf8261f6652aed6d07ee3a871ce371f89f33fbcc4014f551af0b96')
+b2sums=('d60e83ac2faa183e0fa022c3d901c9d97ec2f9a59195425b9d71467c24b154d48d5735223220b41aa58b0898800d382d9ead54166d0a59db9c2a777e03e574be')
 
-build() {
-   _arch=''
-   [[ "$CARCH" = "x86_64" ]] && _arch='64'
+prepare() {
+  local lib_arch=''
+  [[ "$CARCH" = "x86_64" ]] && lib_arch='64'
 
-   cd pycuda-$pkgver
-   python ./configure.py \
-                  --cuda-root=/opt/cuda \
-                  --cuda-inc-dir=/opt/cuda/include \
-                  --cudadrv-lib-dir=/opt/cuda/lib${_arch} \
-                  --cudart-lib-dir=/opt/cuda/lib${_arch} \
-                  --no-use-shipped-boost \
-                  --boost-python-libname=boost_python3
-   make
+  # create local siteconf.py for build system
+  # defaults can be compared from running the ./configure.py script
+  {
+    printf "BOOST_PYTHON_LIBNAME = ['boost_python3']\n"
+    printf "CUDA_ROOT = '/opt/cuda'\n"
+    printf "USE_SHIPPED_BOOST = False\n"
+  } > $_name-$pkgver/siteconf.py
+
+  # we ship python-numpy
+  sed -e 's/oldest-supported-numpy/numpy/' -i $_name-$pkgver/pyproject.toml
 }
 
+build() {
+  cd $_name-$pkgver
+  python -m build --wheel --no-isolation
+}
+
+# requires an Nvidia graphics card to run
+# check() {
+#   local pytest_options=(
+#     -vv
+#     --ignore examples/from-wiki/simple_speed_test.py
+#   )
+#   local site_packages=$(python -c "import site; 
print(site.getsitepackages()[0])")
+
+#   cd $_name-$pkgver
+#   # install to temporary location, as importlib is used
+#   python -m installer --destdir=test_dir dist/*.whl
+#   export PYTHONPATH="test_dir/$site_packages:$PYTHONPATH"
+#   pytest "${pytest_options[@]}"
+# }
+
 package() {
-   cd pycuda-$pkgver
-   python setup.py install --prefix=/usr --root="$pkgdir" --skip-build 
--optimize=1
-
-   install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
+  cd $_name-$pkgver
+  python -m installer --destdir="$pkgdir" dist/*.whl
+  install -vDm 644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
 }

Reply via email to