%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%global with_python3 1
Name: python-optcomplete
Version: 1.2
Release: 0.7.20130428hg9583af7%{?dist}
Summary: Shell Completion Self-Generator for Python
License: BSD
URL: http://furius.ca/optcomplete
# hg clone --insecure https://hg.furius.ca/public/optcomplete
# cd optcomplete
# hg archive -p python-optcomplete-1.2 ../python-optcomplete-1.2
Source0: %{name}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python2-devel
%if 0%{?with_python3}
BuildRequires: python3-devel
# For 2to3
BuildRequires: python-tools
%endif # if with_python3
%description
This Python module aims at providing almost automatically shell completion
for any Python program that already uses the optparse module.
%if 0%{?with_python3}
%package -n python3-optcomplete
Summary: Shell Completion Self-Generator for Python3
%description -n python3-optcomplete
This Python3 module aims at providing almost automatically shell completion
for any Python program that already uses the optparse module.
%endif # if with_python3
%prep
%setup -q
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
2to3 --write --nobackups %{py3dir}
%endif # with_python3
%build
%{__python} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3
%install
rm -rf %{buildroot}
# Must do the python3 install first because the scripts in /usr/bin are
# overwritten with every setup.py install (and we want the python2 version
# to be the default for now).
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3
%{__python} setup.py install --skip-build --root %{buildroot}
%files
%doc CHANGES COPYING CREDITS doc/*.txt README TODO
%{python_sitelib}/*
%if 0%{?with_python3}
%files -n python3-optcomplete
%doc CHANGES COPYING CREDITS doc/*.txt README TODO
%{python3_sitelib}/*
%endif # with_python3
%changelog
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-0.7.20130428hg9583af7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-0.6.20130428hg9583af7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Fri May 02 2014 Orion Poplawski <orion@cora.nwra.com> - 1.2-0.5.20130428hg9583af7
- Rebuild for Python 3.4
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-0.4.20130428hg9583af7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Sun Apr 28 2013 Orion Poplawski <orion@cora.nwra.com> - 1.2-0.3.20130428hg9583af7
- Update to latest hg version
- Re-add COPYING
* Sat Apr 27 2013 Orion Poplawski <orion@cora.nwra.com> - 1.2-0.2.20130406hg4416852
- Drop COPYING - wrong license
* Sun Apr 7 2013 Orion Poplawski <orion@cora.nwra.com> - 1.2-0.1.20130406hg4416852
- Initial Fedora package