# sitelib for noarch packages, sitearch for others (remove the unneeded one) %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} Name: pycallgraph Version: 0.3.1 Release: 1%{?dist} Summary: Python library that creates call graphs for Python programs. Group: Development/Languages License: GPL URL: http://pycallgraph.slowchop.com/ Source0: http://pycallgraph.slowchop.com/files/download/%{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: python-devel Requires: graphviz-python %description Just before your first line of code you want to graph, put in the following code: import pycallgraph pycallgraph.start_trace() To stop the trace and generate the graph, put in the following code (usually at the end of your program): pycallgraph.make_dot_graph('test.png') The default is to output in png with with the dot tool. You can change them by specifying arguments: pycallgraph.make_dot_graph('test.jpg', format='jpg', tool='neato') %prep %setup -q %build # Remove CFLAGS=... for noarch packages (unneeded) CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build %install rm -rf $RPM_BUILD_ROOT %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %doc COPYING examples/*.py # For noarch packages: sitelib %{python_sitelib}/* # For arch-specific packages: sitearch #%{python_sitearch}/* %changelog