Blob Blame History Raw
%global with_python3 1

Summary:       Debugger using ptrace written in Python
Name:          python-ptrace
Version:       0.6.6
Release:       6%{?dist}
License:       GPLv2
Group:         Development/Tools
URL:           https://bitbucket.org/haypo/python-ptrace
Source0:       http://pypi.python.org/packages/source/p/python-ptrace/%{name}-%{version}.tar.gz
Patch0:        python-ptrace-0.6.6-dict.patch
BuildRequires: python-devel
BuildRequires: python-tools
BuildRequires: python-setuptools
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%endif

%description
python-ptrace is a debugger using ptrace written in Python.
Features:
 o High level Python object API : PtraceDebugger and PtraceProcess
 o Able to control multiple processes: catch fork events on Linux
 o Read/write bytes to arbitrary address: take care of memory alignment
   and split bytes to cpu word
 o Execution step by step using ptrace_singlestep() 
   or hardware interruption 3
 o Dump registers, memory mappings, stack, etc.
 o Syscall tracer and parser (strace.py command) 
 o Can use distorm disassembler (if available)

%if 0%{?with_python3}
%package -n    python3-ptrace
Summary:       Debugger using ptrace written in Python 3
Group:         Development/Tools

%description -n python3-ptrace
python-ptrace is a debugger using ptrace written in Python.
Features:
 o High level Python object API : PtraceDebugger and PtraceProcess
 o Able to control multiple processes: catch fork events on Linux
 o Read/write bytes to arbitrary address: take care of memory alignment
   and split bytes to cpu word
 o Execution step by step using ptrace_singlestep() 
   or hardware interruption 3
 o Dump registers, memory mappings, stack, etc.
 o Syscall tracer and parser (strace.py command) 
 o Can use distorm disassembler (if available)

This is the Python 3 version of python-ptrace.

%endif # if with_python3

%prep
%setup -q
%patch0 -p1
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif

%build
%{__python2} setup.py build
%{__python2} setup_cptrace.py build
%if 0%{?with_python3}
pushd %{py3dir}
2to3 --write --nobackups .
%{__python3} setup.py build
%{__python3} setup_cptrace.py build
popd
mv %{py3dir}/examples examples-py3
%endif

%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
%{__python3} setup_cptrace.py install -O1 --skip-build --root %{buildroot}
for f in gdb strace ; do
    rm -f %{buildroot}%{_bindir}/$f.{pyo,pyc}
    mv %{buildroot}%{_bindir}/$f.py  %{buildroot}%{_bindir}/$f-python3.py 
done
popd
%endif

%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
%{__python2} setup_cptrace.py install -O1 --skip-build --root %{buildroot}
chmod 0644  examples/*.py
rm -f %{buildroot}%{_bindir}/{gdb,strace}.{pyo,pyc}


%check
%{__python} ./test_doc.py

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} ./test_doc.py
%endif

%files
%doc AUTHORS ChangeLog COPYING README README.cptrace TODO
%doc doc/* examples
%{_bindir}/gdb.py
%{_bindir}/strace.py
%{python_sitelib}/ptrace/
%{python_sitelib}/python_ptrace-*-py*.egg-info
%{python_sitearch}/cptrace.so
%{python_sitearch}/cptrace-*-py*.egg-info

%if 0%{?with_python3}
%files -n python3-ptrace
%doc AUTHORS ChangeLog COPYING README README.cptrace TODO
%doc doc/* examples-py3
%{_bindir}/gdb-python3.py
%{_bindir}/strace-python3.py
%{python3_sitelib}/ptrace/
%{python3_sitelib}/python_ptrace-*-py*.egg-info
%{python3_sitearch}/cptrace.cpython-*.so
%{python3_sitearch}/cptrace-*-py*.egg-info
%endif

%changelog
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.6-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Mon Jun 30 2014 Toshio Kuratomi <toshio@fedoraproject.org> - 0.6.6-5
- Replace python-setuptools-devel BR with python-setuptools

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

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

* Mon Jan 20 2014 Terje Rosten <terje.rosten@ntnu.no> - 0.6.6-2
- Patch still needed

* Mon Jan 20 2014 Terje Rosten <terje.rosten@ntnu.no> - 0.6.6-1
- 0.6.6

* Sun Oct 27 2013 Terje Rosten <terje.rosten@ntnu.no> - 0.6.5-1
- 0.6.5

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Wed Dec 05 2012 Terje Rosten <terje.rosten@ntnu.no> - 0.6.4-2
- Add patch to build with Python 3.3

* Wed Dec 05 2012 Terje Rosten <terje.rosten@ntnu.no> - 0.6.4-1
- 0.6.4
- Add python 3 subpackage

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

* Wed Feb 01 2012 Terje Rosten <terje.rosten@ntnu.no> - 0.6.3-1
- 0.6.3

* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Fri Feb 11 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 0.6.2-2
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* Sat Dec 05 2009 Terje Rosten <terje.rosten@ntnu.no> - 0.6.2-1
- 0.6.2

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Sun Mar  8 2009 Terje Rosten <terje.rosten@ntnu.no> - 0.6-4
- Build with all rpm versions

* Sun Mar  8 2009 Terje Rosten <terje.rosten@ntnu.no> - 0.6-3
- Remove %%exclude

* Thu Mar  5 2009 Terje Rosten <terje.rosten@ntnu.no> - 0.6-2
- switch to %%global, fix files listing, remove comments

* Wed Mar  4 2009 Terje Rosten <terje.rosten@ntnu.no> - 0.6-1
- 0.6

* Sat Sep 13 2008 Terje Rosten <terje.rosten@ntnu.no> - 0.5-1
- 0.5