Parcourir la source

python-setuptools-38.2.4-1

git-svn-id: http://trac.vinelinux.org/repos/projects/specs@11271 ec354946-7b23-47d6-9f5a-488ba84defc7
tomop il y a 7 ans
Parent
commit
7b52e43936
1 fichiers modifiés avec 106 ajouts et 56 suppressions
  1. 106 56
      p/python-setuptools/python-setuptools-vl.spec

+ 106 - 56
p/python-setuptools/python-setuptools-vl.spec

@@ -1,33 +1,45 @@
-%if %{?_dist_release} == "vl6"
-%bcond_with python3
-%else
+%bcond_with bootstrap
 %bcond_without python3
-%endif
 
-%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+%global srcname setuptools
+%define _unpackaged_files_terminate_build 1
 
+%global python_wheelname %{srcname}-%{version}-py2.py3-none-any.whl
+%global python2_wheelname %python_wheelname
+%global python2_record %{python_sitelib}/%{srcname}-%{version}.dist-info/RECORD
 %if %{with python3}
-%{!?python3_sitelib: %global python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
-%{!?python3_version: %global python3_version %(python3 -c "import sys; sys.stdout.write(sys.version[:3])")}
+%global python3_wheelname %python_wheelname
+%global python3_record %{python3_sitelib}/%{srcname}-%{version}.dist-info/RECORD
 %endif
 
 Name:           python-setuptools
-Version:        25.1.1
+Version:        38.2.4
 Release:        1%{?_dist_release}
 Summary:        Download, build, install, upgrade, and uninstall Python packages
 Summary(ja):     Python パッケージのダウンロード、ビルド、インストール、アップグレードおよびアンインストール用ツール
 Group:          Development/Tools
 License:        PSFL/ZPL
 URL:            https://pypi.python.org/pypi/setuptools
-Source0:        https://pypi.python.org/packages/source/s/setuptools/setuptools-%{version}.tar.gz
+Source0:        https://files.pythonhosted.org/packages/source/s/%{srcname}/%{srcname}-%{version}.zip
 Source1:        psfl.txt
 Source2:        zpl.txt
-Patch0:         add-setter-for-test_args.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-root
 
 Requires(post): alternatives
 BuildArch:      noarch
 BuildRequires:  python-devel
+BuildRequires:  python-rpm-macros
+%if %{with python3}
+BuildRequires:  python3-rpm-macros
+%endif
+%if %{without bootstrap}
+BuildRequires:  python-pip
+BuildRequires:  python-wheel
+%if %{with python3}
+BuildRequires:  python3-pip
+BuildRequires:  python3-wheel
+%endif
+%endif # without bootstrap
 
 %description
 setuptools is a collection of enhancements to the Python distutils that allow
@@ -64,58 +76,87 @@ setuptools は Python distutils の拡張機能を集めたツールです。
 %endif
 
 %prep
-%setup -T -c -n setuptools-%{version}
-mkdir py2
-pushd py2
-tar xvf %{SOURCE0}
-pushd setuptools-%{version}
-%patch0 -p1
-#find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python}|'
-cp *.rst ../../
-popd
-popd
+%setup -q -n %{srcname}-%{version}
+
+# We can't remove .egg-info (but it doesn't matter, since it'll be rebuilt):
+#  The problem is that to properly execute setuptools' setup.py,
+#   it is needed for setuptools to be loaded as a Distribution
+#   (with egg-info or .dist-info dir), it's not sufficient
+#   to just have them on PYTHONPATH
+#  Running "setup.py install" without having setuptools installed
+#   as a distribution gives warnings such as
+#    ... distutils/dist.py:267: UserWarning: Unknown distribution option: 'entry_points'
+#   and doesn't create "easy_install" and .egg-info directory
+# Note: this is only a problem if bootstrapping wheel or building on RHEL,
+#  otherwise setuptools are installed as dependency into buildroot
+
+# Strip shbang
+find setuptools -name \*.py | xargs sed -i -e '1 {/^#!\//d}'
+# Remove bundled exes
+rm -f setuptools/*.exe
+# These tests require internet connection
+rm setuptools/tests/test_integration.py
+
+%build
+%if %{without bootstrap}
+%py_build_wheel
+%else
+%py_build
+%endif
 
 %if %{with python3}
-cp -a py2 py3
+%if %{without bootstrap}
+%py3_build_wheel
+%else
+%py3_build
 %endif
+%endif # with python3
 
-%build
-pushd py2/setuptools-%{version}
-CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
-popd
+%install
+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).
 %if %{with python3}
-pushd py3/setuptools-%{version}
-CFLAGS="$RPM_OPT_FLAGS" python3 setup.py build
-popd
+%if %{without bootstrap}
+%py3_install_wheel %{python3_wheelname}
+
+# Remove /usr/bin/easy_install from the record as later on we delete the file
+sed -i '/\/usr\/bin\/easy_install,/d' %{buildroot}%{python3_record}
+%else
+%py3_install
 %endif
 
-%install
-rm -rf $RPM_BUILD_ROOT
-pushd py2/setuptools-%{version}
-%{__python} setup.py install -O1 --skip-build \
-    --root $RPM_BUILD_ROOT \
-    --single-version-externally-managed
-install -p -m 0644 %{SOURCE1} %{SOURCE2} .
-find $RPM_BUILD_ROOT%{python_sitelib} -name '*.exe' | xargs rm -f
+# TODO: we have to remove this by hand now, but it'd be nice if we wouldn't have to
+rm %{buildroot}%{_bindir}/easy_install
 
-# for alternatives
-%__rm -f $RPM_BUILD_ROOT%{_bindir}/easy_install
-popd
+rm -rf %{buildroot}%{python3_sitelib}/setuptools/tests
+%if %{without bootstrap}
+sed -i '/^setuptools\/tests\//d' %{buildroot}%{python3_record}
+%endif
 
-%if %{with python3}
-pushd py3/setuptools-%{version}
-python3 setup.py install -O1 --skip-build \
-    --root $RPM_BUILD_ROOT \
-    --single-version-externally-managed
-install -p -m 0644 %{SOURCE1} %{SOURCE2} .
-find $RPM_BUILD_ROOT%{python3_sitelib} -name '*.exe' | xargs rm -f
-
-# for alternatives
-%__rm -f $RPM_BUILD_ROOT%{_bindir}/easy_install
-popd
+find %{buildroot}%{python3_sitelib} -name '*.exe' | xargs rm -f
+%endif # with python3
+
+
+%if %{without bootstrap}
+%py_install_wheel %{python2_wheelname}
+%else
+%py_install
 %endif
 
+rm -rf %{buildroot}%{python_sitelib}/setuptools/tests
+%if %{without bootstrap}
+sed -i '/^setuptools\/tests\//d' %{buildroot}%{python2_record}
+%endif
+
+find %{buildroot}%{python_sitelib} -name '*.exe' | xargs rm -f
+
+# Don't ship these
+rm -r docs/{Makefile,conf.py,_*}
+rm %{buildroot}%{_bindir}/easy_install
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -158,19 +199,28 @@ fi
 
 %files
 %defattr(-,root,root,-)
-%doc *.rst
-%{_bindir}/easy_install-%{python_version}
+%license LICENSE
+%doc docs/* CHANGES.rst README.rst
 %{python_sitelib}/*
+%{_bindir}/easy_install-2*
 
 %if %{with python3}
 %files -n python3-setuptools
-%defattr(-,root,root,-)
-%doc *.rst
-%{_bindir}/easy_install-%{python3_version}
-%{python3_sitelib}/*
+%license LICENSE
+%doc docs/* CHANGES.rst README.rst
+%{python3_sitelib}/easy_install.py
+%{python3_sitelib}/pkg_resources/
+%{python3_sitelib}/setuptools*/
+%{python3_sitelib}/__pycache__/*
+%{_bindir}/easy_install-3*
 %endif
 
 %changelog
+* Sun Dec 17 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 38.2.4-1
+- new upstream release.
+- dropped Patch0.
+- made to use python{,3}-rpm-macros.
+
 * Sat Jul 30 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 25.1.1-1
 - new upstream release.
 - enable to build on Vine6.