# sitelib for noarch packages, sitearch for others (remove the unneeded one) %{!?__python2: %global __python2 %__python} %{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %if 0%{?fedora} %bcond_without python3 %else %bcond_with python3 %endif %global pkgname click-completion Name: python-click-completion Version: 0.2.1 Release: 1%{?dist} Summary: Add automatic completion support for fish, Zsh, Bash and PowerShell to Click License: MIT URL: https://github.com/click-contrib/click-completion Source0: https://github.com/click-contrib/%{pkgname}/archive/%{version}.tar.gz BuildArch: noarch BuildRequires: python2-devel BuildRequires: python2-six BuildRequires: python2-jinja2 BuildRequires: python2-click %if %{with python3} BuildRequires: python3-devel BuildRequires: python3-six BuildRequires: python3-jinja2 BuildRequires: python3-click %endif # with python3 %description Enhanced completion for Click Add automatic completion support for fish, Zsh, Bash and PowerShell to Click. All the supported shells are able to complete all the command line arguments and options defined with click. In addition, fish and Zsh are also displaying the options and commands help during the completion. %package -n python2-%{pkgname} Summary: %{summary} %{?python_provide:%python_provide python2-%{pkgname}} Requires: python2-click Requires: python2-jinja2 %description -n python2-%{pkgname} Enhanced completion for Click Add automatic completion support for fish, Zsh, Bash and PowerShell to Click. All the supported shells are able to complete all the command line arguments and options defined with click. In addition, fish and Zsh are also displaying the options and commands help during the completion. %if %{with python3} %package -n python3-%{pkgname} Summary: %{summary} %{?python_provide:%python_provide python3-%{pkgname}} Requires: python3-click Requires: python3-jinja2 %description -n python3-%{pkgname} Enhanced completion for Click Add automatic completion support for fish, Zsh, Bash and PowerShell to Click. All the supported shells are able to complete all the command line arguments and options defined with click. In addition, fish and Zsh are also displaying the options and commands help during the completion. %endif # with python3 %prep %autosetup -n %{pkgname}-%{version} sed -i 's|^#!/usr/bin/env python||' click_completion.py sed -i 's|^#!/usr/bin/env python||' examples/click-completion-* chmod -x examples/click-completion-* %build %{py2_build} %if %{with python3} %{py3_build} %endif # with python3 %install %{py2_install} %if %{with python3} %{py3_install} %endif # with python3 %check %{__python2} setup.py test %if %{with python3} %{__python3} setup.py test %endif %files -n python2-%{pkgname} %license LICENSE %doc examples README.md %{python2_sitelib}/* %if %{with python3} %files -n python3-%{pkgname} %license LICENSE %doc examples README.md %{python3_sitelib}/* %endif # with python3 %changelog * Tue Apr 3 2018 Brett Lentz - 0.2.1-1 - initial package