%global pypi_name python-editor %if 0%{?fedora} || 0%{?rhel} > 7 %{lua:posix.setenv("RHEL_ALLOW_PYTHON2_FOR_BUILD", 1)} %global with_python3 1 %endif %{!?upstream_version: %global upstream_version %{version}%{?milestone}} Name: python-editor Version: 0.4 Release: 5%{?dist} Provides: python2-editor = %{version}-%{release} Summary: Programmatically open an editor, capture the result. License: ASL 2.0 URL: https://github.com/fmoo/python-editor Source: https://pypi.python.org/packages/source/p/%{pypi_name}/%{pypi_name}-%{version}.tar.gz BuildArch: noarch BuildRequires: python2-devel BuildRequires: python2-setuptools %description Programmatically open an editor, capture the result. %package -n python2-editor Summary: Programmatically open an editor, capture the result. Provides: python-editor = %{upstream_version} Provides: %{name} = %{version}-%{release} Obsoletes: %{name} < %{version}-%{release} %description -n python2-editor Programmatically open an editor, capture the result. %if 0%{?with_python3} %package -n python3-editor Summary: Programmatically open an editor, capture the result. %{?python_provide:%python_provide python3-editor} BuildRequires: python3-devel BuildRequires: python3-setuptools %description -n python3-editor Programmatically open an editor, capture the result. %endif %prep %setup -q -n %{pypi_name}-%{upstream_version} rm -rf %{pypi_name}.egg-info %build %{__python2} setup.py build %if 0%{?with_python3} %{__python3} setup.py build %endif %install %{__python2} setup.py install --skip-build --root=$RPM_BUILD_ROOT # lhh - hack - change to use python2/3 explicitly echo "#!/usr/bin/python2" > $RPM_BUILD_ROOT%{python2_sitelib}/editor.py.new tail --lines=+2 $RPM_BUILD_ROOT%{python2_sitelib}/editor.py > $RPM_BUILD_ROOT%{python2_sitelib}/editor.py.new mv -f $RPM_BUILD_ROOT%{python2_sitelib}/editor.py.new $RPM_BUILD_ROOT%{python2_sitelib}/editor.py chmod a+x $RPM_BUILD_ROOT%{python2_sitelib}/editor.py %if 0%{?with_python3} %{__python3} setup.py install --skip-build --root=$RPM_BUILD_ROOT # lhh - hack - change to use python2/3 explicitly echo "#!/usr/bin/python3" > $RPM_BUILD_ROOT%{python3_sitelib}/editor.py.new tail --lines=+2 $RPM_BUILD_ROOT%{python3_sitelib}/editor.py > $RPM_BUILD_ROOT%{python3_sitelib}/editor.py.new mv -f $RPM_BUILD_ROOT%{python3_sitelib}/editor.py.new $RPM_BUILD_ROOT%{python3_sitelib}/editor.py chmod a+x $RPM_BUILD_ROOT%{python3_sitelib}/editor.py %endif %files -n python2-editor %doc README.md %license LICENSE %{python2_sitelib}/editor.py* %{python2_sitelib}/python_editor-%{version}-py?.?.egg-info %if 0%{?with_python3} %files -n python3-editor %doc README.md %license LICENSE %{python3_sitelib}/*.egg-info %{python3_sitelib}/editor.py* %{python3_sitelib}/__pycache__/* %endif %changelog * Fri Jan 11 2019 Lon Hohberger - 0.4-5 - RHEL8 updates * Tue Nov 24 2015 Ralph Bean - 0.4-4 - Merge branches together and bump release for bodhi updates. - Removed empty %%check section. - Fix incorrect usage of %%{pypi_name}. * Tue Nov 10 2015 Fedora Release Engineering - 0.4-3 - Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 * Mon Aug 31 2015 Lukas Bezdicka - 0.4-2 - fix python2 and python3 support and add support for Centos CBS - fix description * Wed Aug 26 2015 Lukas Bezdicka - 0.4-1 - Bump to 0.4 * Tue Aug 25 2015 Lukas Bezdicka - 0.3-1 - initial package