%{!?python3_sitelib: %define python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(0))")}

%define ver 4.1
%define rel 1

Summary: Import SSH public keys from Launchpad or other URLs
Name: ssh-import-id
Version: %{ver}
Release: %{rel}%{?_dist_release}
License: GPLv3
Group: Applications/Accessories
URL: https://launchpad.net/ssh-import-id
Source0: https://launchpad.net/ssh-import-id/trunk/%{version}/+download/%{name}_%{version}.orig.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
Requires: python3-setuptools
Requires: python3-requests
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildArch: noarch

Vendor: Project Vine
Distribution: Vine Linux
Packager: iwaim

%description
ssh-import-id - retrieve one or more public keys from a public 
keyserver (Launchpad.net by default) and append them to the current 
user's authorized_keys file (or some other specified file)

%prep
%setup -q

%build
python3 setup.py build

%install
rm -rf $RPM_BUILD_ROOT
python3 setup.py install --skip-build --root $RPM_BUILD_ROOT
%{__install} -d $RPM_BUILD_ROOT%{_mandir}/man1
%{__install} -m 0644 %{name}.1 $RPM_BUILD_ROOT%{_mandir}/man1

%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc README.md LICENSE ChangeLog
%{_bindir}/%{name}
%{_bindir}/%{name}-lp
%{_bindir}/%{name}-gh
%{python3_sitelib}/ssh_import_id-%{ver}-py*.egg-info
%{_mandir}/man1/%{name}.1*

%changelog
* Sun Mar 22 2015 IWAI, Masaharu <iwaim.sub@gmail.com> 4.1-1
- Initial build.

