[python-reportlab] Update to 3.1.8 Pretty awesome hack for the ghostscript path ; )

Christopher Meng cicku at fedoraproject.org
Thu Apr 24 10:30:51 UTC 2014


commit 09fec3e0e5642e3ecd9f9e99be55ce87f197f0bd
Author: Christopher Meng <i at cicku.me>
Date:   Thu Apr 24 18:29:51 2014 +0800

    Update to 3.1.8
    Pretty awesome hack for the ghostscript path ;)

 .gitignore                           |    2 +
 python-reportlab.spec                |  119 ++++++++++++++++++++--------------
 reportlab-3.1.8-font-locations.patch |   28 ++++++++
 sources                              |    2 +-
 4 files changed, 101 insertions(+), 50 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index cd5e0f7..b7f6ef8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
 ReportLab_2_3.tar.gz
 /reportlab-2.5.tar.gz
+/reportlab-2.7.tar.gz
+/reportlab-3.1.8.tar.gz
diff --git a/python-reportlab.spec b/python-reportlab.spec
index e395341..9aab3c5 100644
--- a/python-reportlab.spec
+++ b/python-reportlab.spec
@@ -1,75 +1,96 @@
-%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
-
-Name:       python-reportlab
-Version:    2.5
-Release:    8%{?dist}
-Summary:    Python PDF generation library
-
-Group:      Development/Libraries
-License:    BSD
-URL:        http://www.reportlab.org/
-Source0:    http://www.reportlab.org/ftp/reportlab-%{version}.tar.gz
-Patch0:     reportlab-%{version}-font-locations.patch
-
-BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
-BuildRequires: python-devel, python-imaging, freetype-devel
-Requires:   dejavu-sans-fonts
-Requires:   python-imaging
+%global cmapdir %(echo `rpm -qls ghostscript | grep CMap | awk '{print $2}'`)
+
+Name:           python-reportlab
+Version:        3.1.8
+Release:        1%{?dist}
+Summary:        Python 2.x library for generating PDFs and graphics
+License:        BSD
+URL:            http://www.reportlab.org/
+Source0:        https://pypi.python.org/packages/source/r/reportlab/reportlab-%{version}.tar.gz
+Patch0:         reportlab-3.1.8-font-locations.patch
+BuildRequires:  freetype-devel
+# For query the version of gs only.
+BuildRequires:  ghostscript
+BuildRequires:  python2-devel
+BuildRequires:  python-pillow
+Requires:       dejavu-sans-fonts
+Requires:       python-pillow
 
 %description
-Python PDF generation library.
-
-
-%package docs
-Summary:    Documentation files for %{name}
-Group:        Documentation
-Requires:    %{name} = %{version}-%{release}
-
-
-%description docs
+This is the ReportLab PDF Toolkit. It allows rapid creation of rich PDF 
+documents, and also creation of charts in a variety of bitmap and vector 
+formats.
+
+%package -n     python3-reportlab
+Summary:        Python 3.x library for generating PDFs and graphics
+BuildRequires:  python3-devel
+BuildRequires:  python3-pillow
+Requires:       dejavu-sans-fonts
+Requires:       python3-pillow
+
+%description -n python3-reportlab
+This is the ReportLab PDF Toolkit. It allows rapid creation of rich PDF 
+documents, and also creation of charts in a variety of bitmap and vector 
+formats.
+
+%package        doc
+Summary:        Documentation for %{name}
+BuildArch:      noarch
+Requires:       %{name} = %{version}-%{release}
+Obsoletes:      %{name}-docs < %{version}-%{release}
+
+%description    doc                  
 Contains the documentation for ReportLab.
 
-
 %prep
-%setup -q -n reportlab-%{version}
+%setup -qn reportlab-%{version}
 %patch0 -p1 -b .fonts
 # clean up hashbangs from libraries
 find src -name '*.py' | xargs sed -i -e '/^#!\//d'
-
+# patch the CMap path by adding Fedora ghostscript path before the match
+sed -i '/\~\/\.local\/share\/fonts\/CMap/i''\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ '\'%{cmapdir}\''\,' src/reportlab/rl_settings.py
+rm -rf %{py3dir}
+cp -a . %{py3dir}
 
 %build
-CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
+CFLAGS="%{optflags}" %{__python2} setup.py build
+pushd %{py3dir}
+CFLAGS="%{optflags}" %{__python3} setup.py build
+popd
 # a bit of a horrible hack due to a chicken-and-egg problem. The docs
 # require reportlab, which isn't yet installed, but is at least built.
-PYTHONPATH="`pwd`/`ls -d build/lib*`" %{__python} docs/genAll.py
-
+PYTHONPATH="`pwd`/`ls -d build/lib*`" %{__python2} docs/genAll.py
 
 %install
-rm -rf $RPM_BUILD_ROOT
-%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+%{__python2} setup.py install --prefix=%{_prefix} -O1 --skip-build --root %{buildroot}
+pushd %{py3dir}
+%{__python3} setup.py install --prefix=%{_prefix} -O1 --skip-build --root=%{buildroot}
+popd
 # Remove bundled fonts
-rm -rf $RPM_BUILD_ROOT%{python_sitearch}/reportlab/fonts
-
-
-%clean
-rm -rf $RPM_BUILD_ROOT
+rm -rf %{buildroot}%{python2_sitearch}/reportlab/fonts
 
+%check
+#%{__python2} setup.py tests
 
 %files
-%defattr(-,root,root,-)
 %doc README.txt CHANGES.txt LICENSE.txt
-%{python_sitearch}/reportlab
-%{python_sitearch}/reportlab*.egg-info
-%{python_sitearch}/*.so
-
+%{python2_sitearch}/reportlab/
+%{python2_sitearch}/reportlab-%{version}-py%{python2_version}.egg-info
 
-%files docs
-%defattr(-,root,root,-)
-%doc docs/*.pdf demos tools LICENSE.txt
+%files -n python3-reportlab
+%doc README.txt CHANGES.txt LICENSE.txt
+%{python3_sitearch}/reportlab/
+%{python3_sitearch}/reportlab-%{version}-py%{python3_version}.egg-info
 
+%files doc
+%doc demos/ tools/
+#%doc docs/*.pdf
 
 %changelog
+* Tue Apr 22 2014 Christopher Meng <rpm at cicku.me> - 3.1.8-1
+- Update to 3.1.8
+- Documentation package should be -doc instead of -docs.
+
 * Sun Aug 04 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.5-8
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
 
diff --git a/reportlab-3.1.8-font-locations.patch b/reportlab-3.1.8-font-locations.patch
new file mode 100644
index 0000000..b926424
--- /dev/null
+++ b/reportlab-3.1.8-font-locations.patch
@@ -0,0 +1,28 @@
+# HG changeset patch
+# User Christopher Meng <cickumqt at gmail.com>
+# Date 1398311299 0
+# Branch cicku/rl_settingspy-edited-adding-paths-on-fed-1398311278921
+# Node ID 78b616440f922f507747d9db90b927b912f40f0b
+# Parent  4df3c1696c1beee18f8233ce1dfe39f1f7c03391
+rl_settings.py edited, adding paths on Fedora
+
+diff --git a/src/reportlab/rl_settings.py b/src/reportlab/rl_settings.py
+--- a/src/reportlab/rl_settings.py
++++ b/src/reportlab/rl_settings.py
+@@ -114,6 +114,7 @@
+                 '/usr/local/Acrobat6/Resource/Font',    #Linux, Acrobat 5?
+                 '/usr/local/Acrobat5/Resource/Font',    #Linux, Acrobat 5?
+                 '/usr/local/Acrobat4/Resource/Font',    #Linux, Acrobat 4
++                '/usr/share/fonts/default/Type1'        #Linux, Fedora
+                 '%(REPORTLAB_DIR)s/fonts',              #special
+                 '%(REPORTLAB_DIR)s/../fonts',           #special
+                 '%(REPORTLAB_DIR)s/../../fonts',        #special
+@@ -130,6 +131,8 @@
+                 'c:/windows/fonts',
+                 '/usr/lib/X11/fonts/TrueType/',
+                 '/usr/share/fonts/truetype',
++                '/usr/share/fonts'              #Linux, Fedora
++                '/usr/share/fonts/dejavu'       #Linux, Fedora
+                 '%(REPORTLAB_DIR)s/fonts',      #special
+                 '%(REPORTLAB_DIR)s/../fonts',   #special
+                 '%(REPORTLAB_DIR)s/../../fonts',#special
diff --git a/sources b/sources
index 8ca38ff..301d471 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-cdf8b87a6cf1501de1b0a8d341a217d3  reportlab-2.5.tar.gz
+820a9fda647078503597b85cdba7ed7f  reportlab-3.1.8.tar.gz


More information about the scm-commits mailing list