File pycarddav.spec of Package pycarddav

#
# spec file for package pycarddav
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2013 Guido Berhoerster <gber@opensuse.org>.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define orig_name pyCardDAV

Name:           pycarddav
Version:        0.7.0
Release:        0
Summary:        Simple to Use CardDAV CLI Client
License:        MIT
Group:          Productivity/Networking/Other
Url:            http://lostpackets.de/pycarddav/
Source:         http://lostpackets.de/pycarddav/downloads/%{orig_name}-%{version}.tar.gz
BuildRequires:  ed
BuildRequires:  python-devel
BuildRequires:  python-distribute
BuildRequires:  python-lxml
BuildRequires:  python-requests
BuildRequires:  python-urwid
BuildRequires:  python-xdg
BuildRequires:  vobject
Requires:       python-lxml
Requires:       python-requests
Requires:       python-urwid
Requires:       python-xdg
Requires:       vobject
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
pyCardDAV is a simple to use CardDAV CLI client. It has built in support for
mutt's query_command but also works very well solo.

pyCardDAV consists of pycardsyncer, a program for syncing your CardDAV resource
into a local database and of pc_query, a program for querying the local
database.

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

# fix the shebang for executable scripts
find bin/ -print -exec sh -c '
ed -s "$1" 2>/dev/null <<\EOF
s/^#!\/usr\/bin\/env .*$/#!\/usr\/bin\/python/
w
EOF
' {} {} \;

# remove shebang from non-executables
find pycarddav/ -name '*.py' -print -exec sh -c '
ed -s "$1" 2>/dev/null <<\EOF
/^#!\/usr\/bin\/env/d
w
EOF
' {} {} \;

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
for manpage in doc/man/*; do
    if [ -f "${manpage}" ]; then
        install -D -p -m 644 "${manpage}" "%{buildroot}%{_mandir}/man1/${manpage##*/}"
    fi
done

%files
%defattr(-,root,root)
%doc CONTRIBUTING.txt CONTRIBUTORS.txt COPYING NEWS.txt README.rst pycard.conf.sample
%{python_sitelib}/%{orig_name}-%{version}-py%{py_ver}.egg-info
%{python_sitelib}/%{name}
%{_bindir}/pc_query
%{_bindir}/pycard-import
%{_bindir}/pycardsyncer
%{_mandir}/man1/pc_query.1%{ext_man}
%{_mandir}/man1/pycard-import.1%{ext_man}
%{_mandir}/man1/pycardsyncer.1%{ext_man}

%changelog
openSUSE Build Service is sponsored by