Blob Blame Raw
%if 0%{?fedora}
%global with_python3 1
%endif

%{!?_licensedir: %global license %%doc}

%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2:        %global __python2 /usr/bin/python2}
%{!?python2_sitelib:  %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif

%global modname munch

Name:               python-munch
Version:            2.0.2
Release:            3%{?dist}
Summary:            A dot-accessible dictionary (a la JavaScript objects)

Group:              Development/Libraries
License:            MIT
URL:                http://pypi.python.org/pypi/munch
Source0:            https://pypi.python.org/packages/source/m/%{modname}/%{modname}-%{version}.tar.gz

BuildArch:          noarch

BuildRequires:      python2-devel
BuildRequires:      python-setuptools

%if 0%{?with_python3}
BuildRequires:      python3-devel
BuildRequires:      python3-setuptools
%endif

%description
munch is a fork of David Schoonover's **Bunch** package, providing similar
functionality. 99% of the work was done by him, and the fork was made
mainly for lack of responsiveness for fixes and maintenance on the original
code.

Munch is a dictionary that supports attribute-style access, a la
JavaScript.

%if 0%{?with_python3}
%package -n python3-munch
Summary:            A dot-accessible dictionary (a la JavaScript objects)
Group:              Development/Libraries

%description -n python3-munch
munch is a fork of David Schoonover's **Bunch** package, providing similar
functionality. 99% of the work was done by him, and the fork was made
mainly for lack of responsiveness for fixes and maintenance on the original
code.

Munch is a dictionary that supports attribute-style access, a la
JavaScript.
%endif

%prep
%setup -q -n %{modname}-%{version}

# Remove shebang to make rpmlint happy.
sed -i '/\/usr\/bin\/python/d' munch/__init__.py

# 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
%{__python2} 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
%{__python2} setup.py install -O1 --skip-build --root=%{buildroot}

%files
%doc README.md
%license LICENSE.txt
%{python2_sitelib}/%{modname}/
%{python2_sitelib}/%{modname}-%{version}*

%if 0%{?with_python3}
%files -n python3-munch
%doc README.md
%license LICENSE.txt
%{python3_sitelib}/%{modname}/
%{python3_sitelib}/%{modname}-%{version}*
%endif

%changelog
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sun Apr 12 2015 Ralph Bean <rbean@redhat.com> - 2.0.2-2
- Remove shebang to make rpmlint happy.

* Sat Apr 11 2015 Ralph Bean <rbean@redhat.com> - 2.0.2-1
- Initial package for Fedora