commit c50216afa346d5fcb6a89a4e6e4b674f957ee1a5 Author: Rosa Date: Wed Feb 1 19:19:07 2012 +0400 Automatic import for version 3.2.1 diff --git a/.abf.yml b/.abf.yml new file mode 100644 index 0000000..1736d11 --- /dev/null +++ b/.abf.yml @@ -0,0 +1,3 @@ +sources: + "Python-3.2.1.tar.xz": ab5cf4a4c21abe590dea87473a1dee6820699d79 + "python-3.2.1-docs-html.tar.bz2": 8652bddc4c7396f06e0903678199539edffdb45f diff --git a/python-2.5-tcl86.patch b/python-2.5-tcl86.patch new file mode 100644 index 0000000..7c5ebb8 --- /dev/null +++ b/python-2.5-tcl86.patch @@ -0,0 +1,11 @@ +--- Python-2.6/setup.py 2008-09-29 17:15:45.000000000 -0700 ++++ Python-2.6/setup.py.new 2008-10-16 09:42:45.000000000 -0700 +@@ -1518,7 +1518,7 @@ + # The versions with dots are used on Unix, and the versions without + # dots on Windows, for detection by cygwin. + tcllib = tklib = tcl_includes = tk_includes = None +- for version in ['8.5', '85', '8.4', '84', '8.3', '83', '8.2', ++ for version in ['8.6', '86', '8.5', '85', '8.4', '84', '8.3', '83', '8.2', + '82', '8.1', '81', '8.0', '80']: + tklib = self.compiler.find_library_file(lib_dirs, 'tk' + version) + tcllib = self.compiler.find_library_file(lib_dirs, 'tcl' + version) diff --git a/python-3.1.2-module-linkage.patch b/python-3.1.2-module-linkage.patch new file mode 100644 index 0000000..78237b0 --- /dev/null +++ b/python-3.1.2-module-linkage.patch @@ -0,0 +1,24 @@ +--- setup.py.link 2010-01-01 17:29:51.000000000 +0100 ++++ setup.py 2010-10-31 17:33:25.000000000 +0100 +@@ -489,7 +489,7 @@ + # Operations on audio samples + # According to #993173, this one should actually work fine on + # 64-bit platforms. +- exts.append( Extension('audioop', ['audioop.c']) ) ++ exts.append( Extension('audioop', ['audioop.c'], libraries=math_libs) ) + + # readline + do_readline = self.compiler.find_library_file(lib_dirs, 'readline') +@@ -1542,10 +1542,11 @@ + include_dirs=include_dirs, + extra_compile_args=extra_compile_args, + extra_link_args=extra_link_args, +- libraries=[], ++ libraries=['m', 'dl'], + sources=sources, + depends=depends) + ext_test = Extension('_ctypes_test', ++ libraries=['m'], + sources=['_ctypes/_ctypes_test.c']) + self.extensions.extend([ext, ext_test]) + diff --git a/python3-disable-pymalloc-on-valgrind.patch b/python3-disable-pymalloc-on-valgrind.patch new file mode 100644 index 0000000..901dcb6 --- /dev/null +++ b/python3-disable-pymalloc-on-valgrind.patch @@ -0,0 +1,122 @@ +diff -p -up Python-3.1.2/configure.in.valgrind~ Python-3.1.2/configure.in +--- Python-3.1.2/configure.in.valgrind~ 2010-05-27 23:59:21.955477329 +0200 ++++ Python-3.1.2/configure.in 2010-05-27 23:59:47.150476510 +0200 +@@ -2478,6 +2478,19 @@ then + fi + AC_MSG_RESULT($with_pymalloc) + ++# Check for Valgrind support ++AC_MSG_CHECKING([for --with-valgrind]) ++AC_ARG_WITH([valgrind], ++ AC_HELP_STRING([--with-valgrind], [Enable Valgrind support]),, ++ with_valgrind=no) ++AC_MSG_RESULT([$with_valgrind]) ++if test "$with_valgrind" != no; then ++ AC_CHECK_HEADER([valgrind/valgrind.h], ++ [AC_DEFINE([WITH_VALGRIND], 1, [Define if you want pymalloc to be disabled when running under valgrind])], ++ [AC_MSG_ERROR([Valgrind support requested but headers not available])] ++ ) ++fi ++ + # Check for --with-wctype-functions + AC_MSG_CHECKING(for --with-wctype-functions) + AC_ARG_WITH(wctype-functions, +diff -p -up Python-3.1.2/Misc/NEWS.valgrind~ Python-3.1.2/Misc/NEWS +--- Python-3.1.2/Misc/NEWS.valgrind~ 2010-05-27 23:59:20.795726096 +0200 ++++ Python-3.1.2/Misc/NEWS 2010-05-27 23:59:47.154486551 +0200 +@@ -119,6 +119,11 @@ Core and Builtins + - Issue #6750: A text file opened with io.open() could duplicate its output + when writing from multiple threads at the same time. + ++- Issue #2422: When compiled with the ``--with-valgrind`` option, the ++ pymalloc allocator will be automatically disabled when running under ++ Valgrind. This gives improved memory leak detection when running ++ under Valgrind, while taking advantage of pymalloc at other times. ++ + Library + ------- + +diff -p -up Python-3.1.2/Objects/obmalloc.c.valgrind~ Python-3.1.2/Objects/obmalloc.c +--- Python-3.1.2/Objects/obmalloc.c.valgrind~ 2010-05-27 23:59:21.931726329 +0200 ++++ Python-3.1.2/Objects/obmalloc.c 2010-05-27 23:59:47.152476257 +0200 +@@ -2,6 +2,21 @@ + + #ifdef WITH_PYMALLOC + ++#ifdef WITH_VALGRIND ++#include ++ ++/* If we're using GCC, use __builtin_expect() to reduce overhead of ++ the valgrind checks */ ++#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) ++# define UNLIKELY(value) __builtin_expect((value), 0) ++#else ++# define UNLIKELY(value) (value) ++#endif ++ ++/* -1 indicates that we haven't checked that we're running on valgrind yet. */ ++static int running_on_valgrind = -1; ++#endif ++ + /* An object allocator for Python. + + Here is an introduction to the layers of the Python memory architecture, +@@ -728,6 +743,13 @@ PyObject_Malloc(size_t nbytes) + poolp next; + uint size; + ++#ifdef WITH_VALGRIND ++ if (UNLIKELY(running_on_valgrind == -1)) ++ running_on_valgrind = RUNNING_ON_VALGRIND; ++ if (UNLIKELY(running_on_valgrind)) ++ goto redirect; ++#endif ++ + /* + * Limit ourselves to PY_SSIZE_T_MAX bytes to prevent security holes. + * Most python internals blindly use a signed Py_ssize_t to track +@@ -927,6 +949,11 @@ PyObject_Free(void *p) + if (p == NULL) /* free(NULL) has no effect */ + return; + ++#ifdef WITH_VALGRIND ++ if (UNLIKELY(running_on_valgrind > 0)) ++ goto redirect; ++#endif ++ + pool = POOL_ADDR(p); + if (Py_ADDRESS_IN_RANGE(p, pool)) { + /* We allocated this address. */ +@@ -1121,6 +1148,9 @@ PyObject_Free(void *p) + return; + } + ++#ifdef WITH_VALGRIND ++redirect: ++#endif + /* We didn't allocate this address. */ + free(p); + } +@@ -1150,6 +1180,12 @@ PyObject_Realloc(void *p, size_t nbytes) + if (nbytes > PY_SSIZE_T_MAX) + return NULL; + ++#ifdef WITH_VALGRIND ++ /* Treat running_on_valgrind == -1 the same as 0 */ ++ if (UNLIKELY(running_on_valgrind > 0)) ++ goto redirect; ++#endif ++ + pool = POOL_ADDR(p); + if (Py_ADDRESS_IN_RANGE(p, pool)) { + /* We're in charge of this block */ +@@ -1177,6 +1213,9 @@ PyObject_Realloc(void *p, size_t nbytes) + } + return bp; + } ++#ifdef WITH_VALGRIND ++ redirect: ++#endif + /* We're not managing this block. If nbytes <= + * SMALL_REQUEST_THRESHOLD, it's tempting to try to take over this + * block. However, if we do, we need to copy the valid data from diff --git a/python3-lib64.patch b/python3-lib64.patch new file mode 100644 index 0000000..2ab23e6 --- /dev/null +++ b/python3-lib64.patch @@ -0,0 +1,295 @@ +--- Python-3.2.1/Include/pythonrun.h.lib64 2011-07-09 08:58:46.000000000 +0200 ++++ Python-3.2.1/Include/pythonrun.h 2011-07-12 03:43:22.000000000 +0200 +@@ -175,6 +175,8 @@ + /* In their own files */ + PyAPI_FUNC(const char *) Py_GetVersion(void); + PyAPI_FUNC(const char *) Py_GetPlatform(void); ++PyAPI_FUNC(const char *) Py_GetArch(void); ++PyAPI_FUNC(const char *) Py_GetLib(void); + PyAPI_FUNC(const char *) Py_GetCopyright(void); + PyAPI_FUNC(const char *) Py_GetCompiler(void); + PyAPI_FUNC(const char *) Py_GetBuildInfo(void); +--- Python-3.2.1/Lib/distutils/command/install.py.lib64 2011-07-09 08:58:46.000000000 +0200 ++++ Python-3.2.1/Lib/distutils/command/install.py 2011-07-12 03:43:22.000000000 +0200 +@@ -27,6 +27,8 @@ + from site import USER_SITE + HAS_USER_SITE = True + ++libname = sys.lib ++ + if sys.version < "2.2": + WINDOWS_SCHEME = { + 'purelib': '$base', +@@ -47,14 +49,14 @@ + INSTALL_SCHEMES = { + 'unix_prefix': { + 'purelib': '$base/lib/python$py_version_short/site-packages', +- 'platlib': '$platbase/lib/python$py_version_short/site-packages', ++ 'platlib': '$platbase/'+libname+'/python$py_version_short/site-packages', + 'headers': '$base/include/python$py_version_short$abiflags/$dist_name', + 'scripts': '$base/bin', + 'data' : '$base', + }, + 'unix_home': { + 'purelib': '$base/lib/python', +- 'platlib': '$base/lib/python', ++ 'platlib': '$base/'+libname+'/python', + 'headers': '$base/include/python/$dist_name', + 'scripts': '$base/bin', + 'data' : '$base', +--- Python-3.2.1/Lib/distutils/sysconfig.py.lib64 2011-07-09 08:58:47.000000000 +0200 ++++ Python-3.2.1/Lib/distutils/sysconfig.py 2011-07-12 03:43:22.000000000 +0200 +@@ -124,8 +124,12 @@ + prefix = plat_specific and EXEC_PREFIX or PREFIX + + if os.name == "posix": ++ if plat_specific: ++ lib = sys.lib ++ else: ++ lib = 'lib' + libpython = os.path.join(prefix, +- "lib", "python" + get_python_version()) ++ lib, "python" + get_python_version()) + if standard_lib: + return libpython + else: +@@ -207,7 +211,8 @@ + else: + inc_dir = project_base + else: +- inc_dir = get_python_inc(plat_specific=1) ++ prefix = EXEC_PREFIX or PREFIX ++ inc_dir = os.path.join(prefix, "include", "multiarch-" + sys.arch + "-linux", "python" + sys.version[:3]) + if get_python_version() < '2.2': + config_h = 'config.h' + else: +--- Python-3.2.1/Lib/distutils/tests/test_install.py.lib64 2011-07-09 08:58:47.000000000 +0200 ++++ Python-3.2.1/Lib/distutils/tests/test_install.py 2011-07-12 03:43:22.000000000 +0200 +@@ -49,8 +49,9 @@ + self.assertEqual(got, expected) + + libdir = os.path.join(destination, "lib", "python") ++ platlibdir = os.path.join(destination, sys.lib, "python") + check_path(cmd.install_lib, libdir) +- check_path(cmd.install_platlib, libdir) ++ check_path(cmd.install_platlib, platlibdir) + check_path(cmd.install_purelib, libdir) + check_path(cmd.install_headers, + os.path.join(destination, "include", "python", "foopkg")) +--- Python-3.2.1/Lib/site.py.lib64 2011-07-09 08:58:49.000000000 +0200 ++++ Python-3.2.1/Lib/site.py 2011-07-12 03:43:22.000000000 +0200 +@@ -285,13 +285,17 @@ + if sys.platform in ('os2emx', 'riscos'): + sitepackages.append(os.path.join(prefix, "Lib", "site-packages")) + elif os.sep == '/': +- sitepackages.append(os.path.join(prefix, "lib", ++ sitepackages.append(os.path.join(prefix, sys.lib, + "python" + sys.version[:3], + "site-packages")) +- sitepackages.append(os.path.join(prefix, "lib", "site-python")) ++ sitepackages.append(os.path.join(prefix, sys.lib, "site-python")) ++ if sys.lib != 'lib': ++ sitepackages.append(os.path.join(prefix, 'lib', ++ "python" + sys.version[:3], "site-packages")) ++ sitepackages.append(os.path.join(prefix, 'lib', "site-python")) + else: + sitepackages.append(prefix) +- sitepackages.append(os.path.join(prefix, "lib", "site-packages")) ++ sitepackages.append(os.path.join(prefix, sys.lib, "site-packages")) + if sys.platform == "darwin": + # for framework builds *only* we add the standard Apple + # locations. +--- Python-3.2.1/Lib/sysconfig.py.lib64 2011-07-09 08:58:49.000000000 +0200 ++++ Python-3.2.1/Lib/sysconfig.py 2011-07-12 03:43:22.000000000 +0200 +@@ -21,10 +21,10 @@ + + _INSTALL_SCHEMES = { + 'posix_prefix': { +- 'stdlib': '{base}/lib/python{py_version_short}', +- 'platstdlib': '{platbase}/lib/python{py_version_short}', ++ 'stdlib': '{base}/'+sys.lib+'/python{py_version_short}', ++ 'platstdlib': '{platbase}/'+sys.lib+'/python{py_version_short}', + 'purelib': '{base}/lib/python{py_version_short}/site-packages', +- 'platlib': '{platbase}/lib/python{py_version_short}/site-packages', ++ 'platlib': '{platbase}/'+sys.lib+'/python{py_version_short}/site-packages', + 'include': + '{base}/include/python{py_version_short}{abiflags}', + 'platinclude': +@@ -81,10 +81,10 @@ + 'data' : '{userbase}', + }, + 'posix_user': { +- 'stdlib': '{userbase}/lib/python{py_version_short}', +- 'platstdlib': '{userbase}/lib/python{py_version_short}', ++ 'stdlib': '{userbase}/'+sys.lib+'/python{py_version_short}', ++ 'platstdlib': '{userbase}/'+sys.lib+'/python{py_version_short}', + 'purelib': '{userbase}/lib/python{py_version_short}/site-packages', +- 'platlib': '{userbase}/lib/python{py_version_short}/site-packages', ++ 'platlib': '{userbase}/'+sys.lib+'/python{py_version_short}/site-packages', + 'include': '{userbase}/include/python{py_version_short}', + 'scripts': '{userbase}/bin', + 'data' : '{userbase}', +--- Python-3.2.1/Lib/test/test_site.py.lib64 2011-07-09 08:58:51.000000000 +0200 ++++ Python-3.2.1/Lib/test/test_site.py 2011-07-12 03:43:22.000000000 +0200 +@@ -222,11 +222,14 @@ + wanted = os.path.join('xoxo', 'Lib', 'site-packages') + self.assertEqual(dirs[0], wanted) + elif os.sep == '/': +- self.assertEqual(len(dirs), 2) +- wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3], ++ if sys.lib != 'lib': ++ self.assertEqual(len(dirs), 4) ++ else: ++ self.assertEqual(len(dirs), 2) ++ wanted = os.path.join('xoxo', sys.lib, 'python' + sys.version[:3], + 'site-packages') + self.assertEqual(dirs[0], wanted) +- wanted = os.path.join('xoxo', 'lib', 'site-python') ++ wanted = os.path.join('xoxo', sys.lib, 'site-python') + self.assertEqual(dirs[1], wanted) + else: + self.assertEqual(len(dirs), 2) +--- Python-3.2.1/Makefile.pre.in.lib64 2011-07-09 08:58:52.000000000 +0200 ++++ Python-3.2.1/Makefile.pre.in 2011-07-12 03:43:22.000000000 +0200 +@@ -90,7 +90,8 @@ + + # Machine-dependent subdirectories + MACHDEP= @MACHDEP@ +- ++LIB= @LIB@ ++ARCH= @ARCH@ + # Install prefix for architecture-independent files + prefix= @prefix@ + +@@ -106,7 +107,7 @@ + MANDIR= @mandir@ + INCLUDEDIR= @includedir@ + CONFINCLUDEDIR= $(exec_prefix)/include +-SCRIPTDIR= $(prefix)/lib ++SCRIPTDIR= @libdir@ + ABIFLAGS= @ABIFLAGS@ + + # Detailed destination directories +@@ -611,7 +612,7 @@ + Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H) + + Python/getplatform.o: $(srcdir)/Python/getplatform.c +- $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c ++ $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c + + Python/importdl.o: $(srcdir)/Python/importdl.c + $(CC) -c $(PY_CORE_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c +--- Python-3.2.1/Modules/getpath.c.lib64 2011-07-09 08:58:54.000000000 +0200 ++++ Python-3.2.1/Modules/getpath.c 2011-07-12 03:43:49.000000000 +0200 +@@ -121,9 +121,17 @@ + #define EXEC_PREFIX PREFIX + #endif + ++#ifndef LIB_PYTHON ++#if defined(__x86_64__) || defined(__powerpc64__) ++#define LIB_PYTHON L"lib64/python" VERSION ++#else ++#define LIB_PYTHON L"lib/python" VERSION ++#endif ++#endif ++ + #ifndef PYTHONPATH +-#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \ +- EXEC_PREFIX "/lib/python" VERSION "/lib-dynload" ++#define PYTHONPATH PREFIX "/" LIB_PYTHON ":" \ ++ EXEC_PREFIX "/" LIB_PYTHON "/lib-dynload" + #endif + + #ifndef LANDMARK +@@ -135,7 +143,7 @@ + static wchar_t progpath[MAXPATHLEN+1]; + static wchar_t *module_search_path = NULL; + static int module_search_path_malloced = 0; +-static wchar_t *lib_python = L"lib/python" VERSION; ++static wchar_t *lib_python = LIB_PYTHON; + + static void + reduce(wchar_t *dir) +--- Python-3.2.1/Python/getplatform.c.lib64 2011-07-09 08:58:56.000000000 +0200 ++++ Python-3.2.1/Python/getplatform.c 2011-07-12 03:43:22.000000000 +0200 +@@ -10,3 +10,23 @@ + { + return PLATFORM; + } ++ ++#ifndef ARCH ++#define ARCH "unknown" ++#endif ++ ++const char * ++Py_GetArch(void) ++{ ++ return ARCH; ++} ++ ++#ifndef LIB ++#define LIB "lib" ++#endif ++ ++const char * ++Py_GetLib(void) ++{ ++ return LIB; ++} +--- Python-3.2.1/Python/sysmodule.c.lib64 2011-07-09 08:58:56.000000000 +0200 ++++ Python-3.2.1/Python/sysmodule.c 2011-07-12 03:43:22.000000000 +0200 +@@ -1563,6 +1563,10 @@ + SET_SYS_FROM_STRING("executable", + PyUnicode_FromWideChar( + Py_GetProgramFullPath(), -1)); ++ SET_SYS_FROM_STRING("arch", ++ PyUnicode_FromString(Py_GetArch())); ++ SET_SYS_FROM_STRING("lib", ++ PyUnicode_FromString(Py_GetLib())); + SET_SYS_FROM_STRING("prefix", + PyUnicode_FromWideChar(Py_GetPrefix(), -1)); + SET_SYS_FROM_STRING("exec_prefix", +--- Python-3.2.1/configure.in.lib64 2011-07-09 08:58:56.000000000 +0200 ++++ Python-3.2.1/configure.in 2011-07-12 03:43:22.000000000 +0200 +@@ -592,6 +592,41 @@ + esac;; + esac + ++ARCH=`uname -m` ++case $ARCH in ++ i?86) ARCH=i386;; ++esac ++AC_MSG_RESULT($ARCH) ++AC_SUBST(ARCH) ++AC_MSG_CHECKING(ARCH) ++ ++case $ac_sys_system in ++ Linux*) ++ # Test if the compiler is 64bit ++ echo 'int i;' > conftest.$ac_ext ++ python_cv_cc_64bit_output=no ++ if AC_TRY_EVAL(ac_compile); then ++ case `/usr/bin/file conftest.$ac_objext` in ++ *"ELF 64"*) ++ python_cv_cc_64bit_output=yes ++ ;; ++ esac ++ fi ++ rm -rf conftest* ++ ;; ++esac ++ ++case $ARCH:$python_cv_cc_64bit_output in ++ ppc64:yes | powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) ++ LIB="lib64" ++ ;; ++ *:*) ++ LIB="lib" ++ ;; ++esac ++AC_MSG_RESULT($LIB) ++AC_SUBST(LIB) ++AC_MSG_CHECKING(LIB) + + AC_SUBST(LIBRARY) + AC_MSG_CHECKING(LIBRARY) diff --git a/python3.macros b/python3.macros new file mode 100644 index 0000000..6f51c52 --- /dev/null +++ b/python3.macros @@ -0,0 +1,10 @@ +%__python3 /usr/bin/python3 +%python3_sitelib %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") +%python3_sitearch %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))") +%py3ver %(%{__python3} -V 2>&1 | cut -f2 -d" " | cut -f1,2 -d".") +%python3_version %(%{__python3} -c "import sys; print(sys.version[0:3])") +%py3_ver %(%{__python3} -c "import sys; v=sys.version_info[:2]; print('%%d.%%d'%%v)" 2>/dev/null || echo PYTHON-NOT-FOUND) +%py3_prefix %(%{__python3} -c "import sys; print(sys.prefix)" 2>/dev/null || echo PYTHON-NOT-FOUND) +%py3_platsitedir %python3_sitearch +%py3_puresitedir %python3_sitelib +%py3_incdir %(%{__python3} -c 'from distutils.sysconfig import get_python_inc; print(get_python_inc())' 2>/dev/null || echo PYTHON-INCLUDEDIR-NOT-FOUND) diff --git a/python3.spec b/python3.spec new file mode 100644 index 0000000..3d3f2f5 --- /dev/null +++ b/python3.spec @@ -0,0 +1,548 @@ +%define docver 3.2.1 +%define dirver 3.2 +%define familyver 3 + +%define lib_major %{dirver} +%define lib_name_orig libpython%{familyver} +%define lib_name %mklibname python %{lib_major} +%define develname %mklibname python3 -d + +%define _requires_exceptions /usr/bin/python%{dirver} + +%ifarch %{ix86} x86_64 ppc +%bcond_without valgrind +%else +%bcond_with valgrind +%endif +Summary: An interpreted, interactive object-oriented programming language +Name: python3 +Version: 3.2.1 +Release: %mkrel 2 +License: Modified CNRI Open Source License +Group: Development/Python + +Source: http://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz +Source1: http://www.python.org/ftp/python/doc/%{docver}/python-%{docver}-docs-html.tar.bz2 +Source2: python3.macros +#Source4: python-mode-1.0.tar.bz2 + +Patch0: python-3.1.2-module-linkage.patch +Patch1: python3-lib64.patch +# fix http://bugs.python.org/issue6244 +# and https://qa.mandriva.com/show_bug.cgi?id=56260 +Patch2: python-2.5-tcl86.patch +# backported from svn +Patch3: python3-disable-pymalloc-on-valgrind.patch + +URL: http://www.python.org/ +Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot +Conflicts: tkinter3 < %{version} +Conflicts: %{lib_name}-devel < 3.1.2-4 +Conflicts: %{develname} < 3.2-4 +Requires: %{lib_name} = %{version} +BuildRequires: blt +BuildRequires: db-devel +BuildRequires: expat-devel +BuildRequires: gdbm-devel +BuildRequires: gmp-devel +BuildRequires: ncursesw-devel +BuildRequires: openssl-devel +BuildRequires: readline-devel +BuildRequires: termcap-devel +BuildRequires: tcl tcl-devel +BuildRequires: tk tk-devel +BuildRequires: autoconf automake +BuildRequires: bzip2-devel +BuildRequires: sqlite3-devel +# uncomment once the emacs part no longer conflict with python 2.X +#BuildRequires: emacs +#BuildRequires: emacs-bin +%if %{with valgrind} +BuildRequires: valgrind-devel +%endif +Provides: %{name} = %version +Provides: python(abi) = %{dirver} +Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root + + +%description +Python is an interpreted, interactive, object-oriented programming +language often compared to Tcl, Perl, Scheme or Java. Python includes +modules, classes, exceptions, very high level dynamic data types and +dynamic typing. Python supports interfaces to many system calls and +libraries, as well as to various windowing systems (X11, Motif, Tk, +Mac and MFC). + +Programmers can write new built-in modules for Python in C or C++. +Python can be used as an extension language for applications that +need a programmable interface. This package contains most of the +standard Python modules, as well as modules for interfacing to the +Tix widget set for Tk and RPM. + +Note that documentation for Python is provided in the python-docs +package. + +%package -n %{lib_name} +Summary: Shared libraries for Python %{version} +Group: System/Libraries + +%description -n %{lib_name} +This packages contains Python shared object library. Python is an +interpreted, interactive, object-oriented programming language often +compared to Tcl, Perl, Scheme or Java. + +%package -n %{develname} +Summary: The libraries and header files needed for Python development +Group: Development/Python +Requires: %{name} = %version +Requires: %{lib_name} = %{version} +Provides: %{name}-devel = %{version}-%{release} +Provides: %{lib_name_orig}-devel = %{version}-%{release} +Obsoletes: %{_lib}python3.1-devel < %{version} +Obsoletes: %{_lib}python3.2-devel < %{version}-%{release} + +%description -n %{develname} +The Python programming language's interpreter can be extended with +dynamically loaded extensions and can be embedded in other programs. +This package contains the header files and libraries needed to do +these types of tasks. + +Install %{develname} if you want to develop Python extensions. The +python package will also need to be installed. You'll probably also +want to install the python-docs package, which contains Python +documentation. + +%package docs +Summary: Documentation for the Python programming language +Requires: %name = %version +Requires: xdg-utils +Group: Development/Python + +%description docs +The python-docs package contains documentation on the Python +programming language and interpreter. The documentation is provided +in ASCII text files and in LaTeX source files. + +Install the python-docs package if you'd like to use the documentation +for the Python language. + +%package -n tkinter3 +Summary: A graphical user interface for the Python scripting language +Group: Development/Python +Requires: %name = %version +Requires: tcl tk + +%description -n tkinter3 +The Tkinter (Tk interface) program is an graphical user interface for +the Python scripting language. + +You should install the tkinter package if you'd like to use a graphical +user interface for Python programming. + +%package -n tkinter3-apps +Summary: Various applications written using tkinter +Group: Development/Python +Requires: tkinter3 + +%description -n tkinter3-apps +Various applications written using tkinter + +%prep +%setup -qn Python-%{version} +%patch0 -p0 -b .link +%patch1 -p1 -b .lib64 + +#patch2 -p1 +#patch3 -p1 -b .valgrind~ + +# docs +mkdir html +bzcat %{SOURCE1} | tar x -C html + +find . -type f -print0 | xargs -0 perl -p -i -e 's@/usr/local/bin/python@/usr/bin/python3@' + +cat > README.mdv << EOF +Python interpreter support readline completion by default. +This is only used with the interpreter. In order to remove it, +you can : +1) unset PYTHONSTARTUP when you login +2) create a empty file \$HOME/.pythonrc.py +3) change %{_sysconfdir}/pythonrc.py +EOF + +%build +rm -f Modules/Setup.local + +OPT="$RPM_OPT_FLAGS -g" +export OPT +autoreconf +%configure2_5x --with-threads \ + --enable-ipv6 \ + --with-wide-unicode \ + --enable-shared \ +%if %{with valgrind} + --with-valgrind +%endif + +# fix build +#perl -pi -e 's/^(LDFLAGS=.*)/$1 -lstdc++/' Makefile +# (misc) if the home is nfs mounted, rmdir fails due to delay +export TMP="/tmp" TMPDIR="/tmp" +%make LN="ln -sf" + +%check +# (misc) if the home is nfs mounted, rmdir fails +export TMP="/tmp" TMPDIR="/tmp" + +# all tests must pass +# (misc, 28/11/2006) test_shutil is causing problem in iurt, it seems to remove /tmp, +# which make other test fail +# (misc, 11/12/2006) test_pyexpat is icrashing, seem to be done on purpose ( http://python.org/sf/1296433 ) +# (misc, 11/12/2006) test_minidom is not working anymore, something changed either on my computer +# or elsewhere. +# (misc, 11/12/2006) test_sax fail too, will take a look later +# (misc, 21/08/2007) test_string and test_str segfault, test_unicode, test_userstring, I need to pass the package as a security update +# (eugeni, 21/07/2009) test_distutils fails with python3.1 due to ld error +# (eugeni, 22/07/2009) test_mailbox fails on the BS +# (eugeni, 17/08/2009) test_telnetlib fails with a connection reset by peer message +# test test_sax failed -- 1 of 44 tests failed: test_xmlgen_attr_escape +make test TESTOPTS="-w -l -x test_linuxaudiodev -x test_nis -x test_shutil -x test_pyexpat -x test_minidom -x test_sax -x test_string -x test_str -x test_unicode -x test_userstring -x test_bytes -x test_distutils -x test_mailbox -x test_ioctl -x test_telnetlib" + +%install +rm -rf $RPM_BUILD_ROOT +mkdir -p %buildroot%{_prefix}/lib/python%{dirver} + +# fix Makefile to get rid of reference to distcc +perl -pi -e "/^CC=/ and s/distcc/gcc/" Makefile + +# set the install path +echo '[install_scripts]' >setup.cfg +echo 'install_dir='"${RPM_BUILD_ROOT}/usr/bin" >>setup.cfg + +# python is not GNU and does not know fsstd +mkdir -p $RPM_BUILD_ROOT%{_mandir} +%makeinstall_std LN="ln -sf" + +(cd $RPM_BUILD_ROOT%{_libdir}; ln -sf `ls libpython%{lib_major}*.so.*` libpython%{lib_major}.so) + +# fix files conflicting with python2.6 +mv $RPM_BUILD_ROOT/%{_bindir}/2to3 $RPM_BUILD_ROOT/%{_bindir}/python3-2to3 + +# conflicts with python2 +# # emacs, I use it, I want it +# mkdir -p $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp +# install -m 644 Misc/python-mode.el $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp +# emacs -batch -f batch-byte-compile $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp/python-mode.el +# +# install -d $RPM_BUILD_ROOT%{_sysconfdir}/emacs/site-start.d +# cat <$RPM_BUILD_ROOT%{_sysconfdir}/emacs/site-start.d/%{name}.el +# (setq auto-mode-alist (cons '("\\\\.py$" . python-mode) auto-mode-alist)) +# (autoload 'python-mode "python-mode" "Mode for python files." t) +# EOF + +#" this comment is just here because vim syntax higlighting is confused by the previous snippet of lisp + +# install pynche as pynche3 +cat << EOF > $RPM_BUILD_ROOT%{_bindir}/pynche3 +#!/bin/bash +exec %{_libdir}/python%{dirver}/site-packages/pynche/pynche +EOF +rm -f Tools/pynche/*.pyw +cp -r Tools/pynche $RPM_BUILD_ROOT%{_libdir}/python%{dirver}/site-packages/ + +chmod 755 $RPM_BUILD_ROOT%{_bindir}/{idle3,pynche3} + +ln -f Tools/pynche/README Tools/pynche/README.pynche + +%if %{with valgrind} +install Misc/valgrind-python.supp -D $RPM_BUILD_ROOT%{_libdir}/valgrind/valgrind-python3.supp +%endif + +mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications +cat > $RPM_BUILD_ROOT%{_datadir}/applications/mandriva-tkinter3.desktop << EOF +[Desktop Entry] +Name=IDLE +Comment=IDE for Python3 +Exec=%{_bindir}/idle3 +Icon=development_environment_section +Terminal=false +Type=Application +Categories=Development;IDE; +EOF + + +cat > $RPM_BUILD_ROOT%{_datadir}/applications/mandriva-%{name}-docs.desktop << EOF +[Desktop Entry] +Name=Python documentation +Comment=Python complete reference +Exec=%{_bindir}/xdg-open %_defaultdocdir/%{name}-docs/index.html +Icon=documentation_section +Terminal=false +Type=Application +Categories=Documentation; +EOF + + +# fix non real scripts +chmod 644 $RPM_BUILD_ROOT%{_libdir}/python*/test/test_{binascii,grp,htmlparser}.py* +# fix python library not stripped +chmod u+w $RPM_BUILD_ROOT%{_libdir}/libpython%{lib_major}*.so.1.0 $RPM_BUILD_ROOT%{_libdir}/libpython3.so + + +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/ + +cat > $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/30python.sh << 'EOF' +if [ -f $HOME/.pythonrc.py ] ; then + export PYTHONSTARTUP=$HOME/.pythonrc.py +else + export PYTHONSTARTUP=/etc/pythonrc.py +fi + +export PYTHONDONTWRITEBYTECODE=1 +EOF + +cat > $RPM_BUILD_ROOT/%{_sysconfdir}/profile.d/30python.csh << 'EOF' +if ( -f ${HOME}/.pythonrc.py ) then + setenv PYTHONSTARTUP ${HOME}/.pythonrc.py +else + setenv PYTHONSTARTUP /etc/pythonrc.py +endif +setenv PYTHONDONTWRITEBYTECODE 1 +EOF + +cat > $RPM_BUILD_ROOT%{_sysconfdir}/pythonrc.py << EOF +try: + # this add completion to python interpreter + import readline + import rlcompleter + # see readline man page for this + readline.parse_and_bind("set show-all-if-ambiguous on") + readline.parse_and_bind("tab: complete") +except: + pass +# you can place a file .pythonrc.py in your home to overrides this one +# but then, this file will not be sourced +EOF + +%multiarch_includes $RPM_BUILD_ROOT/usr/include/python*/pyconfig.h + +mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rpm/macros.d +install -m644 %{SOURCE2} $RPM_BUILD_ROOT/%{_sysconfdir}/rpm/macros.d/ + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-, root, root, 755) +%doc README.mdv +# conflicts with python2.6 +#%config(noreplace) %{_sysconfdir}/emacs/site-start.d/%{name}.el +%{_sysconfdir}/rpm/macros.d/*.macros +%{_sysconfdir}/profile.d/* +%config(noreplace) %{_sysconfdir}/pythonrc.py +%{_includedir}/python*/pyconfig.h +%{_libdir}/python*/config*/Makefile +%exclude %{_libdir}/python*/site-packages/pynche +%exclude %{_libdir}/python*/lib-dynload/_tkinter.*.so + +# HACK: build fails without this (TODO: investigate rpm) +%dir %{_libdir}/python* +%{_libdir}/python*/LICENSE.txt +%{_libdir}/python%{dirver}/*.py +%{_libdir}/python%{dirver}/__pycache__ +%{_libdir}/python%{dirver}/concurrent +%{_libdir}/python%{dirver}/ctypes +%{_libdir}/python%{dirver}/curses +%{_libdir}/python%{dirver}/dbm +%{_libdir}/python%{dirver}/distutils +%{_libdir}/python%{dirver}/email +%{_libdir}/python%{dirver}/encodings +%{_libdir}/python%{dirver}/html +%{_libdir}/python%{dirver}/http +%{_libdir}/python%{dirver}/importlib +%{_libdir}/python%{dirver}/json +%{_libdir}/python%{dirver}/lib-dynload +%{_libdir}/python%{dirver}/lib2to3 +%{_libdir}/python%{dirver}/logging +%{_libdir}/python%{dirver}/multiprocessing +%{_libdir}/python%{dirver}/plat-linux2 +%{_libdir}/python%{dirver}/pydoc_data +%{_libdir}/python%{dirver}/site-packages +%{_libdir}/python%{dirver}/sqlite3 +%{_libdir}/python%{dirver}/turtledemo +%{_libdir}/python%{dirver}/unittest +%{_libdir}/python%{dirver}/urllib +%{_libdir}/python%{dirver}/wsgiref* +%{_libdir}/python%{dirver}/xml +%{_libdir}/python%{dirver}/xmlrpc +%{_bindir}/pydoc3* +%{_bindir}/python3* +%{_bindir}/2to3-%{dirver} +%exclude %{_bindir}/python*config +#%{_datadir}/emacs/site-lisp/* +%{_mandir}/man*/* +%if %{with valgrind} +%{_libdir}/valgrind/valgrind-python3.supp +%endif + +%files -n %{lib_name} +%defattr(-,root,root) +%{_libdir}/libpython*.so.1* + +%files -n %{develname} +%defattr(-, root, root, 755) +%{_libdir}/libpython*.so +%multiarch_includedir/python*/pyconfig.h +%{_includedir}/python* +%{_libdir}/python*/config-%{dirver}* +%{_libdir}/python*/test/ +%{_bindir}/python%{dirver}*-config +%{_bindir}/python%{familyver}-config +%{_libdir}/pkgconfig/python*.pc +%exclude %{_includedir}/python*/pyconfig.h +%exclude %{_libdir}/python*/config*/Makefile + +%files docs +%defattr(-,root,root,755) +%doc html/*/* +%{_datadir}/applications/mandriva-%{name}-docs.desktop + +%files -n tkinter3 +%defattr(-, root, root, 755) +%{_libdir}/python*/tkinter/ +%{_libdir}/python*/idlelib +%{_libdir}/python*/site-packages/pynche +%{_libdir}/python*/lib-dynload/_tkinter.*.so + +%files -n tkinter3-apps +%defattr(-, root, root, 755) +%{_bindir}/idle3* +%{_bindir}/pynche3 +%{_datadir}/applications/mandriva-tkinter3.desktop + +%if %mdkversion < 200900 +%post -n %{lib_name} -p /sbin/ldconfig +%endif +%if %mdkversion < 200900 +%postun -n %{lib_name} -p /sbin/ldconfig +%endif + +%if %mdkversion < 200900 +%post -n tkinter3-apps +%update_menus +%endif + +%if %mdkversion < 200900 +%postun -n tkinter3-apps +%clean_menus +%endif + + + + +%changelog +* Sun Aug 14 2011 Funda Wang 3.2.1-2mdv2011.0 ++ Revision: 694448 +- add requires exception +- redif lib64 patch +- new version 3.2.1 + +* Mon May 02 2011 Funda Wang 3.2-4 ++ Revision: 661885 +- update file list +- update file list +- move makefile and pyconfig into main +- more lib64 patch + +* Sun Apr 24 2011 Funda Wang 3.2-3 ++ Revision: 658191 +- rename devel name + +* Sat Apr 23 2011 Funda Wang 3.2-2 ++ Revision: 656821 +- build with wide-unicode + +* Sat Apr 23 2011 Funda Wang 3.2-1 ++ Revision: 656799 +- update file list +- use space +- clean spec file +- rediff lib64 patch +- rediff lib64 patch +- new version 3.2 + +* Mon Nov 01 2010 Funda Wang 3.1.2-4mdv2011.0 ++ Revision: 591289 +- move macro into main package + +* Sun Oct 31 2010 Funda Wang 3.1.2-3mdv2011.0 ++ Revision: 591178 +- fix module link +- drop obsoletes swtich +- add python3.macros to ease python3 packaging +- tweak binary name in scripts + +* Sat Oct 30 2010 Anssi Hannula 3.1.2-2mdv2011.0 ++ Revision: 590324 +- add provides on python(abi) (as per Fedora), for automated python + module dependencies on python version +- workaround rpm issue in filelist to fix build + + + Per Øyvind Karlsen + - backport disable pymalloc on valgrind from svn + +* Thu Apr 22 2010 Michael Scherer 3.1.2-1mdv2010.1 ++ Revision: 537934 +- update to 3.1.2 +- fix cruft in lib64 patch + +* Sat Apr 17 2010 Michael Scherer 3.1.1-9mdv2010.1 ++ Revision: 536061 +- rebuild for new rpm-mandriva-setup, to fix installation ( #58793 ) + +* Thu Apr 08 2010 Michael Scherer 3.1.1-8mdv2010.1 ++ Revision: 533004 +- rebuild for new rpm-mandriva-setup + +* Thu Mar 25 2010 Michael Scherer 3.1.1-7mdv2010.1 ++ Revision: 527485 +- rebuild to fix upgrade ( due to python-base removal ) + +* Fri Feb 05 2010 Michael Scherer 3.1.1-6mdv2010.1 ++ Revision: 501053 +- remove BR on emacs as we do not build emacs extension for the moment ( conflict with python 2.x ) +- do not add a BuildRequires on emacs, uneeded for the moment +- remove old comment +- use README.mdv, not mdk +- do not obsolete package that does exist +- remove redundant BuildRequires +- do not provides python-base, this should be removed from the distro, + as there is no subpackage named like this ( more ever, this is likely to + be a wrong provides, as python 3 is too different from python 2 ) + +* Sun Jan 17 2010 Michael Scherer 3.1.1-5mdv2010.1 ++ Revision: 492597 +- fix linking to ncursesw, to fix canto segfaulting + +* Sun Jan 03 2010 Michael Scherer 3.1.1-4mdv2010.1 ++ Revision: 486004 +- move tkinter module to proper subpackage +- add patch to fix bug 56260, as python do not detect tcl/tk 8.6, by porting the patch from + regular python package to python 3 + +* Wed Nov 11 2009 Michael Scherer 3.1.1-3mdv2010.1 ++ Revision: 464473 +- fix file conflict for tkinteer desktop file, as pointed by laurent pointal on bug 55507 + +* Tue Aug 18 2009 Eugeni Dodonov 3.1.1-2mdv2010.0 ++ Revision: 417514 +- updated to 3.1.1 + +* Fri Jul 24 2009 Bogdano Arendartchuk 3.1-2mdv2010.0 ++ Revision: 399512 +- adapted the lib64 patch to py3k + + + Eugeni Dodonov + - Packaged python3. + - Created package structure for python3. +