From 4eb32d2a9f938fcdd4fecebc4a65d24617c085d7 Mon Sep 17 00:00:00 2001 From: MyoungJune Park Date: Thu, 4 Feb 2016 10:31:57 +0900 Subject: [PATCH] init packaging Change-Id: I97dad8d0638a9689d75f9939da7995e0155ec7d0 Signed-off-by: MyoungJune Park --- packaging/python3.spec | 283 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 283 insertions(+) create mode 100755 packaging/python3.spec diff --git a/packaging/python3.spec b/packaging/python3.spec new file mode 100755 index 00000000..d98cd75d --- /dev/null +++ b/packaging/python3.spec @@ -0,0 +1,283 @@ +# +# spec file for package python3 +# +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +Name: python3 +BuildRequires: automake +#BuildRequires: db-devel +BuildRequires: fdupes +BuildRequires: gcc-c++ +BuildRequires: gdbm-devel +BuildRequires: gettext-tools +BuildRequires: gmp-devel +BuildRequires: intltool +#BuildRequires: libbz2-devel +BuildRequires: libexpat-devel +BuildRequires: libffi-devel +BuildRequires: libopenssl-devel +BuildRequires: lzma-devel +BuildRequires: ncurses-devel +BuildRequires: readline-devel +BuildRequires: sqlite-devel +#BuildRequires: tk-devel +BuildRequires: xz +#BuildRequires: pkgconfig(x11) +Url: http://www.python.org/ +Summary: Python 3 Interpreter +License: Python-2.0 +Group: Development/Languages/Python +Version: 3.4.4 +Release: 0 +%define tarversion %{version} +%define tarname Python-%{tarversion} + +Requires: python3-base = %{version} +Recommends: python3-pip +Suggests: python3-curses +Suggests: python3-idlelib + +#Suggests: python3-tk +#Suggests: python3-dbm + +Source0: http://www.python.org/ftp/python/%{version}/%{tarname}.tar.xz +#Source11: testfiles.tar.bz2 +# issues with copyrighted Unicode testing files + +# do not add patches here, please edit python3-base.spec instead +# and run pre_checkin.sh +# +# see PACKAGING-NOTES for details + +### COMMON-PATCH-BEGIN ### +### COMMON-PATCH-END ### + +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +# do not add defs here, please edit python3-base.spec instead +# and run pre_checkin.sh +# +# see PACKAGING-NOTES for details + +### COMMON-DEF-BEGIN ### + +# the versions are autogenerated from pre_checkin.sh +# based on the current source tarball +%define python_version 3.4 + +%define python_version_abitag 34 +%define python_version_soname 3_4 + +%define sitedir %{_libdir}/python%{python_version} + +# three possible ABI kinds: m - pymalloc, d - debug build +# see PEP 3149 +%define abi_kind m +# python ABI version - used in some file names +%define python_abi %{python_version}%{abi_kind} +# soname ABI tag defined in PEP 3149 +%define abi_tag %{python_version_abitag}%{abi_kind} + +%define so_version %{python_version_soname}%{abi_kind}1_0 + +# rpm and python have different ideas about what is an arch-dependent name, so: +%if %{__isa_name} == ppc +%define archname %(echo %{_arch} | sed s/ppc/powerpc/) +%else +%define archname %{_arch} +%endif +# our arm has Hardware-Floatingpoint +%if %{_arch} == arm +%define armsuffix hf +%endif + +# pyexpat.cpython-35m-x86_64-linux-gnu +# pyexpat.cpython-35m-powerpc64le-linux-gnu +# pyexpat.cpython-35m-armv7-linux-gnueabihf +#%define dynlib() %{sitedir}/lib-dynload/%{1}.cpython-%{abi_tag}-%{archname}-%{_os}%{?_gnu}%{?armsuffix}.so +%define dynlib() %{sitedir}/lib-dynload/%{1}.cpython-%{abi_tag}.so +### COMMON-DEF-END ### + +# some compatibility Provides +Provides: python = %{python_version} +Provides: python3 = %{python_version} + +Provides: python3-xml = %{version} +Obsoletes: python3-xml < %{version} + +%description +Python 3 is modern interpreted, object-oriented programming language, +often compared to Tcl, Perl, Scheme, or Java. You can find an overview +of Python in the documentation and tutorials included in the python-doc +(HTML) or python-doc-pdf (PDF) packages. + +If you want to install third party modules using distutils, you need to +install python-devel package. + + +%package curses +Requires: %{name} = %{version} +Summary: Python Interface to the (N)Curses Library +Group: Development/Libraries/Python + +%description curses +An easy to use interface to the (n)curses CUI library. CUI stands for +Console User Interface. + + +%prep +%setup -q -n %{tarname} +### COMMON-PREP-BEGIN ### + +# drop Autoconf version requirement +sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac + +# fix shebangs - convert /usr/local/bin/python and /usr/bin/env/python to /usr/bin/python3 +for dir in Lib Tools; do + # find *.py, filter to files that contain bad shebangs + find $dir -name '*.py' -type f -print0 \ + | xargs -0 grep -lE '^#! *(/usr/.*bin/(env +)?)?python' \ + | xargs sed -r -i -e '1s@^#![[:space:]]*(/usr/(local/)?bin/(env +)?)?python([0-9]+(\.[0-9]+)?)?@#!/usr/bin/python3@' +done + +### COMMON-PREP-END ### + +%build +export SUSE_ASNEEDED=0 +export OPT="%{optflags} -DOPENSSL_LOAD_CONF" + +autoreconf -f -i . +# prevent make from trying to rebuild asdl stuff, which requires existing +# python installation +touch Parser/asdl* Python/Python-ast.c Include/Python-ast.h Objects/typeslots.inc + +./configure \ + --prefix=%{_prefix} \ + --libdir=%{_libdir} \ + --mandir=%{_mandir} \ + --docdir=%{_docdir}/python \ + --enable-ipv6 \ + --with-fpectl \ + --enable-shared \ + --with-system-ffi \ + --with-system-expat \ + --with-ensurepip=no \ + --enable-loadable-sqlite-extensions + +make %{?_smp_mflags} # DESTDIR=$RPM_BUILD_ROOT + +%check +# Limit virtual memory to avoid spurious failures +if test $(ulimit -v) = unlimited || test $(ulimit -v) -gt 10000000; then + ulimit -v 10000000 || : +fi + +# only test the parts skipped in python3-base +TESTS="test_curses test_dbm_gnu test_dbm_ndbm test_idle \ + test_readline test_sqlite test_ssl test_tcl \ + test_ttk_textonly" +# redo tests with SSL parts +TESTS="$TESTS test_asyncio test_hashlib test_urllib test_httplib \ + test_imaplib test_ftplib test_urllib2_localnet test_nntplib" + +# ensurepip-based tests +TESTS="$TESTS test_venv test_ensurepip test_tools" + +make test TESTOPTS="-u curses $TESTS" + +%install +rm -rf $RPM_BUILD_ROOT +make \ + OPT="%{optflags} -fPIC" \ + DESTDIR=$RPM_BUILD_ROOT \ + install + +# clean out stuff that is in python-base and subpackages + +rm $RPM_BUILD_ROOT%{_bindir}/* +rm $RPM_BUILD_ROOT%{_libdir}/lib* +rm -r $RPM_BUILD_ROOT%{_libdir}/pkgconfig +rm -r $RPM_BUILD_ROOT%{_mandir}/* +rm -r $RPM_BUILD_ROOT%{_includedir}/* + +rm -rf $RPM_BUILD_ROOT%{sitedir}/config* +find $RPM_BUILD_ROOT%{sitedir} -name "*.egg-info" -exec rm -f {} ";" +rm -rf $RPM_BUILD_ROOT%{sitedir}/__pycache__ +rm -rf $RPM_BUILD_ROOT%{sitedir}/site-packages +rm $RPM_BUILD_ROOT%{sitedir}/*.* + +for module in \ + asyncio ctypes collections concurrent distutils email encodings \ + html http \ + importlib json logging multiprocessing plat-* pydoc_data unittest \ + urllib venv wsgiref lib2to3 test idlelib turtledemo +do + rm -rf $RPM_BUILD_ROOT%{sitedir}/$module +done + +for library in \ + array audioop binascii _bisect _bz2 cmath _codecs_* _crypt _csv \ + _ctypes _datetime _decimal _elementtree fcntl grp _heapq _json _lsprof \ + _lzma math mmap _multibytecodec _multiprocessing nis _opcode ossaudiodev \ + parser _pickle _posixsubprocess _random resource select _socket spwd \ + _struct syslog termios _testbuffer _testimportmultiple _testmultiphase \ + unicodedata zlib _ctypes_test _testcapi xxlimited \ + _md5 _sha1 _sha256 _sha512 +do + eval rm -f "$RPM_BUILD_ROOT%{sitedir}/lib-dynload/$library.*" +done + +rm -rf $RPM_BUILD_ROOT%{sitedir}/tkinter +rm -rf $RPM_BUILD_ROOT%{sitedir}/dbm +rm -f $RPM_BUILD_ROOT%{sitedir}/lib-dynload/_gdbm.* + +%fdupes $RPM_BUILD_ROOT/%{_libdir}/python%{python_version} + +#%files tk +#%defattr(644, root, root, 755) +#%{sitedir}/tkinter +#%exclude %{sitedir}/tkinter/test +#%{dynlib _tkinter} + +%files curses +%defattr(644, root, root, 755) +%{sitedir}/curses +%{dynlib _curses} +%{dynlib _curses_panel} + +#%files dbm +#%defattr(644, root, root, 755) +#%{sitedir}/dbm +#%{dynlib _dbm} +#%{dynlib _gdbm} + +%files +%defattr(644, root, root, 755) +%dir %{sitedir} +%dir %{sitedir}/lib-dynload +%{sitedir}/ensurepip +%{sitedir}/sqlite3 +%exclude %{sitedir}/sqlite3/test +%{sitedir}/xml +%{sitedir}/xmlrpc +%{dynlib _hashlib} +%{dynlib pyexpat} +%{dynlib readline} +%{dynlib _sqlite3} +%{dynlib _ssl} +%{dynlib time} + +%changelog -- 2.34.1