File osc.spec of Package osc

Name:           osc
Epoch:          1
Version:        1.8.3
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
Summary:        The openSUSE Build Service Commander
BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  python3dist(setuptools)
BuildRequires:  python3dist(rpm)
BuildRequires:  python3dist(cryptography)
BuildRequires:  python3dist(progressbar2)
BuildRequires:  python3dist(urllib3)
BuildRequires:  python3dist(distro)
BuildRequires:  diffstat
BuildRequires:  argparse-manpage
Requires:       python3dist(rpm)
Requires:       python3dist(cryptography)
Requires:       python3dist(progressbar2)
Requires:       python3dist(urllib3)
Requires:       python3dist(distro)
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
%autosetup -p1
# Version is not right when forming a release at Github
sed -i 's/\(^ *version = \)"[^"]*"$/\1"%{version}"/' osc/util/git_version.py

%build
%py3_build

# build man page
PYTHONPATH=. argparse-manpage \
    --output=osc.1 \
    --format=single-commands-section \
    --module=osc.commandline \
    --function=get_parser \
    --project-name=osc \
    --prog=osc \
    --description="OpenSUSE Commander" \
    --author="Contributors to the osc project. See the project's GIT history for the complete list." \
    --url="https://github.com/openSUSE/osc/"

%install
%py3_install
%__mkdir_p %{buildroot}%{_localstatedir}/lib/osc-plugins
%__mkdir_p %{buildroot}%{_datadir}/bash-completion/completions/
install -Dm0644 contrib/complete.csh %{buildroot}%{_sysconfdir}/profile.d/osc.csh
install -Dm0644 contrib/complete.sh %{buildroot}%{_datadir}/bash-completion/completions/osc
install -Dm0755 contrib/osc.complete %{buildroot}%{_datadir}/osc/complete

# install man page
install -Dm0644 osc.1 %{buildroot}%{_mandir}/man1/osc.1

%check
%{__python3} setup.py test

%files
%doc AUTHORS README.md 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