+#
+# Conditional build:
+%bcond_without python2 # CPython 2.x module
+%bcond_without python3 # CPython 3.x module
%define module pyparsing
-
Summary: pyparsing - a Python module for creating executing simple grammars
Summary(pl.UTF-8): pyparsing - moduł Pythona umożliwiający tworzenie i parsowanie prostych gramatyk
Name: python-%{module}
Version: 2.0.1
-Release: 1
+Release: 2
License: MIT
Group: Libraries/Python
Source0: http://downloads.sourceforge.net/pyparsing/%{module}-%{version}.tar.gz
# Source0-md5: 37adec94104b98591507218bc82e7c31
URL: http://pyparsing.sourceforge.net/
+%if %{with python2}
BuildRequires: python-devel >= 1:2.5
BuildRequires: python-modules
+%endif
+%if %{with python3}
+BuildRequires: python3-devel
+BuildRequires: python3-distribute
+BuildRequires: python3-modules
+%endif
BuildRequires: rpm-pythonprov
%pyrequires_eq python-libs
BuildArch: noarch
klas, przy pomocy których gramatyka tworzona jest wprost w kodzie
Pythona.
+%package -n python3-%{module}
+Summary: pyparsing - a Python3 module for creating executing simple grammars
+Summary(pl.UTF-8): pyparsing - moduł Pythona3 umożliwiający tworzenie i parsowanie prostych gramatyk
+Group: Libraries/Python
+
+%description -n python3-%{module}
+The parsing module is an alternative approach to creating and
+executing simple grammars, vs. the traditional lex/yacc approach, or
+the use of regular expressions. The parsing module provides a library
+of classes that client code uses to construct the grammar directly in
+Python code.
+
+%description -n python3-%{module} -l pl.UTF-8
+Moduł pyparsing umożliwia tworzenie i parsowanie prostych gramatyk w
+sposób odmienny od podejścia tradycyjnego, jakim jest zwykle użycie
+pary lex/yacc lub wyrażeń regularnych. Moduł ten udostępnia bibliotekę
+klas, przy pomocy których gramatyka tworzona jest wprost w kodzie
+Pythona.
+
%package doc
Summary: Documentation for pyparsing module
Summary(pl.UTF-8): Dokumentacja do modułu pyparsing
%setup -q -n %{module}-%{version}
%build
+rm -rf build-2 build-3
+install -d build-2 build-3
+%if %{with python2}
+cp -a [^b]* build-2
+cd build-2
%{__python} setup.py build_ext
+cd ..
+%endif
+
+%if %{with python3}
+cp -a [^b]* build-3
+cd build-3
+%{__python3} setup.py build_ext
+cd ..
+%endif
%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT{%{py_sitescriptdir},%{_examplesdir}/%{name}-%{version}}
-%{__python} setup.py install \
- --root=$RPM_BUILD_ROOT \
- --optimize=2
+%if %{with python2}
+cd build-2
+%{__python} setup.py \
+ install \
+ --optimize=2 \
+ --root=$RPM_BUILD_ROOT
%py_postclean
+cd ..
+%endif
+
+%if %{with python3}
+cd build-3
+%{__python3} setup.py \
+ install \
+ --optimize=2 \
+ --root=$RPM_BUILD_ROOT
+cd ..
+%endif
cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
%clean
rm -rf $RPM_BUILD_ROOT
+%if %{with python2}
%files
%defattr(644,root,root,755)
%doc CHANGES README
%{py_sitescriptdir}/pyparsing.py[co]
%{py_sitescriptdir}/pyparsing-*.egg-info
+%endif
+
+%if %{with python3}
+%files -n python3-%{module}
+%defattr(644,root,root,755)
+%doc CHANGES README
+%{py3_sitescriptdir}/pyparsing.py
+%{py3_sitescriptdir}/__pycache__/pyparsing*.py[co]
+%{py3_sitescriptdir}/pyparsing-*.egg-info
+%endif
%files doc
%defattr(644,root,root,755)