You are not logged in.
Hi everyone.
I am updating this PKGBUILD
# Maintainer: Andres Alejandro Navarro Alsina <aanavarroa@unal.edu.co>
# Contributor: Tim Jenness
_pkgname=python-palpy
pkgbase=$_pkgname-git
pkgname=("$_pkgname-git" "python2-palpy-git")
pkgver=pypi.1.8.1.r0.a7ad770
pkgrel=1
pkgdesc=" PALpy is a python interface to the PAL positional astronomy library "
arch=('i686' 'x86_64')
url="https://github.com/Starlink/palpy"
license=('GPL')
checkdepends=('python' 'python2')
makedepends=('git' 'python' 'python2' 'cython' 'cython2' 'python-numpy' 'python2-numpy')
source=("${_pkgname}::git+${url}")
md5sums=('SKIP')
pkgver() {
cd $_pkgname
printf "%s" "$(git describe --long | sed 's/\([^-]*-\)g/r\1/;s/-/./g')"
}
prepare() {
cp -a $_pkgname{,-py2}
}
build() {
cd "$srcdir"/$_pkgname
git submodule init
git submodule update
python setup.py build
cd "$srcdir"/$_pkgname-py2
git submodule init
git submodule update
python2 setup.py build
}
check() {
cd "$srcdir"/$_pkgname
python -m unittest test_pal.py || warning 'Tests failed'
cd "$srcdir"/$_pkgname-py2
python2 -m unittest test_pal.py || warning 'Tests failed'
}
package_python-palpy-git() {
depends=('python')
cd "${_pkgname}"
python setup.py install --root=${pkgdir} --prefix=/usr --optimize=1
install -Dm644 COPYING $pkgdir/usr/share/licenses/$pkgname/LICENSE
}
package_python2-palpy-git() {
depends=('python2')
cd "${_pkgname}"
python2 setup.py install --root=${pkgdir} --prefix=/usr --optimize=1
install -Dm644 COPYING $pkgdir/usr/share/licenses/$pkgname/LICENSE
}
However I had to add warnings in the check() function since the test were not running.
It is complaining about the package himself. I mean this.
ImportError: Failed to import test module: test_pal
Traceback (most recent call last):
File "/usr/lib/python3.6/unittest/loader.py", line 153, in loadTestsFromName
module = __import__(module_name)
File "/data/packages/python-palpy-git/python-palpy-git/src/python-palpy/test_pal.py", line 21, in <module>
import palpy as pal
ModuleNotFoundError: No module named 'palpy'
Any idea about how to solve this issue, or should I just avoid the check() function. Of course, if you have other comments about the PKGBUILD as a whole, please tell me. I am beginning contribution to AUR so any comment would be great.
Thanks in advance
Last edited by andalenavals (2018-02-17 18:03:07)
Offline
Sounds like the test script needs to add the build directory to sys.path in order to gain access to the compiled extension.
Also why are you running unittest instead of just running the test script itself? It imports unittest and contains a suitable __main__ declaration anyway.
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Eschwartz, thanks for your answer.
Did you mean this?
check() {
cd "$srcdir"/$_pkgname
PYTHONPATH="$build/lib.linux-x86_64-3.6:$PYTHONPATH"
python test_pal.py || warning 'Tests failed'
cd "$srcdir"/$_pkgname-py2
PYTHONPATH="$build/lib.linux-x86_64-2.7:$PYTHONPATH"
python2 test_pal.py || warning 'Tests failed'
}
I tried that and it is still not working.
I would prefer not modify the test script, instead it will be better if I could add the build directory to sys.pat in other way.
could you guide me how?
Offline
or do you mean something like this
local python=$1
local pyver=$($python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
export PYTHONPATH="$pkgdir/usr/lib/python$pyver/site-packages"
mkdir -p "$PYTHONPATH"
in each package() function?
Offline