File osc.spec of Package osc

Name:           osc
Version:        0.157.2
Release:        1%{?dist}
Group:          Development/Tools
License:        GPLv2+
Url:            https://github.com/openSUSE/osc
Source:         https://github.com/openSUSE/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
Patch0:         osc-0.142.0-support-osc-copyprj-in-api.patch
Patch1:         osc-0.151.2-add-sb2install-support.patch
Summary:        The openSUSE Build Service Commander
BuildArch:      noarch

BuildRequires:  python-devel
BuildRequires:  rpm-python
BuildRequires:  python-urlgrabber
BuildRequires:  diffstat
Requires:       rpm-python
Requires:       m2crypto
Requires:       python-lxml
Requires:       python-urlgrabber
Requires:       fuse-python
Requires:       diffstat

Recommends:     osc-source_validator

%description
Commandline client for the openSUSE Build Service.

See http://en.opensuse.org/openSUSE:OSC , as well as
http://en.opensuse.org/openSUSE:Build_Service_Tutorial for a general
introduction.


%prep
%setup -q
%patch0 -p1
%patch1 -p1

#fixup encoding
iconv -f ISO8859-1 -t UTF-8 -o TODO.new TODO
mv TODO.new TODO

%build
CFLAGS="%{optflags}" %{__python} setup.py build

%install
%{__python} setup.py install -O1 --prefix=%{_prefix} --root %{buildroot}
%__ln_s osc-wrapper.py %{buildroot}/%{_bindir}/osc
%__mkdir_p %{buildroot}%{_localstatedir}/lib/osc-plugins
%__mkdir_p %{buildroot}%{_datadir}/bash-completion/completions/
install -Dm0644 dist/complete.csh %{buildroot}%{_sysconfdir}/profile.d/osc.csh
install -Dm0644 dist/complete.sh %{buildroot}%{_datadir}/bash-completion/completions/osc
install -Dm0755 dist/osc.complete %{buildroot}%{_datadir}/osc/complete

%check
cd tests; %{__python} suite.py

%files
%doc AUTHORS README TODO NEWS
%license COPYING
%{_bindir}/osc*
%{python_sitelib}/*
%config %{_sysconfdir}/profile.d/osc.csh
%{_datadir}/bash-completion/completions/osc
%dir %{_localstatedir}/lib/osc-plugins
%{_mandir}/man1/osc.*
%{_datadir}/osc