File spyder.spec of Package spyder

#
# spec file for package python-spyder
#
# Copyright (c) 2012 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/
#


Name:           spyder
%define modname %{name}lib
Version:        2.1.10
Release:        0
Url:            http://spyderlib.googlecode.com
Summary:        Scientific PYthon Development EnviRonment
License:        MIT
Group:          Development/Languages/Python
Source:         http://%{modname}.googlecode.com/files/%{name}-%{version}.zip
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  fdupes
BuildRequires:  python-devel >= 2.5
BuildRequires:  python-qt4 > 4.4
BuildRequires:  python-pyflakes >= 0.5.0
BuildRequires:  python-rope => 0.9.2
BuildRequires:  python-Sphinx >= 0.6.0
BuildRequires:  python-numpy
BuildRequires:  python-scipy
BuildRequires:  python-matplotlib
BuildRequires:  python-pep8
BuildRequires:  python-psutil
BuildRequires:  python-pylint
BuildRequires:  IPython
BuildRequires:  unzip
%if 0%{?suse_version} <= 1210
BuildRequires:  update-desktop-files
%endif
Requires:       python  >= 2.5
Requires:       python-base = %{py_ver}
Requires:       python-qt4 > 4.4
Recommends:     python-pyflakes >= 0.5.0
Recommends:     python-rope >= 0.9.2
Recommends:     python-Sphinx >= 0.6.0
Recommends:     python-numpy
Recommends:     python-scipy
Recommends:     python-matplotlib
Recommends:     python-pep8
Recommends:     python-psutil
Recommends:     python-pylint
Recommends:     IPython
%if 0%{?suse_version} <= 1110
%{!?python_sitelib:  %global python_sitelib  %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%else
BuildArch:      noarch
%py_requires
%endif

%lang_package

%description
The spyderlib module provides powerful console and
editor related widgets to your PyQt4 application. It also includes a
Scientific Python development environment named 'Spyder', an alternative to
IDLE with powerful interactive features such as variable explorer (with
GUI-based editors for dictionaries, lists, NumPy arrays, etc.), object
inspector, online help, and a lot more.

%prep
%setup -q

%build
export CFLAGS="%{optflags}"
python setup.py build

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

# remove hidden file
rm %{buildroot}%{python_sitelib}/%{modname}/doc/.buildinfo

# fix permission
chmod +x %{buildroot}%{python_sitelib}/%{modname}/utils/external/pickleshare.py

# fix encoding
sed -i 's/\r//' %{buildroot}%{python_sitelib}/%{modname}/doc/_sources/{console,editor,explorer,findinfiles,historylog,index,inspector,internalconsole,lightmode,onlinehelp,options,overview,projectexplorer,pylint,variableexplorer}.txt

# create missing directories
mkdir -p %{buildroot}%{_datadir}/applications/
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/

# install the .desktop file
cp scripts/spyder.desktop %{buildroot}%{_datadir}/applications/

# add icon line to the .desktop file
sed -i '9 i Icon=spyder' %{buildroot}%{_datadir}/applications/spyder.desktop

# install the icon
pushd %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/
ln -s %{python_sitelib}/%{modname}/images/spyder.svg
popd

%find_lang %{modname}

%if 0%{?suse_version} <= 1210
%suse_update_desktop_file spyder
%endif

%fdupes %{buildroot}


%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%doc README
%{_bindir}/%{name}
%{_datadir}/applications/spyder.desktop
%{_datadir}/icons/hicolor/scalable/apps/spyder.svg
%{python_sitelib}/%{modname}/
%{python_sitelib}/spyderplugins/
%{python_sitelib}/%{name}-%{version}-py%{py_ver}.egg-info
%doc %{python_sitelib}/%{modname}/doc
%exclude %{python_sitelib}/%{modname}/locale/
%exclude %{python_sitelib}/spyderplugins/locale/

%files lang -f %{modname}.lang
%defattr(-,root,root)
%{python_sitelib}/%{modname}/locale

%changelog
openSUSE Build Service is sponsored by