%if 0%{?fedora} <= 12
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%endif
%global srcname bunch
Name: python-bunch
Version: 1.0.1
Release: 1%{?dist}
Summary: Python dictionary with attribute-style access
Group: Development/Languages
License: MIT
URL: http://github.com/dsc/bunch
Source0: http://pypi.python.org/packages/source/b/bunch/bunch-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: dos2unix
BuildRequires: python-setuptools
BuildRequires: python-nose
%description
python-bunch provides a python class which can perform as a dict whose keys are
also accessible as attributes, similar to JavaScript objects. For instance::
>>> import bunch
>>> people = bunch.Bunch({'alice': 'here', 'bob': 'there'})
>>> print people['alice'], people.alice
here here
The piece of python-bunch that sets it apart from similar modules found inside
other projects is the bunchify() function which recursively converts from
a dict to a Bunch::
>>> multi_level = {'array': ['scalar', {'mapping': 'to show recursion'} ]}
>>> bunch.bunchify(multi_level)
Bunch(array=['scalar', Bunch(mapping='to show recursion')])
%prep
%setup -q -n %{srcname}-%{version}
dos2unix LICENSE.txt README.txt
%build
%{__python} setup.py build
%install
rm -rf %{buildroot}
%{__python} setup.py install --skip-build --root %{buildroot}
rm %{buildroot}%{python_sitelib}/bunch/test.*
%clean
rm -rf %{buildroot}
%check
PYTHONPATH=build/lib nosetests --with-doctest
PYTHONPATH=build/lib python build/lib/bunch/test.py
%files
%defattr(-,root,root,-)
%doc LICENSE.txt README.rst
%{python_sitelib}/*
%changelog
* Thu Dec 29 2011 Toshio Kuratomi <toshio@fedoraproject.org> - 1.0.1-1
- New upstream release that adds pyyaml and json serialization
* Fri Jul 30 2010 Toshio Kuratomi <toshio@fedoraproject.org> - 1.0.0-2
- Fix build when fedora macro is not defined.
* Fri Mar 19 2010 Toshio Kuratomi <toshio@fedoraproject.org> - 1.0.0-1
- Initial Fedora Build