You are not logged in.

#1 2016-01-21 21:28:46

runical
Member
From: The Netherlands
Registered: 2012-03-03
Posts: 896

Making a PKGBUILD for octave_kernel

Dear all, I've been working on a PKGBUILD for the octave_kernel for use with Jupyter. It used to be trivial to make a PKGBUILD for this (basic python pkgbuild) , but the developer changed to flint and now distributes a 'whl'-file. Unfortunately, the PKGBUILD is no longer trivial, so I'd like to ask for some help from the gurus here.

So, what is the problem? The new wheel package has no setup.py to use, so the standard PKGBUILD no longer works. In search of another solution I have tried python-wheel, which refuses to deal with this package and pip, which kinda does its own thing when installing python software.

What I have arrived at:

_pkgname=octave_kernel
pkgname=python-$_pkgname
pkgver=0.15.3
pkgrel=1
pkgdesc="A Jupyter kernel for Octave"
arch=('any')
url="https://pypi.python.org/pypi/octave_kernel"
license=()
depends=('python-metakernel' 'octave' 'gnuplot')
makedepends=('python-pip')
options=(!emptydirs )
source=("https://pypi.python.org/packages/py2.py3/o/$_pkgname/$_pkgname-$pkgver-py2.py3-none-any.whl")
md5sums=('4be80f49eff2bd2533ec522f8643feee')
noextract=('$_pkgname-$pkgver-py2.py3-none-any.whl')

package() {
  pip install --no-deps -t $pkgdir/usr/lib/python3.5/site-packages/ $_pkgname
}

The problems with this approach are twofold. First, pip does not see the already downloaded archive and downloads it again. Secondly, the path where the files need to be is hardcoded in, which is bound to lead to trouble. (if the files are even in the right place in the first place)
If anyone can help me with the problem, I'd appreciate it. If more information is needed, I'm more than happy to provide it.

By the way, the pkgbuild for python-metakernel (a dependency) is the following, in case it is needed:

_pkgname=metakernel
pkgname=python-$_pkgname
pkgver=0.12.2
pkgrel=1
pkgdesc="A Jupyter/IPython kernel template which includes core magic functions"
arch=('any')
url="https://pypi.python.org/pypi/metakernel"
license=('BSD')
depends=('python' 'jupyter' )
makedepends=()
options=(!emptydirs)
source=("https://pypi.python.org/packages/source/m/metakernel/$_pkgname-$pkgver.tar.gz")
md5sums=('7ccd4cb4851c48dea35b95f600c8350d')

package() {
  cd "$srcdir/$_pkgname-$pkgver"
  python setup.py install --root="$pkgdir/" --optimize=1
}

Offline

#2 2016-01-22 00:32:01

metak
Member
Registered: 2009-09-27
Posts: 198

Re: Making a PKGBUILD for octave_kernel

Would changing the source to https://github.com/calysto/octave_kernel  help?

Offline

#3 2016-01-22 00:59:49

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Making a PKGBUILD for octave_kernel

1) Use the filename of the *.whl to install the wheel file instead of using pip to download it.

2) pip install has a --root option which is probably better. (Yes, just like setup.py would have...)

3) The contents of noextract cannot be single-quoted, it isn't expanding variables.

4) Always double-quote $pkgdir since you don't control the directory name.

Last edited by eschwartz (2016-01-22 01:10:23)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#4 2016-01-22 12:29:24

runical
Member
From: The Netherlands
Registered: 2012-03-03
Posts: 896

Re: Making a PKGBUILD for octave_kernel

@metak: I'd do that, but the dev no longer tags and releases the software on github.

@Eschwartz: Thanks for the tips. The package seems to work now. This is the PKGBUILD I arrived at:

_pkgname=octave_kernel
pkgname=python-$_pkgname
pkgver=0.15.3
pkgrel=1
pkgdesc="A Jupyter kernel for Octave"
arch=('any')
url="https://pypi.python.org/pypi/octave_kernel"
license=()
depends=('python-metakernel' 'octave' 'gnuplot')
makedepends=('python-pip')
options=(!emptydirs )
source=("https://pypi.python.org/packages/py2.py3/o/$_pkgname/$_pkgname-$pkgver-py2.py3-none-any.whl")
md5sums=('4be80f49eff2bd2533ec522f8643feee')
noextract=("$_pkgname-$pkgver-py2.py3-none-any.whl")

package() {
  pip install --compile --no-deps --root "$pkgdir" "$_pkgname-$pkgver-py2.py3-none-any.whl"
}

The --compile flag creates bytecode so pacman can track it and the --root flag was indeed what I was looking for. Any other ideas on how to make this better before I upload it to the AUR?

Offline

#5 2016-01-22 13:03:47

metak
Member
Registered: 2009-09-27
Posts: 198

Re: Making a PKGBUILD for octave_kernel

I was thinking about something like this maybe? (yes, there are no new tags but commit could be used?)

pkgver=0.15.3
_commit=e80efdba7e4bc512a434a1bd9c767c59fdc18d25
....
source=("git+https://github.com/Calysto/octave_kernel.git#commit=$_commit")
sha256sums=('SKIP')

Anyway, glad you made it work.

Offline

#6 2016-01-22 15:42:17

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Making a PKGBUILD for octave_kernel

The PKGBUILD works fine now, so all that is left is style nits.

Telling pip to --compile is redundant since it is already the default.
You should probably compile *optimized* bytecode manually, setuptools knows how to specify an optimization level for most python packages but for some reason pip does not have that ability.

!emptydirs is redundant, since there are no emptydirs to purge.
Anyway, unless the package fails to run when emptydirs are present, I say it isn't important to override the user's choice in makepkg.conf

No license listed.
It *seems* to be under the BSD, but according to Arch packaging standards that license is treated as a custom license, not a common one. However, upstream does not have a LICENSE file at (???),  only referencing the license in the "flit.ini" metadata file.
I have no idea what might or should be done, just something to think about...

md5 is kind of old and vulnerable. I always use sha256sums in new PKGBUILDs, because there is no reason not to except inertia.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB