Keep this python35 only

This commit is contained in:
Miro Hrončok 2014-06-07 15:11:41 +02:00
parent 68adb7b463
commit 6eb82a3e17

View File

@ -1,27 +1,17 @@
%if 0%{?fedora}
%global with_python3 1
# This controls whether setuptools is build as a wheel or not, # This controls whether setuptools is build as a wheel or not,
# simplifying Python 3.4 bootstraping process # simplifying Python 3.4 bootstraping process
%global build_wheel 1 %global build_wheel 0
%else
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
%endif
%global srcname setuptools %global srcname setuptools
%if 0%{?build_wheel} %if 0%{?build_wheel}
%global python2_wheelname %{srcname}-%{version}-py2.py3-none-any.whl %global python3_wheelname %{srcname}-%{version}-py2.py3-none-any.whl
%global python2_record %{python2_sitelib}/%{srcname}-%{version}.dist-info/RECORD %global python3_record %{python35_sitelib}/%{srcname}-%{version}.dist-info/RECORD
%if 0%{?with_python3}
%global python3_wheelname %python2_wheelname
%global python3_record %{python3_sitelib}/%{srcname}-%{version}.dist-info/RECORD
%endif
%endif %endif
Name: python-setuptools Name: python35-setuptools
Version: 2.0 Version: 2.0
Release: 4%{?dist} Release: 5%{?dist}
Summary: Easily build and distribute Python packages Summary: Easily build and distribute Python 3 packages
Group: Applications/System Group: Applications/System
License: Python or ZPLv2.0 License: Python or ZPLv2.0
@ -34,54 +24,15 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch BuildArch: noarch
# Require this so that we use a system copy of the match_hostname() function # Require this so that we use a system copy of the match_hostname() function
Requires: python-backports-ssl_match_hostname BuildRequires: python35-devel
BuildRequires: python-backports-ssl_match_hostname
BuildRequires: python2-devel
%if 0%{?build_wheel} %if 0%{?build_wheel}
BuildRequires: python-pip BuildRequires: python35-pip
BuildRequires: python-wheel BuildRequires: python35-wheel
%endif %endif
%if 0%{?with_python3}
BuildRequires: python3-devel
%if 0%{?build_wheel}
BuildRequires: python3-pip
BuildRequires: python3-wheel
%endif
%endif # if with_python3
# For unittests # For unittests
BuildRequires: subversion BuildRequires: subversion
# Legacy: We removed this subpackage once easy_install no longer depended on
# python-devel
# Planning on removing for F21
# https://lists.fedoraproject.org/pipermail/devel/2013-November/191344.html
Provides: python-setuptools-devel = %{version}-%{release}
Obsoletes: python-setuptools-devel < 0.6.7-1
# We're now back to setuptools as the package.
# Keep the python-distribute name active for a few releases. Eventually we'll
# want to get rid of the Provides and just keep the Obsoletes
Provides: python-distribute = %{version}-%{release}
Obsoletes: python-distribute < 0.6.36-2
%description %description
Setuptools is a collection of enhancements to the Python distutils that allow
you to more easily build and distribute Python packages, especially ones that
have dependencies on other packages.
This package also contains the runtime components of setuptools, necessary to
execute the software that requires pkg_resources.py.
%if 0%{?with_python3}
%package -n python3-setuptools
Summary: Easily build and distribute Python 3 packages
Group: Applications/System
# Note: Do not need to Require python3-backports-ssl_match_hostname because it
# has been present since python3-3.2. We do not ship python3-3.0 or
# python3-3.1 anywhere
%description -n python3-setuptools
Setuptools is a collection of enhancements to the Python 3 distutils that allow Setuptools is a collection of enhancements to the Python 3 distutils that allow
you to more easily build and distribute Python 3 packages, especially ones that you to more easily build and distribute Python 3 packages, especially ones that
have dependencies on other packages. have dependencies on other packages.
@ -89,54 +40,26 @@ have dependencies on other packages.
This package also contains the runtime components of setuptools, necessary to This package also contains the runtime components of setuptools, necessary to
execute the software that requires pkg_resources.py. execute the software that requires pkg_resources.py.
%endif # with_python3
%prep %prep
%setup -q -n %{srcname}-%{version} %setup -q -n %{srcname}-%{version}
find -name '*.txt' -exec chmod -x \{\} \; find -name '*.txt' -exec chmod -x \{\} \;
find . -name '*.orig' -exec rm \{\} \; find . -name '*.orig' -exec rm \{\} \;
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
pushd %{py3dir}
for file in setuptools/command/easy_install.py ; do for file in setuptools/command/easy_install.py ; do
sed -i '1s|^#!python|#!%{__python3}|' $file sed -i '1s|^#!python|#!%{__python35}|' $file
done
popd
%endif # with_python3
for file in setuptools/command/easy_install.py ; do
sed -i '1s|^#!python|#!%{__python}|' $file
done done
%build %build
%if 0%{?build_wheel} %if 0%{?build_wheel}
%{__python} setup.py bdist_wheel %{__python35} setup.py bdist_wheel
%else %else
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build CFLAGS="$RPM_OPT_FLAGS" %{__python35} setup.py build
%endif %endif
%if 0%{?with_python3}
pushd %{py3dir}
%if 0%{?build_wheel}
%{__python3} setup.py bdist_wheel
%else
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
%endif
popd
%endif # with_python3
%install %install
rm -rf %{buildroot} 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).
# Change to defaulting to python3 version in F22
%if 0%{?with_python3}
pushd %{py3dir}
%if 0%{?build_wheel} %if 0%{?build_wheel}
pip3 install -I dist/%{python3_wheelname} --root %{buildroot} --strip-file-prefix %{buildroot} pip3 install -I dist/%{python3_wheelname} --root %{buildroot} --strip-file-prefix %{buildroot}
@ -146,43 +69,20 @@ rm %{buildroot}%{_bindir}/easy_install
sed -i '/\/usr\/bin\/easy_install,/d' %{buildroot}%{python3_record} sed -i '/\/usr\/bin\/easy_install,/d' %{buildroot}%{python3_record}
%else %else
%{__python3} setup.py install --skip-build --root %{buildroot} %{__python35} setup.py install --skip-build --root %{buildroot}
%endif %endif
rm -rf %{buildroot}%{python3_sitelib}/setuptools/tests rm -rf %{buildroot}%{python35_sitelib}/setuptools/tests
%if 0%{?build_wheel} %if 0%{?build_wheel}
sed -i '/^setuptools\/tests\//d' %{buildroot}%{python3_record} sed -i '/^setuptools\/tests\//d' %{buildroot}%{python3_record}
%endif %endif
install -p -m 0644 %{SOURCE1} %{SOURCE2} %{py3dir} install -p -m 0644 %{SOURCE1} %{SOURCE2} %{py3dir}
find %{buildroot}%{python3_sitelib} -name '*.exe' | xargs rm -f find %{buildroot}%{python35_sitelib} -name '*.exe' | xargs rm -f
chmod +x %{buildroot}%{python3_sitelib}/setuptools/command/easy_install.py chmod +x %{buildroot}%{python35_sitelib}/setuptools/command/easy_install.py
popd
%endif # with_python3
%if 0%{?build_wheel}
pip2 install -I dist/%{python2_wheelname} --root %{buildroot} --strip-file-prefix %{buildroot}
%else
%{__python} setup.py install --skip-build --root %{buildroot}
%endif
rm -rf %{buildroot}%{python_sitelib}/setuptools/tests
%if 0%{?build_wheel}
sed -i '/^setuptools\/tests\//d' %{buildroot}%{python2_record}
%endif
install -p -m 0644 %{SOURCE1} %{SOURCE2} .
find %{buildroot}%{python_sitelib} -name '*.exe' | xargs rm -f
chmod +x %{buildroot}%{python_sitelib}/setuptools/command/easy_install.py
%check %check
%{__python} setup.py test %{__python35} setup.py test
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif # with_python3
%clean %clean
rm -rf %{buildroot} rm -rf %{buildroot}
@ -190,20 +90,14 @@ rm -rf %{buildroot}
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc *.txt docs
%{python_sitelib}/*
%{_bindir}/easy_install
%{_bindir}/easy_install-2.*
%if 0%{?with_python3}
%files -n python3-setuptools
%defattr(-,root,root,-)
%doc psfl.txt zpl.txt docs %doc psfl.txt zpl.txt docs
%{python3_sitelib}/* %{python35_sitelib}/*
%{_bindir}/easy_install-3.* %{_bindir}/easy_install-3.*
%endif # with_python3
%changelog %changelog
* Sat Jun 07 2014 Miro Hrončok <mhroncok@redhat.com> - 2.0-5
- Keep this only for Python 3.5
* Fri Apr 25 2014 Matej Stuchlik <mstuchli@redhat.com> - 2.0-4 * Fri Apr 25 2014 Matej Stuchlik <mstuchli@redhat.com> - 2.0-4
- Rebuild as wheel for Python 3.4 - Rebuild as wheel for Python 3.4