Skip to content

Commit

Permalink
Add python3 guards
Browse files Browse the repository at this point in the history
- fix pip deps on EL7
- disable wheel build on EL7
  • Loading branch information
hguemar committed Aug 1, 2018
1 parent da481da commit cb3dc78
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions pyparsing.spec
@@ -1,7 +1,11 @@
%if 0%{?fedora}
%global with_python3 1
%endif

%global srcname pyparsing
%global sum Python package with an object-oriented approach to text processing

%global build_wheel 1
%global build_wheel 0

%global python2_wheelname %{srcname}-%{version}-py2.py3-none-any.whl
%global python3_wheelname %python2_wheelname
Expand All @@ -19,15 +23,19 @@ BuildArch: noarch
BuildRequires: dos2unix
BuildRequires: python2-devel
BuildRequires: python2-setuptools
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%endif

%if 0%{?build_wheel}
BuildRequires: python2-pip
BuildRequires: python2-wheel
%if 0%{?with_python3}
BuildRequires: python%{python3_pkgversion}-pip
BuildRequires: python%{python3_pkgversion}-wheel
%endif
%endif

%description
pyparsing is a module that can be used to easily and directly configure syntax
Expand All @@ -52,6 +60,7 @@ pyparsing is a module that can be used to easily and directly configure syntax
definitions for any number of text parsing applications.


%if 0%{?with_python3}
%package -n python3-pyparsing
Summary: %{sum}
%{?python_provide:%python_provide python3-%{srcname}}
Expand All @@ -61,6 +70,7 @@ pyparsing is a module that can be used to easily and directly configure syntax
definitions for any number of text parsing applications.

This is the Python 3 version.
%endif


%prep
Expand All @@ -75,37 +85,43 @@ dos2unix -k CHANGES LICENSE README
%else
%py2_build
%endif
%if 0%{?with_python3}
%if 0%{?build_wheel}
%py3_build_wheel
%else
%py3_build
%endif
%endif

%install
%if 0%{?build_wheel}
%py2_install_wheel %{python2_wheelname}
%else
%py2_install
%endif
%if 0%{?with_python3}
%if 0%{?build_wheel}
%py3_install_wheel %{python3_wheelname}
%else
%py3_install
%endif
%endif


%files -n python2-pyparsing
%license LICENSE
%doc CHANGES README
%{python2_sitelib}/pyparsing.py*
%{python2_sitelib}/pyparsing-*dist-info/
%{python2_sitelib}/pyparsing-*

%if 0%{?with_python3}
%files -n python3-pyparsing
%license LICENSE
%doc CHANGES README LICENSE
%{python3_sitelib}/pyparsing.py
%{python3_sitelib}/__pycache__/*
%{python3_sitelib}/pyparsing-*dist-info/
%{python3_sitelib}/pyparsing-*
%endif

%files doc
%license LICENSE
Expand Down

0 comments on commit cb3dc78

Please sign in to comment.