File osc.spec of Package osc

Name:           osc
Epoch:          1
Version:        0.174.0
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-support-osc-copyprj-in-api.patch
Patch1:         osc-add-sb2install-support.patch
Patch2:         osc-fix-xpath.patch
Summary:        The openSUSE Build Service Commander
BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  python3-rpm
BuildRequires:  diffstat
Requires:       python3-rpm
Requires:       python3-m2crypto
Requires:       python3-lxml
Requires:       python3-fuse
Requires:       python3-progressbar
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
%patch2 -p1

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

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

%install
%{__python3} 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; %{__python3} suite.py

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