File python-pyOpt.spec of Package python-pyOpt

#
# spec file for package python-pyOpt
#
# 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 pyOpt
Name:           python-%{modname}
Version:        1.1.0
Release:        0
Summary:        A package for solving nonlinear constrained optimization problems
License:        LGPL-3.0
Group:          Development/Libraries/Python
Source0:        http://www.pyopt.org/_downloads/%{modname}-%{version}.tar.gz
Url:            http://www.pyopt.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
BuildRequires:  swig
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
pyOpt is a Python-based package for formulating and solving nonlinear
constrained optimization problems in an efficient, reusable and portable
manner.

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

%build
python setup.py build

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

# remove shebang
sed -i -e '/^#!\//, 1d' %{buildroot}%{python_sitearch}/%{modname}/*/*.py
sed -i -e '/^#!\//, 1d' %{buildroot}%{python_sitearch}/%{modname}/*.py

# fix wrong end of line
sed -i 's/\r$//' CHANGES

# remove RPM_BUILD_ROOT in some .pyc fimes
pushd %{buildroot}%{python_sitearch}/%{modname}
%py_compile .
popd

%fdupes -s %{buildroot}%{python_sitearch}

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

%changelog
openSUSE Build Service is sponsored by