%global gitname ghp-import %global with_python3 1 Name: python-%{gitname} Version: 0.4.1 Release: 2%{?dist} Summary: Copies docs directly to the gh-pages branch of a GitHub repo License: Tumbolia Public License URL: https://github.com/davisp/%{gitname} Source0: https://pypi.python.org/packages/source/g/%{gitname}/%{gitname}-%{version}.tar.gz Patch0: 0001-make-file-open-py2-and-py3-friendly.patch BuildArch: noarch BuildRequires: python-devel Requires: git %description ghp-import manages content in the gh-pages branch of your GitHub repo. Use it to publish documentation or other content that requires sources in your main branch. %if 0%{?with_python3} %package -n python3-ghp-import Summary: Copies docs directly to the gh-pages branch of a GitHub repo BuildRequires: python3-devel Requires: git %description -n python3-ghp-import ghp-import manages content in the gh-pages branch of your GitHub repo. Use it to publish documentation or other content that requires sources in your main branch. %endif %prep %setup -q -n %{gitname}-%{version} %patch0 -p1 %build export LANG=C export LC_ALL=C %{__python} setup.py build mv build build2 %if 0%{?with_python3} %{__python3} setup.py build mv build build3 %endif %install mv build2 build %{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT mv %{buildroot}/%{_bindir}/ghp-import %{buildroot}/%{_bindir}/ghp-import.%{python2_version} %if 0%{?with_python3} rm -rf build mv build3 build %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT mv %{buildroot}/%{_bindir}/ghp-import %{buildroot}/%{_bindir}/ghp-import.%{python3_version} %endif ln -s %{_bindir}/ghp-import.%{python2_version} %{buildroot}/%{_bindir}/ghp-import %files %doc README.md %license LICENSE %{_bindir}/ghp-import %{_bindir}/ghp-import.%{python2_version} %{python2_sitelib}/ghp_import-%{version}-py%{python2_version}.egg-info %if 0%{?with_python3} %files -n python3-ghp-import %doc README.md %license LICENSE %{_bindir}/ghp-import.%{python3_version} %{python3_sitelib}/ghp_import-%{version}-py%{python3_version}.egg-info %endif %changelog * Tue Jan 20 2015 Pete Travis 0.4.1-2 - Fix setup.py so python3 subpackage builds. * Sun Jan 18 2015 Pete Travis 0.4.1-1 - Initial build.