diff --git a/PyYAML.spec b/PyYAML.spec index 7d77c12..850352d 100644 --- a/PyYAML.spec +++ b/PyYAML.spec @@ -1,3 +1,6 @@ +# Prepared for Python 2 removal +%bcond_without python2 + Name: PyYAML Version: 5.1.2 Release: 3%{?dist} @@ -11,8 +14,10 @@ Source0: https://github.com/yaml/pyyaml/archive/%{name}-%{uversion}.tar.g BuildRequires: gcc BuildRequires: libyaml-devel +%if %{with python2} BuildRequires: python2-devel BuildRequires: python2-setuptools +%endif BuildRequires: python3-devel BuildRequires: python3-setuptools @@ -35,6 +40,7 @@ configuration files to object serialization and persistence. %description %_description +%if %{with python2} %package -n python2-pyyaml Summary: %summary Provides: python-yaml = %{version}-%{release} @@ -44,7 +50,7 @@ Provides: python2-yaml%{?_isa} = %{version}-%{release} %{?python_provide:%python_provide python2-pyyaml} %description -n python2-pyyaml %_description - +%endif %package -n python3-pyyaml Summary: %summary @@ -70,24 +76,32 @@ rm -rf ext/_yaml.c %build %py3_build +%if %{with python2} # py2_build reuses Cython output from py3_build %py2_build +%endif %install +%if %{with python2} %py2_install +%endif %py3_install %check +%if %{with python2} %{__python2} setup.py test +%endif %{__python3} setup.py test +%if %{with python2} %files -n python2-pyyaml %license LICENSE %doc CHANGES README examples %{python2_sitearch}/* +%endif %files -n python3-pyyaml %license LICENSE