diff --git a/python-mwclient.spec b/python-mwclient.spec index 01563a7..75f5841 100644 --- a/python-mwclient.spec +++ b/python-mwclient.spec @@ -3,6 +3,12 @@ %global with_python3 1 %endif +# EPEL 6 compat stuff, per https://fedoraproject.org/wiki/EPEL:Packaging +%{!?__python2: %global __python2 /usr/bin/python2} +%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} +%{!?py2_build: %global py2_build %{expand: CFLAGS="%{optflags}" %{__python2} setup.py %{?py_setup_args} build --executable="%{__python2} -s"}} +%{!?py2_install: %global py2_install %{expand: CFLAGS="%{optflags}" %{__python2} setup.py %{?py_setup_args} install -O1 --skip-build --root %{buildroot}}} + %global github_owner mwclient %global github_name mwclient %global github_commit 5fa50d4df1324ef678d58c625314e53bb229c594 @@ -44,6 +50,14 @@ provides access to most API functionality. %package -n python2-%{github_name} Summary: %{summary} %{?python_provide:%python_provide python2-%{github_name}} +# EPEL 6 compat, no python_provide there +%if 0%{?rhel} +%if %{rhel} < 7 +Provides: python-%{github_name} = %{version}-%{release} +Obsoletes: python-%{github_name} < %{version}-%{release} +%endif # if rhel < 7 +%endif # if rhel + Requires: python-simplejson # EL6/7 packages don't provide python2-requests Requires: python-requests @@ -67,7 +81,9 @@ provides access to most API functionality. This is the Python 3 build of %endif # if with_python3 %prep -%autosetup -n %{github_name}-%{github_commit} -p1 +# autosetup isn't available on epel6 yet +%setup -q -n %{github_name}-%{github_commit} +%patch0 -p1 -b .execpy3 %build