[rootplot] Import bug #608332

stevetraylen stevetraylen at fedoraproject.org
Tue Nov 23 16:14:20 UTC 2010


commit 741d26854301162d8470f2513310666176f3fdc2
Author: Steve Traylen <steve.traylen at cern.ch>
Date:   Tue Nov 23 17:12:23 2010 +0100

    Import bug #608332

 .gitignore                |    1 +
 first.py                  |   20 +++++++++++
 rootplot-rm-shbangs.patch |   16 +++++++++
 rootplot.spec             |   82 +++++++++++++++++++++++++++++++++++++++++++++
 sources                   |    1 +
 5 files changed, 120 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..f599c87 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/rootplot-2.2.1.tar.gz
diff --git a/first.py b/first.py
new file mode 100644
index 0000000..376fa5a
--- /dev/null
+++ b/first.py
@@ -0,0 +1,20 @@
+import rootplot.root2matplotlib as r2m
+import ROOT
+from matplotlib import pyplot as plt
+from random import gauss
+
+th1f = ROOT.TH1F("hpx", "Distribution of p_{x};p_{x};Events", 40, -4, 4)
+for i in range(25000):
+    th1f.Fill(gauss(0., 1.))
+
+# Make a figure with width 6 inches and height 4 inches
+plt.figure(1, (8, 6))
+# Create an axes instance
+ax1 = plt.axes()
+hist = r2m.Hist(th1f)
+# Plot a bar chart in red
+hist.bar(color='r')
+hist.show_titles()
+
+plt.savefig('first')
+plt.show()
diff --git a/rootplot-rm-shbangs.patch b/rootplot-rm-shbangs.patch
new file mode 100644
index 0000000..6fb7a7a
--- /dev/null
+++ b/rootplot-rm-shbangs.patch
@@ -0,0 +1,16 @@
+diff -uNr rootplot-2.2.1.ORIG/lib/rootplot/rootinfo.py rootplot-2.2.1/lib/rootplot/rootinfo.py
+--- rootplot-2.2.1.ORIG/lib/rootplot/rootinfo.py	2010-11-19 22:18:09.045845110 +0100
++++ rootplot-2.2.1/lib/rootplot/rootinfo.py	2010-11-19 22:18:49.609592074 +0100
+@@ -1,4 +1,3 @@
+-#!/usr/bin/env python
+ '''
+ Get information about contents of a ROOT file.
+ '''
+diff -uNr rootplot-2.2.1.ORIG/lib/rootplot/tree2hists.py rootplot-2.2.1/lib/rootplot/tree2hists.py
+--- rootplot-2.2.1.ORIG/lib/rootplot/tree2hists.py	2010-11-19 22:18:09.043842495 +0100
++++ rootplot-2.2.1/lib/rootplot/tree2hists.py	2010-11-19 22:18:56.844591024 +0100
+@@ -1,4 +1,3 @@
+-#!/usr/bin/env python
+ """
+ Create ROOT Histograms from one or more ROOT TTrees or TNtuples.
+ 
diff --git a/rootplot.spec b/rootplot.spec
new file mode 100644
index 0000000..f7e7b03
--- /dev/null
+++ b/rootplot.spec
@@ -0,0 +1,82 @@
+%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5)
+%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
+%endif
+
+Name:           rootplot
+Version:        2.2.1
+Release:        2%{?dist}
+Summary:        Plots ROOT data with matplotlib
+
+Group:          Development/Languages
+License:        MIT
+URL:            http://packages.python.org/rootplot/
+Source0:        http://pypi.python.org/packages/source/r/rootplot/rootplot-%{version}.tar.gz
+# Just a trivial example script to be included as a doc.
+Source1:        http://packages.python.org/rootplot/plot_directive/pyplots/first.py
+
+# Removes some #!/usr/bin/env python from some python libs.
+Patch0:         rootplot-rm-shbangs.patch
+
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildArch:      noarch
+BuildRequires:  python-devel
+BuildRequires:  python-setuptools
+BuildRequires:  root-python
+
+Requires:       numpy
+Requires:       python-matplotlib
+Requires:       root-python
+
+%description
+ROOT is a powerful data analysis tool within the particle physics community,
+and the primary lens through which we see our data. The framework includes
+quite a bit of graphical capabilities, but producing high-quality graphics
+output was not the first priority in designing its capabilities 
+or its interface.
+
+It becomes useful, then, to consider using an outside library 
+focused on graphics for producing final plots. The pyROOT 
+interface to ROOT makes it easy to have ROOT objects interact with 
+other python modules. The goal of rootplot is to enable easy 
+plotting of ROOT histograms using the full-featured and mature 
+matplotlib library.
+
+%prep
+%setup -q
+cp -p %{SOURCE1} .
+%patch0 -p1
+
+%build
+%{__python} setup.py build
+
+%install
+rm -rf %{buildroot}
+%{__python} setup.py install -O1 --skip-build --root %{buildroot}
+ 
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+%doc README.txt first.py
+%{python_sitelib}/rootplot-%{version}-*
+%{python_sitelib}/rootplot/
+%{_bindir}/rootplot
+%{_bindir}/tree2hists
+%{_bindir}/rootinfo
+%{_bindir}/rootplotmpl
+
+%changelog
+* Fri Nov 19 2010 Steve Traylen <steve.traylen at cern.ch> - 2.2.1-2
+- Minor changes for Fedora review process.
+- Include first.py as an example script.
+
+* Fri Nov 19 2010 Steve Traylen <steve.traylen at cern.ch> - 2.2.1-1
+- New upstream 2.2.1
+- Add two new commands, rootinfo and rootplotmpl.
+
+* Sun Jun 6 2010 Steve Traylen <steve.traylen at cern.ch> - 1.1-1
+- Initial build
+
+
diff --git a/sources b/sources
index e69de29..1e106a3 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+28719ca5a29e6f63194fa4cda0fdc6d6  rootplot-2.2.1.tar.gz


More information about the scm-commits mailing list