Blob Blame History Raw
%if 0%{?fedora} > 12
%global with_python3 1
%else
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
%endif

%global microv 70

Name:           python-dpath
Version:        1.2
Release:        0.4.%{microv}%{?dist}
Summary:        A library for searching dictionaries using XPath-like expressions
License:        MIT
URL:            https://github.com/akesterson/dpath-python
BuildArch:      noarch

Source0:        https://pypi.python.org/packages/source/d/dpath/dpath-%{version}-%{microv}.tar.gz

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


%description
A python library for accessing and searching dictionaries via /slashed/paths ala
xpath

Basically it lets you glob over a dictionary as if it were a filesystem. It
allows you to specify globs (ala the bash eglob syntax, through some advanced
fnmatch.fnmatch magic) to access dictionary elements, and provides some facility
for filtering those results.

%package -n python3-dpath
Summary:        A python3 library for searching dictionaries using XPath-like expressions

%description -n python3-dpath
A python library for accessing and searching dictionaries via /slashed/paths ala
xpath

Basically it lets you glob over a dictionary as if it were a filesystem. It
allows you to specify globs (ala the bash eglob syntax, through some advanced
fnmatch.fnmatch magic) to access dictionary elements, and provides some facility
for filtering those results.


%prep
%setup -q -n dpath-%{version}-%{microv}


%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif # with_python3

find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python}|'

%build
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
popd
%endif # with_python3

%install
# Must do the python3 install first because the scripts in /usr/bin are
# overwritten with every setup.py install (and we want the python2 version
# to be the default for now).
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3

%{__python} setup.py install --skip-build --root %{buildroot}

%files
%doc LICENSE.txt README.md
%{python_sitelib}/dpath*

%if 0%{?with_python3}
%files -n python3-dpath
%doc LICENSE.txt README.md
%{python3_sitelib}/dpath*
%endif # with_python3


%changelog
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-0.4.70
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 1.2-0.3.70
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4

* Mon Apr 07 2014 Stanislav Ochotnicky <sochotnicky@redhat.com> - 1.2-0.2.70
- Update to new upstream version

* Wed Mar 19 2014 Stanislav Ochotnicky <sochotnicky@redhat.com> - 1.2-0.1.52.20140319gita6ce774d
- Initial packaging