From 50265f154b8e89bc39b6d6fba24e9e1b92424b8e Mon Sep 17 00:00:00 2001 From: John Eckersberg Date: Feb 02 2011 15:46:48 +0000 Subject: Add Python 3 support (bz674448) --- diff --git a/PyYAML.spec b/PyYAML.spec index c9dacea..319055c 100644 --- a/PyYAML.spec +++ b/PyYAML.spec @@ -1,10 +1,12 @@ +%if 0%{?fedora} > 12 || 0%{?rhel} > 6 +%global with_python3 1 +%else %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} - -#====================================================================# +%endif Name: PyYAML Version: 3.09 -Release: 6%{?dist} +Release: 7%{?dist} Summary: YAML parser and emitter for Python Group: Development/Libraries @@ -12,8 +14,11 @@ License: MIT URL: http://pyyaml.org/ Source0: http://pyyaml.org/download/pyyaml/%{name}-%{version}.tar.gz BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) - BuildRequires: python-devel, python-setuptools, libyaml-devel +%if 0%{?with_python3} +BuildRequires: python3-devel +BuildRequires: python3-setuptools +%endif %description YAML is a data serialization format designed for human readability and @@ -28,31 +33,78 @@ allow to represent an arbitrary Python object. PyYAML is applicable for a broad range of tasks from complex configuration files to object serialization and persistance. +%if 0%{?with_python3} +%package -n python3-PyYAML +Summary: YAML parser and emitter for Python +Group: Development/Libraries + +%description -n python3-PyYAML +YAML is a data serialization format designed for human readability and +interaction with scripting languages. PyYAML is a YAML parser and +emitter for Python. + +PyYAML features a complete YAML 1.1 parser, Unicode support, pickle +support, capable extension API, and sensible error messages. PyYAML +supports standard YAML tags and provides Python-specific tags that +allow to represent an arbitrary Python object. + +PyYAML is applicable for a broad range of tasks from complex +configuration files to object serialization and persistance. +%endif + + %prep %setup -q -n %{name}-%{version} chmod a-x examples/yaml-highlight/yaml_hl.py +%if 0%{?with_python3} +rm -rf %{py3dir} +cp -a . %{py3dir} +%endif + %build CFLAGS="${RPM_OPT_FLAGS}" %{__python} setup.py --with-libyaml build +%if 0%{?with_python3} +pushd %{py3dir} +CFLAGS="${RPM_OPT_FLAGS}" %{__python3} setup.py --with-libyaml build +popd +%endif + %install rm -rf %{buildroot} %{__python} setup.py install -O1 --skip-build --root %{buildroot} +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py install -O1 --skip-build --root %{buildroot} +popd +%endif + %clean rm -rf %{buildroot} %files -%defattr(-,root,root,-) +%defattr(644,root,root,755) %doc CHANGES LICENSE PKG-INFO README examples %{python_sitearch}/* +%if 0%{?with_python3} +%files -n python3-PyYAML +%defattr(644,root,root,755) +%doc CHANGES LICENSE PKG-INFO README examples +%{python3_sitearch}/* +%endif + %changelog +* Wed Feb 2 2011 John Eckersberg - 3.09-7 +- Add support to build for python 3 + * Tue Jul 27 2010 Mamoru Tasaka - 3.09-6 - Bump release number for upgrade path