From 4e01fe7c8cefa3032f6fac136af78957fc8da0cf Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 23 Feb 2018 10:02:01 +0100 Subject: python2-lmfit -> python-lmfit --- python-lmfit/PKGBUILD | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ python-lmfit/test.patch | 30 +++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 python-lmfit/PKGBUILD create mode 100644 python-lmfit/test.patch (limited to 'python-lmfit') diff --git a/python-lmfit/PKGBUILD b/python-lmfit/PKGBUILD new file mode 100644 index 00000000..54f41a40 --- /dev/null +++ b/python-lmfit/PKGBUILD @@ -0,0 +1,60 @@ +# Contributor: Francois Boulogne +# Maintainer: Erich Eckner + +pkgbase=python-lmfit +pkgname=('python-lmfit' 'python2-lmfit') +pkgver=0.9.8 +pkgrel=1 +pkgdesc="Least-Squares Minimization with Constraints for Python" +arch=('any') +url="http://lmfit.github.io/lmfit-py/" +license=('BSD') +_depends=('python' 'python-numpy' 'python-scipy') +makedepends=( + "${_depends[@]}" "${_depends[@]/python/python2}" + 'python-setuptools' 'python2-setuptools' + ) +checkdepends=( + 'python-nose' 'python2-nose' + ) +source=("https://github.com/lmfit/lmfit-py/archive/${pkgver}.tar.gz" + 'test.patch') +sha512sums=('2a73acf1d2b700a5641f5393e079d56f7f43d3160a48fe0bce9beafbec0cce5e7954c4e2d343aadba1f832c0c816466f7be8ea94dab19a4a8ad82279419f1c68' + '779bbd1d71d7e15ce740fb3bdfaffb044912e1c2bc790732f9be101af2771c00ca00d21defd10fafd98694f42ffcaacff29e856060b27be1877a329a8a4449c7') + +prepare() { + cd "${srcdir}/lmfit-py-${pkgver}" + patch -p1 -i "${srcdir}/test.patch" + cd "${srcdir}" + cp -a "lmfit-py-${pkgver}" "lmfit-py2-${pkgver}" +} + +build() { + cd "$srcdir/lmfit-py-$pkgver" + python setup.py build + + cd "$srcdir/lmfit-py2-$pkgver" + python2 setup.py build +} + +check() { + cd "$srcdir/lmfit-py-$pkgver" + nosetests3 tests + + cd "$srcdir/lmfit-py2-$pkgver" + nosetests2 tests +} + +package_python-lmfit(){ + depends=("${_depends[@]}") + cd "$srcdir/lmfit-py-$pkgver" + python setup.py install --root="$pkgdir/" --optimize=1 +} + +package_python2-lmfit(){ + depends=("${_depends[@]/python/python2}") + cd "$srcdir/lmfit-py2-$pkgver" + python2 setup.py install --root="$pkgdir/" --optimize=1 +} + +# vim:ts=2:sw=2:et: diff --git a/python-lmfit/test.patch b/python-lmfit/test.patch new file mode 100644 index 00000000..603fc870 --- /dev/null +++ b/python-lmfit/test.patch @@ -0,0 +1,30 @@ +--- a/tests/test_saveload.py 2018-02-11 15:08:45.000000000 +0100 ++++ b/tests/test_saveload.py 2018-02-23 09:41:17.335712453 +0100 +@@ -14,7 +14,7 @@ + except ImportError: + DILL_AVAILABLE = False + +-dat = np.loadtxt(os.path.join('..', 'examples', 'NIST_Gauss2.dat')) ++dat = np.loadtxt(os.path.join(os.path.dirname(__file__), '..', 'examples', 'NIST_Gauss2.dat')) + XDAT = dat[:, 1] + YDAT = dat[:, 0] + +--- a/tests/test_height_fwhm.py 2018-02-11 15:08:45.000000000 +0100 ++++ b/tests/test_height_fwhm.py 2018-02-23 09:41:41.030806931 +0100 +@@ -8,6 +8,7 @@ + from scipy.optimize import fsolve + import sys + ++import os + + # Turn off plotting if run by nosetests. + WITHPLOT = True +@@ -76,7 +76,7 @@ + # sigma = np.sqrt(variance) + # x = np.linspace(mu - 20*sigma, mu + 20*sigma, 100.0) + # y = norm.pdf(x, mu, 1) +- data = np.loadtxt('../examples/test_peak.dat') ++ data = np.loadtxt(os.path.join(os.path.dirname(__file__), '..', 'examples', 'test_peak.dat')) + x = data[:, 0] + y = data[:, 1] + check_height_fwhm(x, y, lineshapes.voigt, models.VoigtModel()) -- cgit v1.2.3-54-g00ecf