[python-svgwrite] Initial import of python-svgwrite (#1070941).

Julien Enselme jujens at fedoraproject.org
Mon Mar 17 15:45:30 UTC 2014


commit ddcdb601bc1b1bc8765c2392c612357ff2b1cd97
Author: Julien Enselme <jujens at jujens.eu>
Date:   Mon Mar 17 16:42:06 2014 +0100

    Initial import of python-svgwrite (#1070941).

 .gitignore                            |    1 +
 python-svgwrite-1.1.3-pyparsing.patch |   59 +++++++++++++++++++
 python-svgwrite.spec                  |  101 +++++++++++++++++++++++++++++++++
 sources                               |    1 +
 4 files changed, 162 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..b3bd988 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/svgwrite-1.1.3.tar.gz
diff --git a/python-svgwrite-1.1.3-pyparsing.patch b/python-svgwrite-1.1.3-pyparsing.patch
new file mode 100644
index 0000000..c490d1d
--- /dev/null
+++ b/python-svgwrite-1.1.3-pyparsing.patch
@@ -0,0 +1,59 @@
+--- a/setup.py	Fri Jan 24 05:51:12 2014 +0100
++++ b/setup.py	Thu Mar 13 16:10:15 2014 +0100
+@@ -35,6 +35,7 @@
+     author_email=AUTHOR_EMAIL,
+     packages=['svgwrite', 'svgwrite/data'],
+     provides=['svgwrite'],
++    requires=['pyparsing'],
+     script_args=args,
+     long_description=read('README.TXT')+read('NEWS.TXT'),
+     platforms="OS Independent",
+--- a/svgwrite/data/svgparser.py Fri Jan 24 05:51:12 2014 +0100
++++ b/svgwrite/data/svgparser.py Thu Mar 13 16:10:15 2014 +0100
+@@ -10,12 +10,8 @@
+ __all__ = ["is_valid_transferlist", "is_valid_pathdata", "is_valid_animation_timing"]
+
+ import sys
+-PYTHON3 = sys.version_info[0] > 2
+-if PYTHON3:
+-    from svgwrite.data.pyparsing_py3 import *
+-else:
+-    from svgwrite.data.pyparsing_py2 import *
+
++from pyparsing import *
+ from functools import partial
+
+ event_names = [
+--- a/tests/test_clock_val_parser.py	Thu Mar 13 16:10:15 2014 +0100
++++ b/tests/test_clock_val_parser.py	Fri Mar 14 00:07:38 2014 +0100
+@@ -8,13 +8,7 @@
+ 
+ import sys
+ import unittest
+-
+-PYTHON3 = sys.version_info[0] > 2
+-
+-if PYTHON3:
+-    import svgwrite.data.pyparsing_py3 as pp
+-else:
+-    import svgwrite.data.pyparsing_py2 as pp
++import pyparsing as pp
+ 
+ from svgwrite.data.svgparser import build_clock_val_parser
+ from svgwrite.data.svgparser import build_wall_clock_val_parser
+--- a/tests/test_parsing_basic_types.py	Thu Mar 13 16:10:15 2014 +0100
++++ b/tests/test_parsing_basic_types.py	Fri Mar 14 00:07:38 2014 +0100
+@@ -8,12 +8,7 @@
+ 
+ import sys
+ import unittest
+-PYTHON3 = sys.version_info[0] > 2
+-
+-if PYTHON3:
+-    import svgwrite.data.pyparsing_py3 as pp
+-else:
+-    import svgwrite.data.pyparsing_py2 as pp
++import pyparsing as pp
+ 
+ from svgwrite.data.svgparser import exponent, fractional_constant, \
+      scientific_constant, number
diff --git a/python-svgwrite.spec b/python-svgwrite.spec
new file mode 100644
index 0000000..453ac54
--- /dev/null
+++ b/python-svgwrite.spec
@@ -0,0 +1,101 @@
+Name:           python-svgwrite
+Version:        1.1.3
+Release:        4%{?dist}
+Summary:        Python 2 library to create SVG drawings
+
+License:        MIT
+URL:            https://bitbucket.org/mozman/svgwrite
+Source0:        https://bitbucket.org/mozman/svgwrite/downloads/svgwrite-%{version}.tar.gz
+Patch0:         %{name}-%{version}-pyparsing.patch
+
+BuildArch:      noarch
+BuildRequires:  python2-devel pyparsing
+Requires:       pyparsing
+
+%description
+Python 2 library to create SVG drawings.
+
+%package -n     python3-svgwrite
+Summary:        Python 3 library to create SVG drawings
+BuildRequires:  python3-devel python3-pyparsing
+Requires:       python3-pyparsing
+
+%description -n python3-svgwrite
+Python 3 library to create SVG drawings.
+
+%prep
+%setup -q -n svgwrite-%{version}
+# Convert line endings to unix before applying patch
+sed $'s/\r$//' svgwrite/data/svgparser.py > tmp &&
+mv tmp svgwrite/data/svgparser.py
+sed $'s/\r$//' tests/test_clock_val_parser.py > tmp &&
+mv tmp tests/test_clock_val_parser.py
+sed $'s/\r$//' tests/test_parsing_basic_types.py > tmp &&
+mv tmp tests/test_parsing_basic_types.py
+%patch0 -p1
+# pyparsing is an bunble library
+rm svgwrite/data/pyparsing_py{2,3}.py
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+
+%build
+pushd %{py3dir}
+%{__python3} setup.py build
+popd
+
+%{__python2} setup.py build
+
+
+%install
+pushd %{py3dir}
+%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+popd
+# Remove shebang
+for lib in $RPM_BUILD_ROOT%{python3_sitelib}/svgwrite/{,*/}/*.py; do
+ sed '1{\@^#!/usr/bin/env python at d}' $lib > $lib.new &&
+ touch -r $lib $lib.new &&
+ mv $lib.new $lib
+done
+
+%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+
+# Remove shebang
+for lib in $RPM_BUILD_ROOT%{python2_sitelib}/svgwrite/{,*/}/*.py; do
+ sed '1{\@^#!/usr/bin/env python at d}' $lib > $lib.new &&
+ touch -r $lib $lib.new &&
+ mv $lib.new $lib
+done
+
+
+%check
+pushd %{py3dir}
+%{__python3} -m unittest discover -s tests
+popd
+
+%{__python2} -m unittest discover -s tests
+
+
+%files
+%doc LICENSE.TXT NEWS.TXT README.TXT
+%{python2_sitelib}/svgwrite-%{version}-py%{python2_version}.egg-info
+%{python2_sitelib}/svgwrite/
+
+%files -n python3-svgwrite
+%doc LICENSE.TXT NEWS.TXT README.TXT
+%{python3_sitelib}/svgwrite-%{version}-py%{python3_version}.egg-info
+%{python3_sitelib}/svgwrite/
+
+%changelog
+* Fri Mar 14 2014 Julien Enselme <jujens at jujens.eu> - 1.1.3-4
+- Add pyparsing and python3-pyparsing as requires
+- Patch sources so that this bundled library is not used
+
+* Wed Mar 12 2014 Julien Enselme <jujens at jujens.eu> - 1.1.3-3
+- Add check macro for unitests
+
+* Fri Feb 28 2014 Julien Enselme <jujens at jujens.eu> - 1.1.3-2
+- Add python3 support
+- Improve packaging
+
+* Sun Feb 09 2014 Julien Enselme <jujens at jujens.eu> - 1.1.3-1
+- Initial packaging
diff --git a/sources b/sources
index e69de29..43a119e 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+01adbeae1d75741f515058120f761120  svgwrite-1.1.3.tar.gz


More information about the scm-commits mailing list