Blog of Sara Jakša

My First AUR PKGBUILD file

When I decided to use the Tumblr as at source of data for my school project, I was looking for some sort of Python wrapper for Tumblr API.

Thankfully, there there was one already written for Python2. I might prefer Python3, but I am not about to complain. There was one problem. I am using Arch Linux, but I could not find this package either in the 'usual' repositories, nor in AUR.

I am aware there I could be installing the packages with the pip. But I remember the mess that I eventually created when I was using Ruby. Some packages were installed though pacman, some through gems, and on the end it was hard to know what did I had on my computer. So with Python, I have been clearly staying to installing through pacman only.

The one thing that I did was simply look at the three other PKGBUILS files to try and figure out what to do. For explanation of the variable in the first part of the file, the Arch Linux documentation was helpful. For the actually building the package, not that much. In that case, I was copying and editing the lines from other PKGBUILT files.

I had some troubles, until I eventually managed to get it installed. And only then did I realize that I can't use it, because it requires the python oauth2 package. I am glad that I managed to find out what was wrong that quickly. On the other side, I already have quite a couple of python packages installed on the computer and I would not know if any of them are also dependencies.

I don't let it bother me much, as right now it is working.

I also tried to [upload it to the AUR], but the rules that they reference on the first page are not something I want to deal with. So I am only publishing my PKGBUILD here.

    # Maintainer: Sara Jakša <sarajaksa@gmail.com>

    pkgname=python2-pytumblr
    pkgver=0.0.6.r114.dfae962
    pkgrel=1
    pkgdesc="Python wrapper for Tumblr API"
    arch=('any')
    url="https://github.com/tumblr/pytumblr"
    depends=('python2' 'python2-oauth2')
    makedepends=('python2-setuptools' 'git')
    source=("pytumblr::git+https://github.com/tumblr/pytumblr")
    sha256sums=('SKIP')


    pkgver() {
        cd "${srcdir}/pytumblr"
        printf "%s.r%s.%s" "$(python setup.py --version)" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
    }

    package() {
        cd "${srcdir}/pytumblr"
        python2 setup.py install --root="${pkgdir}/"
    }

I will most likely figure out the whole AUR quality rules one day. When I will actually have the time or needed it more.