File bpython.spec of Package bpython

#
# spec file for package bpython (Version 0.9.7.1)
#
# Copyright (c) 2010 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/
#

# norootforbuild

%{!?python_sitelib:  %global python_sitelib  %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}

Name:           bpython
Version:        0.9.7.1
Release:        1
Summary:        Fancy Curses Interface to the Python Interactive Interpreter
Source:         http://www.bpython-interpreter.org/releases/bpython-%{version}.tar.gz
Source1:        bpython.desktop
Source99:       rpmlintrc
Url:            http://www.bpython-interpreter.org/
Group:          Development/Languages/Python
License:        MIT/X Consortium License
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  python python-devel
%if 0%{?suse_version} > 1020
BuildRequires:  python-setuptools
%endif
BuildRequires:  update-desktop-files
Requires:       python-pygments python-parsing
%if 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif
%py_requires

%description
bpython is an enhanced Python interactive interpreter that uses curses
and provides the following main features: in-line syntax highlighting;
readline-like autocompletion with suggestions displayed as you type; expected
argument specification for functions; a handy pastebin function to quickly
submit your code and return a URL. Its goal is to bring together a few handy
ideas to enhance the standard interpreter without getting carried away.

%prep
%setup -q -n "bpython-%{version}"

%build
%__python ./setup.py build

%install
%__python ./setup.py install --prefix="%{_prefix}" --root="%{buildroot}" \
			 --record-rpm=files.lst

for f in keys cli; do
    if head -1 '%{buildroot}%{python_sitelib}/bpython'/"$f".py | grep -qE '^#!'; then
        %__sed -i '1d' '%{buildroot}%{python_sitelib}/bpython'/"$f".py
    fi
done

%__perl -n -i -e 'print $_ unless m,^(%dir\s+)?%{_datadir}/(applications|man),' files.lst

%__install -D -m0644 "%{SOURCE1}" "%{buildroot}%{_datadir}/applications/%{name}.desktop"
%suse_update_desktop_file -r "%{name}" Development IDE

%clean
%{?buildroot:%__rm -rf "%{buildroot}"}

%files -f files.lst
%defattr(-,root,root)
%doc CHANGELOG LICENSE README
%doc %{_mandir}/man1/bpython.1%{ext_man}
%doc %{_mandir}/man5/bpython-config.5%{ext_man}
%{_datadir}/applications/%{name}.desktop
%changelog
openSUSE Build Service is sponsored by