File pycarddav.spec of Package pycarddav

# spec file for package pycarddav
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2013 Guido Berhoerster <>.
# 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

%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
BuildRequires:  ed
BuildRequires:  python-devel
BuildRequires:  python-distribute
BuildRequires:  python-lxml
BuildRequires:  python-requests
BuildRequires:  python-urwid
BuildRequires:  python-vobject
BuildRequires:  python-xdg
Requires:       python-lxml
Requires:       python-requests
Requires:       python-urwid
Requires:       python-vobject
Requires:       python-xdg
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

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

%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/
' {} {} \;

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

python build

python 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##*/}"

%doc CONTRIBUTING.txt CONTRIBUTORS.txt COPYING NEWS.txt README.rst pycard.conf.sample