Blob Blame History Raw
%if 0%{?fedora} > 12 || 0%{?rhel} > 6
%global with_python3 1
%else
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
%endif

Name:          bpython
Summary:       Fancy curses interface to the Python interactive interpreter
Version:       0.10.1
Release:       2%{?dist}
URL:           http://www.bpython-interpreter.org/
Group:         Development/Libraries
License:       MIT
Source0:       http://www.bpython-interpreter.org/releases/bpython-%{version}.tar.gz
# some gimp resize of http://bpython-interpreter.org/static/img/bpython-logo.png
Source1:       bpython.png
Patch0:        bpython-0.9.7.1-desktop.patch
BuildArch:     noarch
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: desktop-file-utils
Requires:      pygtk2
Requires:      python-urwid
Requires:      python-pygments
BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%endif # if with_python3

%description
bpython is a fancy interface to the Python interpreter for Unix-like
operating systems. It has the following features:
 o in-line syntax highlighting
 o readline-like autocomplete with suggestions displayed as you type
 o expected parameter list for any Python function.
 o eewind function to pop the last line of code from memory and
   re-evaluate.
 o send the code you've entered off to a pastebin and display the
   pastebin URL for copying, etc.  
 o save the code you've entered to a file
 o auto indentation

%if 0%{?with_python3}
%package -n python3-bpython
Summary:       Fancy curses interface to the Python 3 interactive interpreter 
Group:         Development/Languages
Requires:      python3-pygments

%description -n python3-bpython
bpython is a fancy interface to the Python interpreter for Unix-like
operating systems. It has the following features:
 o in-line syntax highlighting
 o readline-like autocomplete with suggestions displayed as you type
 o expected parameter list for any Python function.
 o eewind function to pop the last line of code from memory and
   re-evaluate.
 o send the code you've entered off to a pastebin and display the
   pastebin URL for copying, etc.  
 o save the code you've entered to a file
 o auto indentation

This is the Python 3 build of bpython
%endif # if with_python3

%prep
%setup -q
%patch0 -p1
%{__sed} -i -e \
    "s|/usr/share/docs/bpython/examples on Debian|%{_docdir}/%{name}-%{version}/sample-config on Fedora/RHEL|g" doc/bpython.1
%{__sed} -i -e '1d' bpython/{cli,keys}.py

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
# 2to3 is done for us by the setup.py
%endif # with_python3

%build
%{__python} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3

%install
%{__rm} -rf %{buildroot}

# Install python 3 first, so that python 2 gets precedence:
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
# Give python 3 executables a "python3-" prefix to avoid collisions with their
# python 2 counterparts:
mv %{buildroot}/%{_bindir}/%{name} %{buildroot}/%{_bindir}/python3-%{name}
# Not support for gtk and urwid in Python 3 yet.
%{__rm} -f %{buildroot}%{_datadir}/applications/%{name}.desktop
%{__rm} -f %{buildroot}%{_bindir}/bpython-gtk
%{__rm} -f %{buildroot}%{_bindir}/bpython-urwid
popd
%endif # with_python3

%{__python} setup.py install -O1 --skip-build --root %{buildroot}
desktop-file-install --delete-original         \
   --dir %{buildroot}%{_datadir}/applications  \
   %{buildroot}%{_datadir}/applications/%{name}.desktop
%{__install} -D -p -m 0644 %{SOURCE1} %{buildroot}%{_datadir}/pixmaps/%{name}.png

%clean
%{__rm} -rf %{buildroot}

%files
%defattr(-, root, root, -)
%doc AUTHORS CHANGELOG LICENSE README ROADMAP TODO
%doc light.theme sample-config sample.theme doc
%{_bindir}/%{name}
%{_bindir}/%{name}-gtk
%{_bindir}/%{name}-urwid
%{python_sitelib}/%{name}*
%{python_sitelib}/bpdb
%{_mandir}/man1/%{name}.1*
%{_mandir}/man5/%{name}-config.5*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png

%if 0%{?with_python3}
%files -n python3-bpython
%defattr(-, root, root, -)
%doc AUTHORS CHANGELOG LICENSE README ROADMAP TODO
%doc light.theme sample-config sample.theme doc
%{_bindir}/python3-%{name}
%{python3_sitelib}/%{name}*
%{python3_sitelib}/bpdb
%endif # with_python3

%changelog
* Mon Oct 17 2011 Terje Rosten <terje.rosten@ntnu.no> - 0.10.1-2
- Add python-urwid to buildreq

* Mon Oct 17 2011 Terje Rosten <terje.rosten@ntnu.no> - 0.10.1-1
- 0.10.1

* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.7.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Thu Sep 02 2010 Terje Rosten <terje.rosten@ntnu.no> - 0.9.7.1-1
- 0.9.7.1

* Wed Aug 25 2010 Thomas Spura <tomspur@fedoraproject.org> - 0.9.6.2-7
- rebuild with python3.2
  http://lists.fedoraproject.org/pipermail/devel/2010-August/141368.html

* Wed Jul 21 2010 David Malcolm <dmalcolm@redhat.com> - 0.9.6.2-6
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* Sun May 30 2010 Terje Rosten <terje.rosten@ntnu.no> - 0.9.6.2-5
- Add patch to fix suspend

* Sun May 09 2010 Terje Rosten <terje.rosten@ntnu.no> - 0.9.6.2-4
- bpython don't use pyparsing

* Fri May 07 2010 David Malcolm <dmalcolm@redhat.com> - 0.9.6.2-3
- Add python3 subpackage (bz #590107)

* Sat Apr 09 2010 Terje Rosten <terje.rosten@ntnu.no> - 0.9.6.2-2
- Fix man page (bz #561800)

* Sat Apr 09 2010 Terje Rosten <terje.rosten@ntnu.no> - 0.9.6.2-1
- 0.9.6.2

* Thu Nov 05 2009 Terje Rosten <terje.rosten@ntnu.no> - 0.9.5.2-1
- 0.9.5.2

* Fri Jul 31 2009 Terje Rosten <terje.rosten@ntnu.no> - 0.9.4-1
- 0.9.4
- Update urls

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Mon May 18 2009 Terje Rosten <terje.rosten@ntnu.no> - 0.8.0-1
- 0.8.0

* Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Mon Jan  5 2009 Terje Rosten <terje.rosten@ntnu.no> - 0.7.1-2
- Add setuptools to buildreq

* Mon Jan  5 2009 Terje Rosten <terje.rosten@ntnu.no> - 0.7.1-1
- 0.7.1

* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 0.7.0-2
- Rebuild for Python 2.6

* Mon  Sep 1 2008 Terje Rosten <terje.rosten@ntnu.no> - 0.7.0-1
- 0.7.0

* Tue Aug 12 2008 Terje Rosten <terje.rosten@ntnu.no> - 0.6.3-1
- 0.6.3

* Mon May  5 2008 Terje Rosten <terje.rosten@ntnu.no> - 0.3.1-2
- fix summary
- remove desktop file and optflags

* Wed Apr 30 2008 Terje Rosten <terje.rosten@ntnu.no> - 0.3.1-1
- 0.3.1
- drop patch

* Sun Apr 27 2008 Terje Rosten <terje.rosten@ntnu.no> - 0.2.3-1
- random fixes

* Sun Apr 27 2008 Pascal Bleser <guru@unixtech.be> 0.2.3
- new package