%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
# Turn off the brp-python-bytecompile script
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
# get python3 version
%global py3_ver 0
%{?__python3: %global py3_ver %(%{__python3} -c "import sys;
sys.stdout.write(sys.version[:3])")}
Name: dreampie
Version: 1.1
Release: 8%{?dist}
Summary: A graphical cross-platform interactive Python shell
Group: Development/Tools
License: GPLv3+ and LGPLv2+ and BSD and Python and Copyright only
# dreampielib/gui/SimpleGladeApp.py is LGPLv2+
# dreampielib/gui/odict.py is BSD
# dreampielib/gui/subprocess_interact.py is Python
# dreampielib/gui/gtkexcepthook.py is Copyright only
# everything else is GPLv3+.
URL: http://dreampie.sourceforge.net/
Source0: http://launchpad.net/%{name}/trunk/%{version}/+download/%{name}-%{version}.tar.gz
Source1: dreampie.README.Fedora
Patch1: dreampie-1.1-setdefaultencoding.patch
BuildRequires: python2-devel
BuildRequires: python3-devel
BuildRequires: desktop-file-utils
BuildArch: noarch
Requires: pygtksourceview
Requires: pygtk2
Requires: pygtk2-libglade
%description
DreamPie was designed from the ground up for an interactive Python
experience. It features a window divided into a history box and a code box,
automatic completion, automatic display of function arguments and
documentation, a result history that can be saved as HTML, automatic folding
of long outputs, etc.
%package python3
Summary: Support for running the python3 interpreter from %{name}
Group: Development/Tools
License: GPLv3+
Requires: %{name} = %{version}-%{release}
Requires: python(abi) = %{py3_ver}
%description python3
This package provides the files needed to run the python3 interpreter from
within %{name}.
%prep
%setup -q
# fix bug with python3.2 where setdefaultencoding no longer exists
# this bug has already been fixed upstream, so it can be removed after 1.1
# https://bugs.launchpad.net/dreampie/+bug/716377
%patch1 -b .setdefaultencoding
cp %{SOURCE1} ./README.Fedora
%build
%{__python} setup.py build
%install
rm -rf %{buildroot}
%{__python} setup.py install --skip-build --root %{buildroot}
%py_byte_compile %{__python} %{buildroot}%{_datadir}/%{name}/*py
%py_byte_compile %{__python} %{buildroot}%{_datadir}/%{name}/subp-py2/
%py_byte_compile %{__python3} %{buildroot}%{_datadir}/%{name}/subp-py3/
%py_byte_compile %{__python} %{buildroot}%{python_sitelib}/%{name}lib/
desktop-file-validate \
%{buildroot}%{_datadir}/applications/%{name}.desktop
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc COPYING LICENSE-PSF README README.Fedora
%{_bindir}/%{name}
%{_datadir}/%{name}/
%exclude %{_datadir}/%{name}/subp-py3
%{_mandir}/man?/%{name}.*
%{_datadir}/pixmaps/%{name}*
%{_datadir}/applications/%{name}.desktop
%{python_sitelib}/dreampielib
%{python_sitelib}/%{name}-*.egg-info
%files python3
%defattr(-,root,root,-)
%{_datadir}/%{name}/subp-py3
%changelog
* Tue Jun 14 2011 Ionuț C. Arțăriși <mapleoin@fedoraproject.org> - 1.1-8
- fixed #712703 - dreampie not working with python 3.2
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Wed Oct 20 2010 Thomas Spura <tomspur@fedoraproject.org> - 1.1-6
- rebuild for python 3.2
* Thu Sep 23 2010 Ionuț C. Arțăriși <mapleoin@fedoraproject.org> - 1.1-5
- fixed script to set py3 version
* Wed Sep 15 2010 Ionuț C. Arțăriși <mapleoin@fedoraproject.org> - 1.1-4
- added license tag to python3 subpackage
- readded upstream README
- set py3 version at buildtime
* Tue Sep 7 2010 Ionuț C. Arțăriși <mapleoin@fedoraproject.org> - 1.1-3
- deleted BuildRoot
- rephrased subpackage summary
- added README.Fedora and removed upstream's README
- fixed subpackage python requires
- own %%{_datadir}/%%{name}
- py_zipimport has been removed by upstream along with it's APL license
- other cosmetic improvements
* Sun Sep 5 2010 Ionuț C. Arțăriși <mapleoin@fedoraproject.org> - 1.1-2
- renamed python3-dreampie subpackage to dreampie-python3
* Sat Sep 4 2010 Ionuț C. Arțăriși <mapleoin@fedoraproject.org> - 1.1-1
- new upstream release
- byte-compile files in python_sitelib
* Wed Jul 7 2010 Ionuț C. Arțăriși <mapleoin@fedoraproject.org> - 1.0.3-1
- new upstream version
- build separate py3 package
- byte-compile py2 and py3 files manually
* Thu Mar 11 2010 Ionuț C. Arțăriși <mapleoin@fedoraproject.org> - 1.0.2-2
- changed group to Development/Tools
- marked manpages as %%doc
- added pygtk2-libglade dependency
- added more license fields: BSD, ASL, Python and Copyright only
* Wed Mar 3 2010 Ionuț C. Arțăriși <mapleoin@fedoraproject.org> - 1.0.2-1
- fixed spelling error in description
- don't make subp_main.py executable
- don't pass cflags to build command
- use global instead of define macros
- changed license field to GPLv3+ and LGPLv2+
- updated to 1.0.2
* Mon Feb 22 2010 Ionuț C. Arțăriși <mapleoin@fedoraproject.org> - 1.0-1
- initial package