%if 0%{?fedora} %global with_python3 1 %else %global with_python3 0 %endif Name: python-docker-scripts Version: 0.3.7 Release: 1%{?dist} Summary: Collection of scripts to help manage Docker Group: Development/Tools License: MIT URL: https://github.com/goldmann/docker-scripts Source0: https://github.com/goldmann/docker-scripts/archive/%{version}.tar.gz BuildArch: noarch BuildRequires: python-devel BuildRequires: python-setuptools BuildRequires: python-six Requires: python-setuptools Requires: python-six Requires: python-docker-py %description A swiss-knife tool that could be useful for people working with Docker. This is a collection of scripts to deal with Docker images and not only. %if 0%{?with_python3} %package -n python3-docker-scripts Summary: Summary BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-six Requires: python3-setuptools Requires: python3-six Requires: python3-docker-py %description -n python3-docker-scripts A swiss-knife tool that could be useful for people working with Docker. This is a collection of scripts to deal with Docker images and not only. %endif %prep %setup -qn docker-scripts-%{version} %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' %endif find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|' %build %{__python} setup.py build %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py build popd %endif %install %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install --skip-build --root %{buildroot} mv %{buildroot}%{_bindir}/docker-scripts %{buildroot}%{_bindir}/docker-scripts3 popd %endif %{__python} setup.py install --skip-build --root %{buildroot} %files %doc README.rst %license LICENSE %{_bindir}/docker-scripts %dir %{python2_sitelib}/docker_scripts %{python2_sitelib}/docker_scripts/* %{python2_sitelib}/docker_scripts-%{version}-py2.*.egg-info %if 0%{?with_python3} %files -n python3-docker-scripts %doc README.rst %license LICENSE %{_bindir}/docker-scripts3 %dir %{python3_sitelib}/docker_scripts %{python3_sitelib}/docker_scripts/* %{python3_sitelib}/docker_scripts-%{version}-py3.*.egg-info %endif %changelog * Fri May 15 2015 Marek Goldmann - 0.3.7-1 - Upstream release 0.3.7 - Make sure the /usr/lib/python2.7/site-packages/docker_scripts is owned by this package * Thu May 14 2015 Marek Goldmann - 0.3.6-1 - Upstream release 0.3.6 * Tue May 12 2015 Marek Goldmann - 0.3.4-1 - Initial packaging