%if 0%{?fedora} > 12 || 0%{?rhel} > 6 %global with_python3 1 %endif %global modname xmltodict Name: python-xmltodict Version: 0.4.1 Release: 1%{?dist} Summary: Makes working with XML feel like you are working with JSON Group: Development/Libraries License: MIT URL: http://pypi.python.org/pypi/xmltodict Source0: http://pypi.python.org/packages/source/x/%{modname}/%{modname}-%{version}.tar.gz BuildArch: noarch BuildRequires: python2-devel %if 0%{?with_python3} BuildRequires: python3-devel %endif %description xmltodict is a Python module that makes working with XML feel like you are working with JSON. It's very fast (Expat-based) and has a streaming mode with a small memory footprint, suitable for big XML dumps like Discogs or Wikipedia. >>> doc = xmltodict.parse(""" ... ... ... elements ... more elements ... ... ... element as well ... ... ... """) >>> >>> doc['mydocument']['@has'] u'an attribute' >>> doc['mydocument']['and']['many'] [u'elements', u'more elements'] >>> doc['mydocument']['plus']['@a'] u'complex' >>> doc['mydocument']['plus']['#text'] u'element as well' %if 0%{?with_python3} %package -n python3-xmltodict Summary: Makes working with XML feel like you are working with JSON Group: Development/Libraries %description -n python3-xmltodict xmltodict is a Python module that makes working with XML feel like you are working with JSON. It's very fast (Expat-based) and has a streaming mode with a small memory footprint, suitable for big XML dumps like Discogs or Wikipedia. >>> doc = xmltodict.parse(""" ... ... ... elements ... more elements ... ... ... element as well ... ... ... """) >>> >>> doc['mydocument']['@has'] u'an attribute' >>> doc['mydocument']['and']['many'] [u'elements', u'more elements'] >>> doc['mydocument']['plus']['@a'] u'complex' >>> doc['mydocument']['plus']['#text'] u'element as well' %endif %prep %setup -q -n %{modname}-%{version} # Remove bundled egg-info in case it exists rm -rf %{modname}.egg-info %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} %endif %build %{__python} setup.py build %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py build popd %endif %install %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install -O1 --skip-build --root=%{buildroot} popd %endif %{__python} setup.py install -O1 --skip-build --root=%{buildroot} %check # No tests yet. We'll run them some day with nosetests # https://github.com/martinblech/xmltodict/pull/11 %files # Some day we'll be able to include the README and LICENSE. # https://github.com/martinblech/xmltodict/pull/11 %doc PKG-INFO %{python_sitelib}/%{modname}.py* %{python_sitelib}/%{modname}-%{version}* %if 0%{?with_python3} %files -n python3-xmltodict # Some day we'll be able to include the README and LICENSE. # https://github.com/martinblech/xmltodict/pull/11 %doc PKG-INFO %{python3_sitelib}/%{modname}.py %{python3_sitelib}/%{modname}-%{version}-* %{python3_sitelib}/__pycache__/%{modname}* %endif %changelog * Fri Jan 04 2013 Ralph Bean - 0.4.1-1 - Initial packaging for Fedora