[python-sqlparse] Add python3 package
Honza Horak
hhorak at fedoraproject.org
Mon May 12 12:03:25 UTC 2014
commit 5887cf0cd35fbe4b602ba666980d4f1e84da1b97
Author: Honza Horak <hhorak at redhat.com>
Date: Mon May 12 14:03:07 2014 +0200
Add python3 package
python-sqlparse.spec | 97 +++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 88 insertions(+), 9 deletions(-)
---
diff --git a/python-sqlparse.spec b/python-sqlparse.spec
index fd62527..965f605 100644
--- a/python-sqlparse.spec
+++ b/python-sqlparse.spec
@@ -1,10 +1,26 @@
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+%if 0%{?el6}%{?el7}
+ # python3 and python version related macros
+ # required to build python3- subpackage
+ # are not available in el6 and epel7
+ %global __python2 %{__python}
+ %global python2_sitelib %{python_sitelib}
+ %bcond_with python3
+%else
+ %bcond_without python3
+%endif
+
+# tests need internet connection, see similar case here:
+# https://bugzilla.redhat.com/show_bug.cgi?id=864464#c15
+# To build with tests, run rpmbuild --with tests -ba <spec>
+%bcond_with tests
+
%global shortname sqlparse
Name: python-%{shortname}
Version: 0.1.11
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Non-validating SQL parser for Python
Group: Development/Languages
@@ -14,10 +30,26 @@ Source0: https://github.com/andialbrecht/%{shortname}/archive/%{version}/
BuildArch: noarch
BuildRequires: python2-devel
-BuildRequires: python3-devel
BuildRequires: python-tools
+BuildRequires: python-setuptools
+BuildRequires: python-py
+%if 0%{?with_python3}
+BuildRequires: python3-devel
BuildRequires: python3-tools
+BuildRequires: python3-setuptools
+BuildRequires: python3-py
+%endif # with_python3
+
+%if 0%{?with_tests}
+BuildRequires: pytest
+BuildRequires: python-pytest-cov
BuildRequires: python-tox
+BuildRequires: python-virtualenv
+%if 0%{?with_python3}
+BuildRequires: python3-pytest
+BuildRequires: python3-pytest-cov
+%endif # with_python3
+%endif # with_tests
%description
sqlparse is a tool for parsing SQL strings. It can generate pretty-printed
@@ -25,27 +57,74 @@ renderings of SQL in various formats.
It is a python module, together with a command-line tool.
+%if 0%{?with_python3}
+%package -n python3-%{shortname}
+Summary: Non-validating SQL parser for Python
+Group: Development/Languages
+
+%description -n python3-%{shortname}
+sqlparse is a tool for parsing SQL strings. It can generate pretty-printed
+renderings of SQL in various formats.
+
+It is a python module, together with a command-line tool.
+%endif
+
+
%prep
%setup -q -n %{shortname}-%{version}
+%if 0%{?with_python3}
+cp -a . %{py3dir}
+%endif # with_python3
+
%build
-%{__python} setup.py build
+%{__python2} setup.py build
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py build
+popd
+%endif # with_python3
+
%install
-rm -rf $RPM_BUILD_ROOT
-%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+%{__python2} setup.py install --skip-build --root %{buildroot}
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py install --skip-build --root %{buildroot}
+popd
+%endif # with_python3
+
+%if 0%{?with_tests}
%check
-tox -e py27,py33
-
+tox -e py27
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+tox -e py33
+popd
+%endif # with_python3
+%endif # with_tests
+
%files
-%doc AUTHORS CHANGES COPYING README.rst TODO
+%doc AUTHORS CHANGES COPYING README.rst
%{_bindir}/sqlformat
-%{python_sitelib}/*
+%{python2_sitelib}/*
+%if 0%{?with_python3}
+%files -n python3-%{shortname}
+%doc AUTHORS CHANGES COPYING README.rst
+%{_bindir}/sqlformat
+%{python3_sitelib}/*
+%endif # with_python3
%changelog
+* Mon May 12 2014 Honza Horak <hhorak at redhat.com> - 0.1.11-2
+- Add python3 package
+
* Mon May 12 2014 Honza Horak <hhorak at redhat.com> - 0.1.11-1
- Rebase to 0.1.11
- Change the upstream URL
More information about the scm-commits
mailing list