Blob Blame History Raw
%global pname Pympler

%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif

%global desc \
Pympler is a development tool to measure, monitor and analyze the memory\
behavior of Python objects in a running Python application.\
\
By pympling a Python application, detailed insight in the size and the lifetime\
of Python objects can be obtained. Undesirable or unexpected runtime behavior\
like memory bloat and other “pymples” can easily be identified.\
\
Pympler integrates three previously separate modules into a single,\
comprehensive profiling tool. The asizeof module provides basic size information\
for one or several Python objects, module muppy is used for on-line monitoring\
of a Python application and module Class Tracker provides off-line analysis of\
the lifetime of selected Python objects.

Name: python-%{pname}
Version: 0.4.3
Release: 3%{?dist}
Summary: Measure, monitor and analyze the memory behavior of Python objects
License: ASL 2.0 and BSD and MIT
# bundled stuff
# pympler/asizeof.py: BSD
# pympler/static/jquery.sparkline.min.js: BSD
# pympler/util/bottle.py: MIT
URL: http://pythonhosted.org/Pympler/
Source0: https://pypi.python.org/packages/source/P/%{pname}/%{pname}-%{version}.tar.gz
# disable the failing test for now: https://github.com/pympler/pympler/issues/22
Patch0: %{name}-issue22.patch
# use system bottle
Patch1: %{name}-use-system-bottle.patch
# drop python shebang from asizeof.py
Patch2: %{name}-no-shebang.patch
BuildArch: noarch
BuildRequires: npm(Flot)

%description
%{desc}

%package -n python2-%{pname}
Summary: %{summary}
BuildRequires: python-bottle
BuildRequires: python2-devel
BuildRequires: python2-matplotlib
BuildRequires: python2-setuptools
Requires: npm(Flot)
Requires: python-bottle
# http://bottlepy.org/
# https://github.com/krzysu/flot.tooltip
Provides: bundled(nodejs-flot-tooltip) = 0.8.4
# http://omnipotent.net/jquery.sparkline/
Provides: bundled(nodejs-flot-sparkline) = 2.1.1
# required by charts.py, but doesn't throw an exception without
Recommends: python2-matplotlib
# pympler/panels.py is an extension for django-debug-toolbar
Enhances: python3-django-debug-toolbar

%description -n python2-%{pname}
%{desc}

%package -n python3-%{pname}
Summary: %{summary}
BuildRequires: python3-bottle
BuildRequires: python3-devel
BuildRequires: python3-matplotlib
BuildRequires: python3-setuptools
Requires: npm(Flot)
Requires: python3-bottle
# http://bottlepy.org/
# https://github.com/krzysu/flot.tooltip
Provides: bundled(js-jquery-flot-tooltip) = 0.8.4
# http://omnipotent.net/jquery.sparkline/
Provides: bundled(js-jquery-sparkline) = 2.1.1
# required by pympler/charts.py, but doesn't throw an exception without
Recommends: python3-matplotlib
# pympler/panels.py is an extension for django-debug-toolbar
Enhances: python3-django-debug-toolbar

%description -n python3-%{pname}
%{desc}

%prep
%setup -q -n %{pname}-%{version}
%patch0 -p1 -b .issue22
%patch1 -p1 -b .bottle
rm pympler/util/bottle.py
%patch2 -p1 -b .no-shebang

%build
%py2_build
%py3_build

%install
%py2_install
%py3_install

# use system nodejs-flot
for f in jquery.flot{,.stack}.min.js ; do
    for p in %{python2_sitelib} %{python3_sitelib} ; do
        rm %{buildroot}/$p/pympler/templates/$f
        ln -s /usr/lib/node_modules/flot/$f %{buildroot}/$p/pympler/templates/
    done
done

%check
PYTHONPATH=%{buildroot}%{python2_sitelib} %{__python2} setup.py test
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} setup.py test

%files -n python2-%{pname}
%license LICENSE
%doc NOTICE README.md
%{python2_sitelib}/%{pname}-%{version}-py2.?.egg-info
%{python2_sitelib}/pympler

%files -n python3-%{pname}
%license LICENSE
%doc NOTICE README.md
%{python3_sitelib}/%{pname}-%{version}-py3.?.egg-info
%{python3_sitelib}/pympler

%changelog
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.3-3
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Fri Jun 10 2016 Dominik Mierzejewski <rpm@greysector.net> 0.4.3-2
- drop CC-BY-SA-NC from license list and fix typo
- actually unbundle nodejs-flot
- add a weak dep for python{2,3}-django-debug-toolbar
- drop python shebang from asizeof.py

* Mon May 16 2016 Dominik Mierzejewski <rpm@greysector.net> 0.4.3-1
- update to 0.4.3
- build for python3 as well
- unbundle python-bottle

* Sun Aug 09 2015 Dominik Mierzejewski <rpm@greysector.net> 0.4.2-1
- initial build