%if 0%{?fedora} > 12
%global with_python3 1
%else
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
%endif
%global srcname ipdb
Name: python-ipdb
Version: 0.8
Release: 4%{?dist}
Summary: IPython enabled Python debugger
Group: Development/Debuggers
License: GPLv2
URL: https://github.com/gotcha/%{srcname}/
Source0: https://github.com/gotcha/%{srcname}/archive/%{version}.tar.gz
BuildArch: noarch
BuildRequires: python-setuptools
BuildRequires: python2-devel
BuildRequires: ipython >= 0.10
Requires: ipython >= 0.10
%description
IPython features (tab completion, syntax highlighting, better tracebacks,
better introspection) right in pdb.
%if 0%{?with_python3}
%package -n python3-ipdb
Summary: IPython enabled Python debugger
Group: Development/Debuggers
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-ipython
Requires: python3-ipython
%description -n python3-ipdb
IPython features (tab completion, syntax highlighting, better tracebacks,
better introspection) right in pdb.
%endif # with_python3
%prep
%setup -q -n %{srcname}-%{version}
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif # with_python3
find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'
%build
%{__python2} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3
%install
# Must do the python3 install first because the scripts in /usr/bin are
# overwritten with every setup.py install (and we want the python2 version
# to be the default for now).
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3
%{__python2} setup.py install --skip-build --root %{buildroot}
%check
%{__python2} setup.py test
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif # with_python3
%files
%doc COPYING.txt HISTORY.txt README.rst
%{python2_sitelib}/ipdb/
%{python2_sitelib}/ipdb-%{version}*.egg-info/
%{_bindir}/ipdb
%if 0%{?with_python3}
%files -n python3-ipdb
%doc COPYING.txt HISTORY.txt README.rst
%{python3_sitelib}/ipdb/
%{python3_sitelib}/ipdb-%{version}*.egg-info/
%{_bindir}/ipdb3
%endif # with_python3
%changelog
* Mon Nov 18 2013 Brian C. Lane <bcl@redhat.com> 0.8-4
- Add ipython as a BuildRequires so that check will work.
* Fri Nov 15 2013 Brian C. Lane <bcl@redhat.com> 0.8-3
- Move python3-ipython require inside the python3-ipdb subpackage.
* Wed Nov 13 2013 Brian C. Lane <bcl@redhat.com> 0.8-1
- Updated to 0.8 release
- Switch to github source
* Fri Mar 29 2013 Brian C. Lane <bcl@redhat.com> 0.7-4
- Updated source to pypi tarball
- Removed rhel python3 check
- Enabled Python3 support since there is now python3-ipython available
* Sun Dec 09 2012 Brian C. Lane <bcl@redhat.com> 0.7-1
- Updating to official 0.7 release
- Added COPYING.txt file
- Enabled check
* Sat Apr 21 2012 Brian C. Lane <bcl@redhat.com> 0.7-2.20120414git
- removed tabs from specfile
- more specific about files in sitelib
- added requires for python3-ipython (currently python3 is disabled)
- disabled check until a more useful test is available upstream
* Sat Apr 14 2012 Brian C. Lane <bcl@redhat.com> 0.7-1.20120414git
- Initial creation of python-ipdb from a git checkout of commit b42394ba