From be7390e9b3b3af421d6cd1d5583d63b0f653b633 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Thu, 7 Dec 2017 13:15:53 +0900 Subject: [PATCH] Bump to python3 3.6.3 [Model] All [BinType] AP [Customer] OPEN [Issue#] N/A [Request] N/A [Occurrence Version] N/A [Problem] version upgrade [Cause & Measure] python3 3.4.4 -> 3.6.3 [Checking Method] python regrssion test [Team] Open Source Management and Setting Part [Developer] dh0128.kwak [Solution company] Samsung [Change Type] N/A Change-Id: Ia788e1dc9e10a7f1af7fd54196da729f609f29ae Signed-off-by: DongHun Kwak --- Makefile.pre.in | 19 +- Modules/getpath.c | 8 +- Objects/obmalloc.c | 3 + configure | 7 +- configure.ac | 7 +- packaging/macros.python3 | 26 +++ packaging/macros.python3.py | 33 ---- packaging/python3-base.spec | 385 ++++++++++++++++++++---------------- packaging/python3.spec | 265 ++++++++++++++----------- packaging/skipped_tests.py | 72 +++++++ 10 files changed, 496 insertions(+), 329 deletions(-) create mode 100644 packaging/macros.python3 delete mode 100644 packaging/macros.python3.py create mode 100644 packaging/skipped_tests.py diff --git a/Makefile.pre.in b/Makefile.pre.in index eb07b110..98a2415b 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -240,10 +240,11 @@ HOST_GNU_TYPE= @host@ TCLTK_INCLUDES= @TCLTK_INCLUDES@ TCLTK_LIBS= @TCLTK_LIBS@ -# The task to run while instrument when building the profile-opt target +# The task to run while instrumented when building the profile-opt target. +# We exclude unittests with -x that take a rediculious amount of time to +# run in the instrumented training build or do not provide much value. PROFILE_TASK= -#PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck -#PROFILE_TASK= $(srcdir)/Lib/test/regrtest.py +#PROFILE_TASK=-m test.regrtest --pgo # report files for gcov / lcov coverage report COVERAGE_INFO= $(abs_builddir)/coverage.info @@ -1501,12 +1502,12 @@ frameworkinstallstructure: $(LDLIBRARY) # Install a number of symlinks to keep software that expects a normal unix # install (which includes python-config) happy. frameworkinstallmaclib: - $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/python$(VERSION)/config-$(LDVERSION)/libpython$(LDVERSION).a" - $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/python$(VERSION)/config-$(LDVERSION)/libpython$(LDVERSION).dylib" - $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/python$(VERSION)/config-$(LDVERSION)/libpython$(VERSION).a" - $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/python$(VERSION)/config-$(LDVERSION)/libpython$(VERSION).dylib" - $(LN) -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(LDVERSION).dylib" - $(LN) -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(VERSION).dylib" + $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(LDVERSION).a" + $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(LDVERSION).dylib" + $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(VERSION).a" + $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(VERSION).dylib" + $(LN) -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(LDVERSION).dylib" + $(LN) -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(VERSION).dylib" # This installs the IDE, the Launcher and other apps into /Applications frameworkinstallapps: diff --git a/Modules/getpath.c b/Modules/getpath.c index 607619fe..87ecc557 100644 --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -495,10 +495,10 @@ calculate_path(void) wchar_t *_pythonpath, *_prefix, *_exec_prefix; wchar_t *lib_python; - _pythonpath = _Py_char2wchar(PYTHONPATH, NULL); - _prefix = _Py_char2wchar(PREFIX, NULL); - _exec_prefix = _Py_char2wchar(EXEC_PREFIX, NULL); - lib_python = _Py_char2wchar(BASE_LIB "/python" VERSION, NULL); + _pythonpath = Py_DecodeLocale(PYTHONPATH, NULL); + _prefix = Py_DecodeLocale(PREFIX, NULL); + _exec_prefix = Py_DecodeLocale(EXEC_PREFIX, NULL); + lib_python = Py_DecodeLocale(BASE_LIB "/python" VERSION, NULL); if (!_pythonpath || !_prefix || !_exec_prefix || !lib_python) { Py_FatalError( diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index efc4911d..eee75f2c 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -1235,6 +1235,9 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) _Py_AllocatedBlocks++; + assert(elsize == 0 || nelem <= PY_SSIZE_T_MAX / elsize); + nbytes = nelem * elsize; + #if defined(WITH_VALGRIND) || defined(SANITIZED_BUILD) if (UNLIKELY(running_on_valgrind == -1)) running_on_valgrind = RUNNING_ON_VALGRIND; diff --git a/configure b/configure index 46e34617..8d766c90 100755 --- a/configure +++ b/configure @@ -15005,8 +15005,11 @@ LDVERSION='$(VERSION)$(ABIFLAGS)' $as_echo "$LDVERSION" >&6; } -#LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}" -LIBPL='$(LIBDIR)'"/python${VERSION}/config-${LDVERSION}" +if test x$PLATFORM_TRIPLET = x; then + LIBPL='$(LIBDIR)'"/python${VERSION}/config-${LDVERSION}" +else + LIBPL='$(LIBDIR)'"/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}" +fi # Check whether right shifting a negative integer extends the sign bit diff --git a/configure.ac b/configure.ac index 1bcf67ca..3925363f 100644 --- a/configure.ac +++ b/configure.ac @@ -4656,8 +4656,11 @@ AC_MSG_RESULT($LDVERSION) dnl define LIBPL after ABIFLAGS and LDVERSION is defined. AC_SUBST(PY_ENABLE_SHARED) -#LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}" -LIBPL='$(LIBDIR)'"/python${VERSION}/config-${LDVERSION}" +if test x$PLATFORM_TRIPLET = x; then + LIBPL='$(LIBDIR)'"/python${VERSION}/config-${LDVERSION}" +else + LIBPL='$(LIBDIR)'"/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}" +fi AC_SUBST(LIBPL) # Check whether right shifting a negative integer extends the sign bit diff --git a/packaging/macros.python3 b/packaging/macros.python3 new file mode 100644 index 00000000..651ebfc6 --- /dev/null +++ b/packaging/macros.python3 @@ -0,0 +1,26 @@ +%have_python3 1 + +# commented out legacy macro definitions +#py3_prefix /usr +#py3_incdir /usr/include/python3.5m +#py3_ver 3.5 + +# these should now be provided by macros.python_all +#python3_sitearch /usr/lib64/python3.5/site-packages +#python3_sitelib /usr/lib/python3.5/site-packages +#python3_version 3.5 + +# hard to say if anyone ever used these? +#py3_soflags cpython-35m-x86_64-linux-gnu +#py3_abiflags m +%cpython3_soabi %(python3 -c "import sysconfig; print(sysconfig.get_config_var('SOABI'))") +%py3_soflags %cpython3_soabi + +# compilation macros that might be in use somewhere +%py3_compile(O) \ +find %1 -name '*.pyc' -exec rm -f {} ";"\ +python3 -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1\ +%{-O:\ +find %1 -name '*.pyo' -exec rm -f {} ";"\ +python3 -O -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1\ +} diff --git a/packaging/macros.python3.py b/packaging/macros.python3.py deleted file mode 100644 index f137456d..00000000 --- a/packaging/macros.python3.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/python3 - -""" generate macros.python3 file from known values """ - -import sys,os -from sysconfig import get_path, get_config_var - -version = "{}.{}".format(*sys.version_info) -abiflags = get_config_var("ABIFLAGS") - -macros = { - "py3_ver": version, - "python3_version": version, - "py3_prefix": sys.prefix, -# hack-fix for bnc#787526 - get_path can't be used this way in python build dir -# "py3_incdir": get_path("include"), - "py3_incdir": "/usr/include/python" + version + abiflags, - "py3_abiflags": abiflags, - "py3_soflags": get_config_var("SOABI"), - "python3_sitelib": get_path("purelib"), - "python3_sitearch": get_path("platlib"), - "py3_compile(O)": """ -find %1 -name '*.pyc' -exec rm -f {} ";" -python3 -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 -%{-O: -find %1 -name '*.pyo' -exec rm -f {} ";" -python3 -O -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 -}""", -} - -for (macro,definition) in macros.items(): - definition = "\\\n".join(definition.split("\n")) - print( "%{} {}".format(macro, definition)) diff --git a/packaging/python3-base.spec b/packaging/python3-base.spec index d77c891f..f32a93bf 100644 --- a/packaging/python3-base.spec +++ b/packaging/python3-base.spec @@ -1,7 +1,7 @@ # # spec file for package python3-base # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 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 @@ -22,40 +22,69 @@ # # see PACKAGING-NOTES for details # !!!! +### COMMON-DEF-BEGIN ### +%define tarversion %{version} +%define tarname Python-%{tarversion} +# the versions are autogenerated from pre_checkin.sh +# based on the current source tarball +%define python_version 3.6 +%define python_version_abitag 36 +%define python_version_soname 3_6 + +%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} +# version part of "libpython" package +%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}.so +### COMMON-DEF-END ### + +# that thing where "without" means "default=on" and vice versa +%bcond_without testsuite +%if 0%{?do_profiling} +%bcond_without profileopt +%else +%bcond_with profileopt +%endif Name: python3-base -BuildRequires: automake -BuildRequires: fdupes -#BuildRequires: libbz2-devel -BuildRequires: lzma-devel -BuildRequires: pkg-config -BuildRequires: timezone -BuildRequires: xz -BuildRequires: zlib-devel -Url: http://www.python.org/ -Summary: Python 3 Interpreter +Version: 3.6.3 +Release: 0 +Summary: Python 3 Interpreter and Stdlib Core License: Python-2.0 Group: Development/Languages/Python -Version: 3.4.4 -Release: 0 -%define tarversion %{version} -%define tarname Python-%{tarversion} - -# python 3.1 didn't have a separate python-base, so it is wrongly -# not a conflict to have python3-3.1 and python3-base > 3.1 -Obsoletes: python3 < 3.2 -# no Provides, because python3 is obviously provided by package python3 -# python3 3.4 provides asyncio -Provides: python3-asyncio = %{version} -Obsoletes: python3-asyncio < %{version} +Url: http://www.python.org/ +##### SOURCE FILES ##### Source0: http://www.python.org/ftp/python/%{version}/%{tarname}.tar.xz #Source1: http://www.python.org/ftp/python/%{version}/%{tarname}.tar.xz.asc +#Source2: python.keyring Source3: baselibs.conf +#Source4: README.SUSE Source5: python3start Source6: python3.sh Source7: python3.csh -Source8: macros.python3.py +Source8: macros.python3 Source9: import_failed.py Source10: import_failed.map @@ -65,64 +94,77 @@ Source10: import_failed.map Source100: PACKAGING-NOTES Source101: python3-rpmlintrc Source102: pre_checkin.sh +Source103: skipped_tests.py -BuildRoot: %{_tmppath}/%{name}-%{version}-build +##### REQURES, PROVIDES, OBSOLETES ##### +Requires: python-rpm-macros +Recommends: python3 = %{version} +#Recommends: python3-ensurepip -### 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 +# python 3.1 didn't have a separate python-base, so it is wrongly +# not a conflict to have python3-3.1 and python3-base > 3.1 +Obsoletes: python3 < 3.2 +# no Provides, because python3 is obviously provided by package python3 -%define sitedir %{_libdir}/python%{python_version} +# python 3.4 provides asyncio +Provides: python3-asyncio = %{version} +Obsoletes: python3-asyncio < %{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} +# python 3.6 provides typing +Provides: python3-typing = %{version} +Obsoletes: python3-typing < %{version} -%define so_version %{python_version_soname}%{abi_kind}1_0 +##### BUILDREQUIRES ##### +# SECTION required for basic build +BuildRequires: automake +BuildRequires: pkgconfig +# /SECTION +# SECTION required for core modules +# The compression-related ones could be moved to python3 if necessary, with the exception of zlib. +# _bz2 +BuildRequires: bzip2-devel +# _ctypes +BuildRequires: libffi-devel +# _lzma +BuildRequires: lzma-devel +# ssl +BuildRequires: openssl-devel >= 1.0.2 +# zlib +BuildRequires: zlib-devel +# nis +#BuildRequires: libnsl-devel -# 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 +# /SECTION +# SECTION required for build and testsuite +BuildRequires: fdupes +# netcfg is needed *only* for /etc/services for one test in test_asyncio +# this could be moved to python3 if needed, it's just more convenient here +#BuildRequires: netcfg +BuildRequires: timezone +BuildRequires: xz +# /SECTION -# 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 ### %description Python is an interpreted, object-oriented programming language, and is 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. +package. -If you want to install third party modules using distutils, you need to -install python-devel package. +This package contains the interpreter core and most commonly used modules +from the standard library. This is sufficient for many usecases, but it +excludes components that depend on external libraries, most notably XML, +database and UI toolkits support. %package -n python3-tools -Requires: %{name} = %{version} Summary: Python Utility and Demonstration Scripts Group: Development/Languages/Python +Requires: %{name} = %{version} Obsoletes: python3-demo < %{version} Provides: python3-demo = %{version} +Obsoletes: python3-2to3 < %{version} +Provides: python3-2to3 = %{version} %description -n python3-tools A number of scripts that are useful for building, testing or extending Python, @@ -130,10 +172,10 @@ and a set of demonstration programs. %package -n python3-idle -Requires: %{name} = %{version} -Requires: python3-tk Summary: An Integrated Development Environment for Python Group: Development/Languages/Python +Requires: %{name} = %{version} +Requires: python3-tk %description -n python3-idle IDLE is a Tkinter based integrated development environment for Python. @@ -143,11 +185,9 @@ a debugger. %package -n python3-devel -Requires: %{name} = %{version} -Provides: python3-2to3 = %{version} -Obsoletes: python3-2to3 < %{version} Summary: Include Files and Libraries Mandatory for Building Python Modules Group: Development/Languages/Python +Requires: %{name} = %{version} %description -n python3-devel The Python programming language's interpreter can be extended with @@ -162,17 +202,16 @@ package up to version 2.2.2. %package -n python3-testsuite -Requires: python3 = %{version} -Requires: python3-tk = %{version} Summary: Unit tests for Python and its standard library Group: Development/Languages/Python +Requires: python3 = %{version} +Requires: python3-tk = %{version} %description -n python3-testsuite Unit tests that are useful for verifying integrity and functionality of the installed Python interpreter and standard library. They are a documented part of stdlib, as a module 'test'. - %package -n libpython%{so_version} Summary: Python Interpreter shared library Group: Development/Languages/Python @@ -186,14 +225,6 @@ of Python in the documentation and tutorials included in the python-doc This package contains libpython3.2 shared library for embedding in other applications. -%package -n python3-dummy -Summary: dummy package -Group: Development/Languages/Python - -%description -n python3-dummy -dummy package - - %prep %setup -q -n %{tarname} @@ -205,30 +236,35 @@ 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 + # break up "/""usr" like this to prevent replacing with %{_prefix} 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@' + | xargs -0 grep -lE '^#! *(/''usr/.*bin/(env +)?)?python' \ + | xargs sed -r -i -e '1s@^#![[:space:]]*(/''usr/(local/)?bin/(env +)?)?python([0-9]+(\.[0-9]+)?)?@#!%{_bindir}/python3@' done +# drop in-tree libffi and expat +rm -r Modules/_ctypes/libffi* Modules/_ctypes/darwin +rm -r Modules/expat + +# drop duplicate README from site-packages +rm Lib/site-packages/README.txt + ### COMMON-PREP-END ### %build +### COMMON-CONFIG-BEGIN ### # use rpm_opt_flags -export OPT="%{optflags} -DOPENSSL_LOAD_CONF" +export OPT="%{optflags} -DOPENSSL_LOAD_CONF $(pkg-config --cflags-only-I libffi)" -touch -r %{S:0} Makefile.pre.in +touch -r %{SOURCE0} Makefile.pre.in autoreconf -fi -# prevent make from trying to rebuild asdl stuff, which requires existing python installation -touch Parser/asdl* Python/Python-ast.c Include/Python-ast.h -# prevent makeopcodetargets -touch -r Python/opcode_targets.h Lib/opcode.py Python/makeopcodetargets.py %if 0%{?sles_version} sed -e 's/-fprofile-correction//' -i Makefile.pre.in %endif -./configure \ +%configure \ --prefix=%{_prefix} \ --libdir=%{_libdir} \ --mandir=%{_mandir} \ @@ -237,21 +273,34 @@ sed -e 's/-fprofile-correction//' -i Makefile.pre.in --with-fpectl \ --enable-shared \ --with-ensurepip=no \ + --with-system-ffi \ + --with-system-expat \ + --enable-lto \ --enable-loadable-sqlite-extensions -%if 0%{?do_profiling} -target=profile-opt +# prevent make from trying to rebuild PYTHON_FOR_GEN stuff +make -t Python/Python-ast.c \ + Include/Python-ast.h \ + Objects/typeslots.inc \ + Python/opcode_targets.h \ + Include/opcode.h + +### COMMON-CONFIG-END ### + +%if %{with profileopt} + target=profile-opt %else -target=all + target=all %endif LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH \ make %{?_smp_mflags} BASE_LIB=%{_lib} $target %check -# SUSE's gdb breaks test_gdb by producing spurious output (zypper suggestions) -# test_socket fails because of name resolution failure, that is expected -EXCLUDE="test_gdb test_socket" -%ifarch %arm +# exclude test_gdb -- it doesn't run in buildservice anyway, and fails on missing debuginfos +# when you install gdb into your test env +EXCLUDE="test_gdb" + +%ifarch %{arm} # test_multiprocessing_forkserver is racy EXCLUDE="$EXCLUDE test_multiprocessing_forkserver" %endif @@ -261,72 +310,73 @@ EXCLUDE="$EXCLUDE test_faulthandler" %endif # some tests break in QEMU %if 0%{?qemu_user_space_build} > 0 -EXCLUDE="$EXCLUDE test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_main_handling test_multiprocessing_spawn test_threading test_threadedtempfile test_io test_posix test_ioctl test_mmap test_openpty test_pty test_monotonic_settime test_clock_settime test_time test_subprocess test_asyncore test_asyncio test_send_at_certain_offset test_send_whole_file test_os test_faulthandler" +EXCLUDE="$EXCLUDE test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_main_handling test_multiprocessing_spawn test_threading test_threadedtempfile test_io test_posix test_ioctl test_mmap test_openpty test_pty test_time test_subprocess test_asyncore test_asyncio test_os test_faulthandler" # qemu bug (siginterrupt handling) EXCLUDE="$EXCLUDE test_signal" %endif -# on x86_64, SLE_11_SP2 only, extreme gamma function values (close to negative -# integers) fail. Is probably a bug/imperfection in -lm -# disabling this for all SLE, unless someone knows how to test for SP level? -%ifarch x86_64 -%if 0%{?sles_version} == 11 -EXCLUDE="$EXCLUDE test_math" -%endif -%endif - # This test (part of test_uuid) requires real network interfaces # so that ifconfig output has "HWaddr ". Some kvm instances -# done have any such interface breaking teh uuid module. +# done have any such interface breaking the uuid module. EXCLUDE="$EXCLUDE test_uuid" -# Exclude test_tools, test_venv and test_ensurepip which indirectly require ssl -EXCLUDE="$EXCLUDE test_tools test_venv test_ensurepip" +# XML tests +EXCLUDE="$EXCLUDE test_docxmlrpc test_minidom test_pulldom test_pyexpat \ + test_xml_etree test_xml_etree_c test_xmlrpc test_xmlrpc_net" +# tests for components that require XML indirectly +EXCLUDE="$EXCLUDE test_plistlib test_venv \ + test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_spawn" # Limit virtual memory to avoid spurious failures if test $(ulimit -v) = unlimited || test $(ulimit -v) -gt 10000000; then ulimit -v 10000000 || : fi -make test TESTOPTS="-u none -x $EXCLUDE" +%if %{with testsuite} +make -j1 test TESTOPTS="-u none -x $EXCLUDE" # use network, be verbose: #make test TESTOPTS="-l -u network -v" +%endif %install rm -rf $RPM_BUILD_ROOT make \ OPT="%{optflags} -fPIC" \ - DESTDIR=$RPM_BUILD_ROOT \ + DESTDIR=%{buildroot} \ install # remove .a -find ${RPM_BUILD_ROOT} -name "*.a" -exec rm {} ";" +find %{buildroot} -name "*.a" -exec rm {} ";" # install "site-packages" and __pycache__ for third parties -install -d -m 755 ${RPM_BUILD_ROOT}%{sitedir}/site-packages -install -d -m 755 ${RPM_BUILD_ROOT}%{sitedir}/site-packages/__pycache__ +install -d -m 755 %{buildroot}%{sitedir}/site-packages +install -d -m 755 %{buildroot}%{sitedir}/site-packages/__pycache__ # and their 32bit counterparts explicitly -mkdir -p ${RPM_BUILD_ROOT}/usr/lib/python%{python_version}/site-packages/__pycache__ +mkdir -p %{buildroot}%{_prefix}/lib/python%{python_version}/site-packages/__pycache__ # cleanup parts that don't belong -#for dir in curses dbm ensurepip sqlite3 tkinter xml xmlrpc; do -# find $RPM_BUILD_ROOT%{sitedir}/$dir/* -maxdepth 0 -name "test" -o -exec rm -rf {} ";" -#done -rm $RPM_BUILD_ROOT%{dynlib pyexpat} +for dir in curses dbm ensurepip sqlite3 tkinter xml xmlrpc; do + find %{buildroot}%{sitedir}/$dir/* -maxdepth 0 -name "test" -o -exec rm -rf {} ";" +done +# rm $RPM_BUILD_ROOT%{dynlib pyexpat} # overwrite the copied binary with a link -ln -sf python%{python_version} ${RPM_BUILD_ROOT}%{_bindir}/python3 +ln -sf python%{python_version} %{buildroot}%{_bindir}/python3 + +# link shared library instead of static library that tools expect +#ln -s libpython%{python_abi}.so %{buildroot}%{_libdir}/python%{python_version}/config-%{python_abi}-%{archname}-%{_os}%{?_gnu}%{?armsuffix}/libpython%{python_abi}.so +ln -s libpython%{python_abi}.so %{buildroot}%{_libdir}/python%{python_version}/config-%{python_abi}-%{archname}-%{_os}%{?_gnu}/libpython%{python_abi}.so # replace duplicate .pyo/.pyc with hardlinks -%fdupes $RPM_BUILD_ROOT/%{sitedir} +%fdupes %{buildroot}/%{sitedir} # documentation -export PDOCS=${RPM_BUILD_ROOT}%{_docdir}/%{name} +export PDOCS=%{buildroot}%{_docdir}/%{name} install -d -m 755 $PDOCS -#install -c -m 644 %{S:4} $PDOCS/ -install -c -m 644 LICENSE $PDOCS/ -install -c -m 644 README $PDOCS/ +#install -c -m 644 %{SOURCE4} $PDOCS/ +install -c -m 644 LICENSE $PDOCS/ +install -c -m 644 README.rst $PDOCS/ # tools for x in `find Tools/ \( -not -name Makefile \) -print | sort` ; do @@ -340,28 +390,28 @@ find $PDOCS -name "*.bat" -exec rm {} ";" #cp Makefile Makefile.pre.in Makefile.pre $RPM_BUILD_ROOT%{sitedir}/config-%{python_abi}/ # move idle config into /etc -install -d -m 755 ${RPM_BUILD_ROOT}/etc/idle3 -( - cd ${RPM_BUILD_ROOT}/%{sitedir}/idlelib/ +install -d -m 755 %{buildroot}%{_sysconfdir}/idle3 +( + cd %{buildroot}/%{sitedir}/idlelib/ for file in *.def ; do - mv $file ${RPM_BUILD_ROOT}/etc/idle3/ - ln -sf /etc/idle3/$file ${RPM_BUILD_ROOT}/%{sitedir}/idlelib/ + mv $file %{buildroot}%{_sysconfdir}/idle3/ + ln -sf %{_sysconfdir}/idle3/$file %{buildroot}/%{sitedir}/idlelib/ done ) # startup scripts -mkdir -p $RPM_BUILD_ROOT/etc/profile.d -install -m 644 %{S:5} $RPM_BUILD_ROOT/etc # python3start -install -m 644 %{S:6} %{S:7} $RPM_BUILD_ROOT/etc/profile.d # python3.sh, python3.csh +mkdir -p %{buildroot}%{_sysconfdir}/profile.d +install -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir} # python3start +install -m 644 %{SOURCE6} %{SOURCE7} %{buildroot}%{_sysconfdir}/profile.d # python3.sh, python3.csh # RPM macros -mkdir -p $RPM_BUILD_ROOT/etc/rpm -LD_LIBRARY_PATH=. ./python %{S:8} > $RPM_BUILD_ROOT/etc/rpm/macros.python3 # macros.python3.py +mkdir -p %{buildroot}%{_sysconfdir}/rpm +install -m 644 %{SOURCE8} %{buildroot}%{_sysconfdir}/rpm # macros.python3 # import_failed hooks -FAILDIR=$RPM_BUILD_ROOT/%{sitedir}/_import_failed +FAILDIR=%{buildroot}/%{sitedir}/_import_failed mkdir $FAILDIR -install -m 644 %{S:9} %{S:10} $FAILDIR # import_failed.* +install -m 644 %{SOURCE9} %{SOURCE10} $FAILDIR # import_failed.* LD_LIBRARY_PATH=. ./python -c "from py_compile import compile; compile('$FAILDIR/import_failed.py', dfile='%{sitedir}/_import_failed/import_failed.py')" LD_LIBRARY_PATH=. ./python -O -c "from py_compile import compile; compile('$FAILDIR/import_failed.py', dfile='%{sitedir}/_import_failed/import_failed.py')" ( @@ -375,9 +425,9 @@ LD_LIBRARY_PATH=. ./python -O -c "from py_compile import compile; compile('$FAIL done popd done - done < %{S:10} + done < %{SOURCE10} ) -echo %{sitedir}/_import_failed > $RPM_BUILD_ROOT/%{sitedir}/site-packages/zzzz-import-failed-hooks.pth +echo %{sitedir}/_import_failed > %{buildroot}/%{sitedir}/site-packages/zzzz-import-failed-hooks.pth %post -n libpython%{so_version} -p /sbin/ldconfig @@ -390,13 +440,16 @@ echo %{sitedir}/_import_failed > $RPM_BUILD_ROOT/%{sitedir}/site-packages/zzzz-i %files -n python3-tools %defattr(644, root, root, 755) %{sitedir}/turtledemo +%license LICENSE +%{_bindir}/2to3 +%attr(755, root, root)%{_bindir}/2to3-%{python_version} %doc %{_docdir}/%{name}/Tools %files -n python3-idle %defattr(644, root, root, 755) %{sitedir}/idlelib -%dir /etc/idle3 -%config /etc/idle3/* +%dir %{_sysconfdir}/idle3 +%config %{_sysconfdir}/idle3/* %doc Lib/idlelib/NEWS.txt %doc Lib/idlelib/README.txt %doc Lib/idlelib/TODO.txt @@ -407,27 +460,28 @@ echo %{sitedir}/_import_failed > $RPM_BUILD_ROOT/%{sitedir}/site-packages/zzzz-i %files -n python3-devel %defattr(644, root, root, 755) +%license LICENSE %{_libdir}/libpython%{python_abi}.so %{_libdir}/libpython3.so %{_libdir}/pkgconfig/* -%{_prefix}/include/python%{python_abi} -%exclude %{_prefix}/include/python%{python_abi}/pyconfig.h +%{_includedir}/python%{python_abi} +%{sitedir}/config-%{python_abi}-* %defattr(755, root, root) %{_bindir}/python%{python_abi}-config %{_bindir}/python%{python_version}-config %{_bindir}/python3-config -%{_bindir}/2to3 -%{_bindir}/2to3-%{python_version} %files -n python3-testsuite %defattr(644, root, root, 755) +%license LICENSE %{sitedir}/test %{sitedir}/*/test +%{sitedir}/*/tests %{dynlib _ctypes_test} %{dynlib _testbuffer} %{dynlib _testcapi} %{dynlib _testimportmultiple} -#%{dynlib _testmultiphase} +%{dynlib _testmultiphase} %{dynlib xxlimited} # workaround for missing packages %dir %{sitedir}/sqlite3 @@ -436,28 +490,29 @@ echo %{sitedir}/_import_failed > $RPM_BUILD_ROOT/%{sitedir}/site-packages/zzzz-i %files %defattr(644, root, root, 755) # profile files -%config /etc/python3start -%config /etc/profile.d/python3.* +%config %{_sysconfdir}/python3start +%config %{_sysconfdir}/profile.d/python3.* +%license LICENSE # docs %dir %{_docdir}/%{name} -%doc %{_docdir}/%{name}/README +%doc %{_docdir}/%{name}/README.rst %doc %{_docdir}/%{name}/LICENSE -%doc %{_mandir}/man1/python3.1* -%doc %{_mandir}/man1/python%{python_version}.1* +#%doc %{_docdir}/%{name}/README.SUSE +%{_mandir}/man1/python3.1* +%{_mandir}/man1/python%{python_version}.1* # license text, not a doc because the code can use it at run-time %{sitedir}/LICENSE.txt -# makefile etc -%{sitedir}/config-%{python_abi} -/etc/rpm/macros.python3 -%{_prefix}/include/python%{python_abi}/pyconfig.h +# RPM macros +%{_sysconfdir}/rpm/macros.python3 # binary parts %dir %{sitedir}/lib-dynload -#%{sitedir}/lib-dynload/Python-%{tarversion}-py%{python_version}.egg-info + %{dynlib array} +%{dynlib _asyncio} %{dynlib audioop} %{dynlib binascii} %{dynlib _bisect} -#%{dynlib _bz2} +%{dynlib _bz2} %{dynlib cmath} %{dynlib _codecs_cn} %{dynlib _codecs_hk} @@ -470,9 +525,9 @@ echo %{sitedir}/_import_failed > $RPM_BUILD_ROOT/%{sitedir}/site-packages/zzzz-i %{dynlib _ctypes} %{dynlib _datetime} %{dynlib _decimal} -%{dynlib _elementtree} %{dynlib fcntl} %{dynlib grp} +%{dynlib _hashlib} %{dynlib _heapq} %{dynlib _json} %{dynlib _lsprof} @@ -491,6 +546,7 @@ echo %{sitedir}/_import_failed > $RPM_BUILD_ROOT/%{sitedir}/site-packages/zzzz-i %{dynlib resource} %{dynlib select} %{dynlib _socket} +%{dynlib _ssl} %{dynlib spwd} %{dynlib _struct} %{dynlib syslog} @@ -498,19 +554,21 @@ echo %{sitedir}/_import_failed > $RPM_BUILD_ROOT/%{sitedir}/site-packages/zzzz-i %{dynlib unicodedata} %{dynlib zlib} # hashlib fallback modules +%{dynlib _blake2} %{dynlib _md5} %{dynlib _sha1} %{dynlib _sha256} %{dynlib _sha512} - +%{dynlib _sha3} # python parts -#%dir /usr/lib/python%{python_version} -#%dir /usr/lib/python%{python_version}/site-packages -#%dir /usr/lib/python%{python_version}/site-packages/__pycache__ +%dir %{_prefix}/lib/python%{python_version} +%dir %{_prefix}/lib/python%{python_version}/site-packages +%dir %{_prefix}/lib/python%{python_version}/site-packages/__pycache__ %dir %{sitedir} %dir %{sitedir}/site-packages %dir %{sitedir}/site-packages/__pycache__ %exclude %{sitedir}/*/test +%exclude %{sitedir}/*/tests %{sitedir}/*.py %{sitedir}/asyncio %{sitedir}/ctypes @@ -526,13 +584,11 @@ echo %{sitedir}/_import_failed > $RPM_BUILD_ROOT/%{sitedir}/site-packages/zzzz-i %{sitedir}/lib2to3 %{sitedir}/logging %{sitedir}/multiprocessing -%{sitedir}/plat-* %{sitedir}/pydoc_data %{sitedir}/unittest %{sitedir}/urllib %{sitedir}/venv %{sitedir}/wsgiref -%{sitedir}/site-packages/README %{sitedir}/__pycache__ # import-failed hooks %{sitedir}/_import_failed @@ -572,9 +628,4 @@ echo %{sitedir}/_import_failed > $RPM_BUILD_ROOT/%{sitedir}/site-packages/zzzz-i %attr(755, root, root) %{_bindir}/python%{python_version} %attr(755, root, root) %{_bindir}/pyvenv-%{python_version} -%files -n python3-dummy -%defattr(644, root, root, 755) -%{dynlib time} - %changelog - diff --git a/packaging/python3.spec b/packaging/python3.spec index 4aa89a52..180ce99e 100644 --- a/packaging/python3.spec +++ b/packaging/python3.spec @@ -1,7 +1,7 @@ # # spec file for package python3 # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 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 @@ -16,80 +16,29 @@ # -Name: python3 -BuildRequires: automake -#BuildRequires: db-devel -BuildRequires: fdupes -BuildRequires: gcc-c++ -BuildRequires: gdbm-devel -BuildRequires: gettext-tools -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 ### - +%define tarversion %{version} +%define tarname Python-%{tarversion} # 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 python_version 3.6 +%define python_version_abitag 36 +%define python_version_soname 3_6 %define sitedir %{_libdir}/python%{python_version} -# three possible ABI kinds: m - pymalloc, d - debug build -# see PEP 3149 -%define abi_kind m +# 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 abi_tag %{python_version_abitag}%{abi_kind} +# version part of "libpython" package %define so_version %{python_version_soname}%{abi_kind}1_0 # rpm and python have different ideas about what is an arch-dependent name, so: @@ -99,43 +48,106 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build %define archname %{_arch} %endif # our arm has Hardware-Floatingpoint -%if %{_arch} == arm -%define armsuffix hf -%endif +#%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 +%define dynlib() %{sitedir}/lib-dynload/%{1}.cpython-%{abi_tag}-%{archname}-%{_os}%{?_gnu}.so ### COMMON-DEF-END ### - +# +Name: python3 +Version: 3.6.3 +Release: 0 +Summary: Python 3 Interpreter +License: Python-2.0 +Group: Development/Languages/Python +Url: http://www.python.org/ +Source0: http://www.python.org/ftp/python/%{version}/%{tarname}.tar.xz +#Source1: http://www.python.org/ftp/python/%{version}/%{tarname}.tar.xz.asc +BuildRequires: automake +BuildRequires: fdupes +BuildRequires: gcc-c++ +BuildRequires: gdbm-devel +BuildRequires: gettext-tools +BuildRequires: gmp-devel +BuildRequires: intltool +BuildRequires: bzip2-devel +BuildRequires: libexpat-devel +BuildRequires: libffi-devel +#BuildRequires: libnsl-devel +BuildRequires: lzma-devel +BuildRequires: ncurses-devel +#BuildRequires: netcfg +BuildRequires: openssl-devel +BuildRequires: pkgconfig +BuildRequires: readline-devel +BuildRequires: sqlite-devel +#BuildRequires: tk-devel +BuildRequires: xz +#BuildRequires: pkgconfig(x11) +Requires: python3-base = %{version} +Recommends: python3-curses +Recommends: python3-dbm +Recommends: python3-idle +Recommends: python3-pip +#Recommends: python3-tk # some compatibility Provides #Provides: python = %{python_version} Provides: python3 = %{python_version} Provides: python3-xml = %{version} Obsoletes: python3-xml < %{version} +# +# do not add patches here, please edit python3-base.spec instead +# and run pre_checkin.sh +# +# see PACKAGING-NOTES for details +# + %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. + +This package supplies rich command line features provided by readline, +XML processing tools, "ensurepip" installer, and sqlite3 support for +the interpreter core, thus forming a so called "extended" runtime. +Installing "python3" is sufficient for the vast majority of usecases. +In addition, recommended packages provide UI toolkit support (python3-curses, +python3-tk), legacy UNIX database bindings (python3-dbm), and the IDLE +development environment (python3-idle). + +%package tk +Summary: TkInter - Python Tk Interface +Group: Development/Libraries/Python +Requires: %{name} = %{version} +%description tk +Python interface to Tk. Tk is the GUI toolkit that comes with Tcl. The +"xrpm" package uses this Python interface. %package curses -Requires: %{name} = %{version} Summary: Python Interface to the (N)Curses Library Group: Development/Libraries/Python +Requires: %{name} = %{version} %description curses An easy to use interface to the (n)curses CUI library. CUI stands for Console User Interface. +#%package dbm +#Summary: Python Interface to the GDBM Library +#Group: Development/Languages/Python +#Requires: %{name} = %{version} + +#%description dbm +#An easy to use interface for Unix DBM databases, and more specifically, +#the GNU implementation GDBM. %prep %setup -q -n %{tarname} @@ -147,23 +159,35 @@ 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 + # break up "/""usr" like this to prevent replacing with %{_prefix} 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@' + | xargs -0 grep -lE '^#! *(/''usr/.*bin/(env +)?)?python' \ + | xargs sed -r -i -e '1s@^#![[:space:]]*(/''usr/(local/)?bin/(env +)?)?python([0-9]+(\.[0-9]+)?)?@#!%{_bindir}/python3@' done +# drop in-tree libffi and expat +rm -r Modules/_ctypes/libffi* Modules/_ctypes/darwin +rm -r Modules/expat + +# drop duplicate README from site-packages +rm Lib/site-packages/README.txt + ### COMMON-PREP-END ### %build -export SUSE_ASNEEDED=0 -export OPT="%{optflags} -DOPENSSL_LOAD_CONF" +### COMMON-CONFIG-BEGIN ### +# use rpm_opt_flags +export OPT="%{optflags} -DOPENSSL_LOAD_CONF $(pkg-config --cflags-only-I libffi)" + +touch -r %{SOURCE0} Makefile.pre.in -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 +autoreconf -fi -./configure \ +%if 0%{?sles_version} +sed -e 's/-fprofile-correction//' -i Makefile.pre.in +%endif + +%configure \ --prefix=%{_prefix} \ --libdir=%{_libdir} \ --mandir=%{_mandir} \ @@ -171,12 +195,22 @@ touch Parser/asdl* Python/Python-ast.c Include/Python-ast.h Objects/typeslots.in --enable-ipv6 \ --with-fpectl \ --enable-shared \ + --with-ensurepip=no \ --with-system-ffi \ --with-system-expat \ - --with-ensurepip=no \ + --enable-lto \ --enable-loadable-sqlite-extensions -make %{?_smp_mflags} BASE_LIB=%{_lib} +# prevent make from trying to rebuild PYTHON_FOR_GEN stuff +make -t Python/Python-ast.c \ + Include/Python-ast.h \ + Objects/typeslots.inc \ + Python/opcode_targets.h \ + Include/opcode.h + +### COMMON-CONFIG-END ### + +make %{?_smp_mflags} %check # Limit virtual memory to avoid spurious failures @@ -186,64 +220,69 @@ 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_readline test_sqlite test_tcl test_tix test_tk \ 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" +%if !0%{?qemu_user_space_build} +TESTS="$TESTS test_asyncio" +%endif -# ensurepip-based tests -TESTS="$TESTS test_venv test_ensurepip test_tools" +# XML tests +TESTS="$TESTS test_docxmlrpc test_minidom test_pulldom test_pyexpat \ + test_xml_etree test_xml_etree_c test_xmlrpc test_xmlrpc_net" +# XML-dependent tests +TESTS="$TESTS test_plistlib test_venv \ + test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_spawn" -make test TESTOPTS="-u curses $TESTS" +make -j1 test TESTOPTS="-u curses $TESTS" %install rm -rf $RPM_BUILD_ROOT make \ OPT="%{optflags} -fPIC" \ - DESTDIR=$RPM_BUILD_ROOT \ + DESTDIR=%{buildroot} \ 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 %{buildroot}%{_bindir}/* +rm %{buildroot}%{_libdir}/lib* +rm -r %{buildroot}%{_libdir}/pkgconfig +rm -r %{buildroot}%{_mandir}/* +rm -r %{buildroot}%{_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}/*.* +rm -r %{buildroot}%{sitedir}/config* +find %{buildroot}%{sitedir} -name "*.egg-info" -exec rm {} ";" +rm -r %{buildroot}%{sitedir}/__pycache__ +rm -r %{buildroot}%{sitedir}/site-packages +rm %{buildroot}%{sitedir}/*.* for module in \ asyncio ctypes collections concurrent distutils email encodings \ html http \ - importlib json logging multiprocessing plat-* pydoc_data unittest \ + importlib json logging multiprocessing pydoc_data unittest \ urllib venv wsgiref lib2to3 test idlelib turtledemo do - rm -rf $RPM_BUILD_ROOT%{sitedir}/$module + rm -r %{buildroot}%{sitedir}/$module done for library in \ - array audioop binascii _bisect _bz2 cmath _codecs_* _crypt _csv \ - _ctypes _datetime _decimal _elementtree fcntl grp _heapq _json _lsprof \ + array _asyncio audioop binascii _bisect _bz2 cmath _codecs_* _crypt _csv \ + _ctypes _datetime _decimal fcntl grp _hashlib _heapq _json _lsprof \ _lzma math mmap _multibytecodec _multiprocessing nis _opcode ossaudiodev \ - parser _pickle _posixsubprocess _random resource select _socket spwd \ + parser _pickle _posixsubprocess _random resource select _ssl _socket spwd \ _struct syslog termios _testbuffer _testimportmultiple _testmultiphase \ unicodedata zlib _ctypes_test _testcapi xxlimited \ - _md5 _sha1 _sha256 _sha512 + _md5 _sha1 _sha256 _sha512 _blake2 _sha3 do - eval rm -f "$RPM_BUILD_ROOT%{sitedir}/lib-dynload/$library.*" + eval rm "%{buildroot}%{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} +%fdupes %{buildroot}/%{_libdir}/python%{python_version} #%files tk #%defattr(644, root, root, 755) @@ -253,12 +292,14 @@ rm -f $RPM_BUILD_ROOT%{sitedir}/lib-dynload/_gdbm.* %files curses %defattr(644, root, root, 755) +%license LICENSE %{sitedir}/curses %{dynlib _curses} %{dynlib _curses_panel} #%files dbm #%defattr(644, root, root, 755) +#%license LICENSE #%{sitedir}/dbm #%{dynlib _dbm} #%{dynlib _gdbm} @@ -267,16 +308,16 @@ rm -f $RPM_BUILD_ROOT%{sitedir}/lib-dynload/_gdbm.* %defattr(644, root, root, 755) %dir %{sitedir} %dir %{sitedir}/lib-dynload +%license LICENSE %{sitedir}/ensurepip %{sitedir}/sqlite3 %exclude %{sitedir}/sqlite3/test %{sitedir}/xml %{sitedir}/xmlrpc -%{dynlib _hashlib} +%{dynlib _elementtree} %{dynlib pyexpat} %{dynlib readline} %{dynlib _sqlite3} -%{dynlib _ssl} -%{dynlib time} %changelog + diff --git a/packaging/skipped_tests.py b/packaging/skipped_tests.py new file mode 100644 index 00000000..d75d5be3 --- /dev/null +++ b/packaging/skipped_tests.py @@ -0,0 +1,72 @@ +#!/usr/bin/python3 +""" +Simple regexp-based skipped test checker. +It lists tests that are mentioned (presumably for exclusion) +in BASE, and in MAIN (presumably for inclusion) +and reports discrepancies. + +This will have a number of +""" + +BASE = "python3-base.spec" +MAIN = "python3.spec" + +import glob +import re +from os.path import basename + +alltests = set() +qemu_exclusions = set() + +for item in glob.glob("Python-*/Lib/test/test_*"): + testname = basename(item) + if testname.endswith(".py"): + testname = testname[:-3] + alltests.add(testname) + +testre = re.compile(r'[\s"](test_\w+)\b') + +def find_tests_in_spec(specname): + global qemu_exclusions + + found_tests = set() + with open(specname) as spec: + in_qemu = False + for line in spec: + line = line.strip() + if "#" in line: + line = line[:line.index("#")] + tests = set(testre.findall(line)) + found_tests |= tests + if line == "%if 0%{?qemu_user_space_build} > 0": + in_qemu = True + if in_qemu: + if line == "%endif": + in_qemu = False + qemu_exclusions |= tests + return found_tests + +excluded = find_tests_in_spec(BASE) +included = find_tests_in_spec(MAIN) + +#print("--- excluded tests:", " ".join(sorted(excluded))) +#print("--- included tests:", " ".join(sorted(included))) + +mentioned = excluded | included +nonexistent = mentioned - alltests +missing = excluded - included - qemu_exclusions + +print("--- the following tests are excluded for QEMU and not tested in python") +print("--- (that probably means we don't need to worry about them)") +for test in sorted(qemu_exclusions - included): + print(test) + +print("--- the following tests might be excluded from python-base but not tested in python:") +for test in sorted(missing): + print(test) + +if nonexistent: + print("--- the following tests don't exist:") + for test in sorted(nonexistent): + print(test) + -- 2.34.1