File python-cobyla.spec of Package python-cobyla

#
# spec file for package python-cobyla
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define modname cobyla
Name:           python-%{modname}
Version:        1.0.1
Release:        0
Summary:        An implementation of Powell's nonlinear optimization
License:        MIT
Group:          Development/Libraries/Python
Source0:        http://www.openmdao.org/dists/%{modname}-%{version}.tar.gz
Url:            http://www.openmdao.org
%if  0%{?suse_version} <= 1110
%{!?python_sitearch:  %global python_sitearch  %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif
Requires:       python-numpy
BuildRequires:  fdupes
BuildRequires:  python-numpy-devel
BuildRequires:  python-setuptools
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
COBYLA is an implementation of Powell's nonlinear derivative-free
constrained optimization that uses a linear approximation approach.
The algorithm is a sequential trust-region algorithm that employs
linear approximations to the objective and constraint functions,
where the approximations are formed by linear interpolation at n + 1
points in the space of the variables and tries to maintain a
regular-shaped simplex over iterations.

%prep
%setup -q -n %{modname}-%{version}

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}

# add minsing __init__.py to prevent import error
echo "import %{modname}" > %{buildroot}%{python_sitearch}/%{modname}/__init__.py

%fdupes %{buildroot}%{python_sitearch}

sed -i 's/\r$//' README
rm %{buildroot}%{python_sitearch}/{LICENSE,README}

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc LICENSE README
%{python_sitearch}/%{modname}
%{python_sitearch}/%{modname}-%{version}-py%{py_ver}.egg-info

%changelog
openSUSE Build Service is sponsored by