summaryrefslogtreecommitdiff
path: root/community/python-openbabel/PKGBUILD
blob: 53b156bacdb46229480a92b47c92052613223bce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# $Id: PKGBUILD 99971 2013-10-31 02:45:56Z allan $
# Maintainer: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Michal Bozon <bozonm@vscht.cz>

pkgname=('python-openbabel' 'python2-openbabel')
pkgver=2.3.2
pkgrel=2
pkgdesc='Python bindings for the openbabel library'
arch=('i686' 'x86_64' 'mips64el')
url='http://openbabel.org/wiki/Python'
license=('GPL')
depends=('gcc-libs' "openbabel=${pkgver}" 'eigen2')
makedepends=('swig' 'cmake' 'python-setuptools' 'python2-setuptools')
source=("http://downloads.sourceforge.net/openbabel/openbabel-$pkgver.tar.gz")
sha256sums=('4eaca26679aa6cc85ebf96af19191472ac63ca442c36b0427b369c3a25705188')

build() {
  cp -r openbabel-$pkgver python2-openbabel-$pkgver
  cd $srcdir/openbabel-$pkgver
  
  # Create babelconfig.h
  cmake .

  # Regenerate interface with the patched swig 2.0.2
  cd scripts
  swig -O -I../include/ -python -py3 -c++  openbabel-python.i
  mv openbabel-python_wrap.cxx python/openbabel-python.cpp
  mv openbabel.py python/

  cd python
  sed -i '19i os.path.join("/usr/include/openbabel-2.0"),' setup.py
  sed -i '20i os.path.join("/usr/include/eigen2"),' setup.py

  cd $srcdir/python2-openbabel-$pkgver/scripts/python
  sed -i '19i os.path.join("/usr/include/openbabel-2.0"),' setup.py
  sed -i '20i os.path.join("/usr/include/eigen2"),' setup.py
}

package_python-openbabel() {
  depends+=('python')

  cd "$srcdir/openbabel-$pkgver/scripts/python"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1
}

package_python2-openbabel() {
  depends+=('python2')

  cd "$srcdir/python2-openbabel-$pkgver/scripts/python"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1
}

# vim:set ts=2 sw=2 et: