Sophie

Sophie

distrib > Mandriva > current > i586 > media > contrib-release-src > by-pkgid > a6a75073de81f1d7c7a0fca1d89bdd61 > files > 5

python3-3.1.2-1mdv2010.1.src.rpm

diff --git a/Include/pythonrun.h b/Include/pythonrun.h
index 86d9fe2..3c965ad 100644
--- a/Include/pythonrun.h
+++ b/Include/pythonrun.h
@@ -112,6 +112,8 @@ PyAPI_FUNC(wchar_t *) Py_GetPath(void);
 /* 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);
diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py
index 34b03d0..ecc7b0c 100644
--- a/Lib/distutils/command/install.py
+++ b/Lib/distutils/command/install.py
@@ -27,6 +27,8 @@ else:
     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 @@ else:
 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/$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',
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index 3bd1323..b42432e 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -117,8 +117,12 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
         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:
@@ -211,7 +215,8 @@ def get_config_h_filename():
         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:
diff --git a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py
index 8d7e972..1468092 100644
--- a/Lib/distutils/tests/test_install.py
+++ b/Lib/distutils/tests/test_install.py
@@ -47,8 +47,9 @@ class InstallTestCase(support.TempdirManager,
             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"))
diff --git a/Lib/site.py b/Lib/site.py
index 7bbd962..96c4d6c 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -258,13 +258,19 @@ def addsitepackages(known_paths):
         if sys.platform in ('os2emx', 'riscos'):
             sitedirs.append(os.path.join(prefix, "Lib", "site-packages"))
         elif os.sep == '/':
-            sitedirs.append(os.path.join(prefix, "lib",
+            sitedirs.append(os.path.join(prefix, sys.lib,
                                         "python" + sys.version[:3],
                                         "site-packages"))
-            sitedirs.append(os.path.join(prefix, "lib", "site-python"))
+            sitedirs.append(os.path.join(prefix, sys.lib, "site-python"))
+            if sys.lib != 'lib':
+                    sitedirs.append(os.path.join(prefix, 'lib',
+                                                 "python" + sys.version[:3],
+                                                 "site-packages"))
+                    sitedirs.append(os.path.join(prefix, 'lib', "site-python"))
+
         else:
             sitedirs.append(prefix)
-            sitedirs.append(os.path.join(prefix, "lib", "site-packages"))
+            sitedirs.append(os.path.join(prefix, sys.lib, "site-packages"))
 
         if sys.platform == "darwin":
             # for framework builds *only* we add the standard Apple
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 41fc51e..41b8574 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -78,6 +78,8 @@ PY_CFLAGS=	$(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
 
 # Machine-dependent subdirectories
 MACHDEP=	@MACHDEP@
+LIB=		@LIB@
+ARCH=		@ARCH@
 
 # Install prefix for architecture-independent files
 prefix=		@prefix@
@@ -90,11 +92,11 @@ datarootdir=    @datarootdir@
 
 # Expanded directories
 BINDIR=		$(exec_prefix)/bin
-LIBDIR=		$(exec_prefix)/lib
+LIBDIR=		$(exec_prefix)/$(LIB)
 MANDIR=		@mandir@
 INCLUDEDIR=	@includedir@
 CONFINCLUDEDIR=	$(exec_prefix)/include
-SCRIPTDIR=	$(prefix)/lib
+SCRIPTDIR=	$(prefix)/$(LIB)
 
 # Detailed destination directories
 BINLIBDEST=	$(LIBDIR)/python$(VERSION)
@@ -565,7 +567,7 @@ $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
 Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
 
 Python/getplatform.o: $(srcdir)/Python/getplatform.c
-		$(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
+		$(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
 
 Python/importdl.o: $(srcdir)/Python/importdl.c
 		$(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
diff --git a/Modules/getpath.c b/Modules/getpath.c
index b7f178e..c2fe20b 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -116,9 +116,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
@@ -129,7 +137,7 @@ static wchar_t prefix[MAXPATHLEN+1];
 static wchar_t exec_prefix[MAXPATHLEN+1];
 static wchar_t progpath[MAXPATHLEN+1];
 static wchar_t *module_search_path = NULL;
-static wchar_t lib_python[] = L"lib/python" VERSION;
+static wchar_t lib_python[] = LIB_PYTHON;
 
 /* In principle, this should use HAVE__WSTAT, and _wstat
    should be detected by autoconf. However, no current
diff --git a/Python/getplatform.c b/Python/getplatform.c
index 6899140..66a49c6 100644
--- a/Python/getplatform.c
+++ b/Python/getplatform.c
@@ -10,3 +10,23 @@ Py_GetPlatform(void)
 {
 	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;
+}
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index b7609c7..e92653d 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1367,6 +1367,10 @@ _PySys_Init(void)
 	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",
diff --git a/configure.in b/configure.in
index 9d8a934..9ab02b7 100644
--- a/configure.in
+++ b/configure.in
@@ -542,6 +542,41 @@ SunOS*)
     ;;
 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/pyconfig.h.in b/pyconfig.h.in
index 3bfa512..025441d 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -5,6 +5,9 @@
 #define Py_PYCONFIG_H
 
 
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
 /* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want
    support for AIX C++ shared extension modules. */
 #undef AIX_GENUINE_CPLUSPLUS
@@ -995,6 +998,28 @@
 /* Define if you want to use computed gotos in ceval.c. */
 #undef USE_COMPUTED_GOTOS
 
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
 /* Define if a va_list is an array of some kind */
 #undef VA_LIST_IS_ARRAY
 
@@ -1032,20 +1057,21 @@
 /* Define to profile with the Pentium timestamp counter */
 #undef WITH_TSC
 
-/* Define to 1 if your processor stores words with the most significant byte
-   first (like Motorola and SPARC, unlike Intel and VAX). */
-#undef WORDS_BIGENDIAN
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+#  undef WORDS_BIGENDIAN
+# endif
+#endif
 
 /* Define if arithmetic is subject to x87-style double rounding issue */
 #undef X87_DOUBLE_ROUNDING
 
-/* Define to 1 if on AIX 3.
-   System headers sometimes define this.
-   We just want to avoid a redefinition error message.  */
-#ifndef _ALL_SOURCE
-# undef _ALL_SOURCE
-#endif
-
 /* Define on OpenBSD to activate all library features */
 #undef _BSD_SOURCE
 
@@ -1064,15 +1090,25 @@
 /* This must be defined on some systems to enable large file support. */
 #undef _LARGEFILE_SOURCE
 
+/* Define to 1 if on MINIX. */
+#undef _MINIX
+
 /* Define on NetBSD to activate all library features */
 #undef _NETBSD_SOURCE
 
 /* Define _OSF_SOURCE to get the makedev macro. */
 #undef _OSF_SOURCE
 
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+#undef _POSIX_1_SOURCE
+
 /* Define to activate features from IEEE Stds 1003.1-2001 */
 #undef _POSIX_C_SOURCE
 
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#undef _POSIX_SOURCE
+
 /* Define if you have POSIX threads, and your system does not define that. */
 #undef _POSIX_THREADS
 
@@ -1080,12 +1116,12 @@
 #undef _REENTRANT
 
 /* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
-   <pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
    #define below would cause a syntax error. */
 #undef _UINT32_T
 
 /* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
-   <pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
    #define below would cause a syntax error. */
 #undef _UINT64_T
 
diff --git a/setup.py b/setup.py
index cb1e5b6..7f71a09 100644
--- a/setup.py
+++ b/setup.py
@@ -338,12 +338,12 @@ class PyBuildExt(build_ext):
             add_dir_to_list(self.compiler.include_dirs,
                             sysconfig.get_config_var("INCLUDEDIR"))
 
+        libname = sys.lib
         # lib_dirs and inc_dirs are used to search for files;
         # if a file is found in one of those directories, it can
         # be assumed that no additional -I,-L directives are needed.
         lib_dirs = self.compiler.library_dirs + [
-            '/lib64', '/usr/lib64',
-            '/lib', '/usr/lib',
+            libname, '/usr/'+libname
             ]
         inc_dirs = self.compiler.include_dirs + ['/usr/include']
         exts = []
@@ -522,11 +522,11 @@ class PyBuildExt(build_ext):
             elif self.compiler.find_library_file(lib_dirs, 'curses'):
                 readline_libs.append('curses')
             elif self.compiler.find_library_file(lib_dirs +
-                                               ['/usr/lib/termcap'],
+                                               ['/usr/'+libname+'/termcap'],
                                                'termcap'):
                 readline_libs.append('termcap')
             exts.append( Extension('readline', ['readline.c'],
-                                   library_dirs=['/usr/lib/termcap'],
+                                   library_dirs=['/usr/'+libname+'/termcap'],
                                    extra_link_args=readline_extra_link_args,
                                    libraries=readline_libs) )
         else:
@@ -1356,8 +1356,8 @@ class PyBuildExt(build_ext):
             added_lib_dirs.append('/usr/openwin/lib')
         elif os.path.exists('/usr/X11R6/include'):
             include_dirs.append('/usr/X11R6/include')
-            added_lib_dirs.append('/usr/X11R6/lib64')
-            added_lib_dirs.append('/usr/X11R6/lib')
+            added_lib_dirs.append('/usr/X11R6/'+sys.lib)
+            #added_lib_dirs.append('/usr/X11R6/lib')
         elif os.path.exists('/usr/X11R5/include'):
             include_dirs.append('/usr/X11R5/include')
             added_lib_dirs.append('/usr/X11R5/lib')