Преглед на файлове

python-setuptools-18.5-2

git-svn-id: http://trac.vinelinux.org/repos/projects/specs@9903 ec354946-7b23-47d6-9f5a-488ba84defc7
tomop преди 9 години
родител
ревизия
0bf0fa6342
променени са 1 файла, в които са добавени 88 реда и са изтрити 3 реда
  1. 88 3
      p/python-setuptools/python-setuptools-vl.spec

+ 88 - 3
p/python-setuptools/python-setuptools-vl.spec

@@ -1,8 +1,15 @@
-%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+%bcond_without python3
+
+%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+
+%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])")}
+%endif
 
 Name:           python-setuptools
 Version:        18.5
-Release:        1%{?_dist_release}
+Release:        2%{?_dist_release}
 Summary:        Download, build, install, upgrade, and uninstall Python packages
 Summary(ja):     Python パッケージのダウンロード、ビルド、インストール、アップグレードおよびアンインストール用ツール
 Group:          Development/Tools
@@ -29,19 +36,59 @@ setuptools は Python distutils の拡張機能を集めたツールです。
 なります。特に他のパッケージに依存しているパッケージを扱う際に便利
 です。
 
+%if %{with python3}
+
+%package -n python3-setuptools
+Summary:        Download, build, install, upgrade, and uninstall Python3 packages
+Summary(ja):     Python3 パッケージのダウンロード、ビルド、インストール、アップグレードおよびアンインストール用ツール
+Group:          Development/Tools
+
+BuildRequires:  python3-devel
+Requires(post): alternatives
+
+%description -n python3-setuptools
+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.
+
+%description -n python3-setuptools -l ja
+setuptools は Python distutils の拡張機能を集めたツールです。
+このツールにより Python パッケージの構築や配布が簡単に行えるように
+なります。特に他のパッケージに依存しているパッケージを扱う際に便利
+です。
+
+%endif
 
 %prep
-%setup -q -n setuptools-%{version}
+%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 *.txt ../../
+popd
+popd
 
+%if %{with python3}
+cp -a py2 py3
+%endif
 
 %build
+pushd py2/setuptools-%{version}
 CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
+popd
 
+%if %{with python3}
+pushd py3/setuptools-%{version}
+CFLAGS="$RPM_OPT_FLAGS" python3 setup.py build
+popd
+%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
@@ -50,6 +97,20 @@ find $RPM_BUILD_ROOT%{python_sitelib} -name '*.exe' | xargs rm -f
 
 # for alternatives
 %__rm -f $RPM_BUILD_ROOT%{_bindir}/easy_install
+popd
+
+%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
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -67,14 +128,38 @@ then
   update-alternatives --remove easy_install %{_bindir}/easy_install-%{python_version}
 fi
 
+%if %{with python3}
+
+%post -n python3-setuptools
+update-alternatives --install %{_bindir}/easy_install easy_install \
+	                      %{_bindir}/easy_install-%{python3_version} 20
+
+%preun -n python3-setuptools
+if [ "$1" = "0" ]
+then
+  update-alternatives --remove easy_install %{_bindir}/easy_install-%{python3_version}
+fi
+
+%endif
+
 %files
 %defattr(-,root,root,-)
 %doc *.txt
 %{_bindir}/easy_install-%{python_version}
 %{python_sitelib}/*
 
+%if %{with python3}
+%files -n python3-setuptools
+%defattr(-,root,root,-)
+%doc *.txt
+%{_bindir}/easy_install-%{python3_version}
+%{python3_sitelib}/*
+%endif
 
 %changelog
+* Thu Dec 24 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 18.5-2
+- added a subpackage: python3-setuptools.
+
 * Sun Nov 15 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 18.5-1
 - new upstream release.
 - imported patch0 from rawhide.