Blob Blame History Raw
%{!?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.1
Release:        11%{?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/

# Register as an application to be visible in the software center
#
# NOTE: It would be *awesome* if this file was maintained by the upstream
# project, translated and installed into the right place during `make install`.
#
# See http://www.freedesktop.org/software/appstream/docs/ for more details.
#
mkdir -p $RPM_BUILD_ROOT%{_datadir}/appdata
cat > $RPM_BUILD_ROOT%{_datadir}/appdata/%{name}.appdata.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 Ryan Lerch <rlerch@redhat.com> -->
<!--
BugReportURL: https://github.com/noamraph/dreampie/issues/49
SentUpstream: 2014-09-17
-->
<application>
  <id type="desktop">dreampie.desktop</id>
  <metadata_license>CC0-1.0</metadata_license>
  <summary>Interactive Python console</summary>
  <description>
    <p>
      dreampie is a graphical alternative for the Python interactive console. It provides a number of additional features that are not possible with the regular (terminal based) Python console, including: syntax highlighting, parameter lists for built in Python functions, and the ability to save code to a file.
    </p>
  </description>
  <url type="homepage">http://www.dreampie.org/</url>
  <screenshots>
    <screenshot type="default">https://raw.githubusercontent.com/hughsie/fedora-appstream/master/screenshots-extra/dreampie/a.png</screenshot>
  </screenshots>
  <!-- FIXME: change this to an upstream email address for spec updates
  <updatecontact>someone_who_cares@upstream_project.org</updatecontact>
   -->
</application>
EOF

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}/appdata/%{name}.appdata.xml
%{_datadir}/applications/%{name}.desktop
%{python_sitelib}/dreampielib
%{python_sitelib}/%{name}-*.egg-info

%files python3
%defattr(-,root,root,-)
%{_datadir}/%{name}/subp-py3

%changelog
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.1-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.1-10
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Thu Mar 26 2015 Richard Hughes <rhughes@redhat.com> - 1.1.1-8
- Add an AppData file for the software center

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 1.1.1-6
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Fri Aug 03 2012 David Malcolm <dmalcolm@redhat.com> - 1.1.1-3
- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3

* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Tue Feb 7 2012 Ionuț C. Arțăriși <mapleoin@fedoraproject.org> - 1.1.1-1
- upgrade to new upstream release

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* 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