]> git.pld-linux.org Git - packages/python3.git/blame - python3-lib64.patch
- more lib64 fixes
[packages/python3.git] / python3-lib64.patch
CommitLineData
75257062 1diff -Nur Python-3.2.orig//configure.in Python-3.2/configure.in
2--- Python-3.2.orig//configure.in 2011-02-19 08:58:23.000000000 +0000
3+++ Python-3.2/configure.in 2011-05-21 21:16:30.000000000 +0100
4@@ -580,6 +580,41 @@
5 esac;;
e684db95
AM
6 esac
7
8+AC_SUBST(ARCH)
9+AC_MSG_CHECKING(ARCH)
10+ARCH=`uname -m`
11+case $ARCH in
12+i?86) ARCH=i386;;
13+esac
14+AC_MSG_RESULT($ARCH)
15+
16+AC_SUBST(LIB)
17+AC_MSG_CHECKING(LIB)
18+case $ac_sys_system in
19+Linux*)
20+ # Test if the compiler is 64bit
21+ echo 'int i;' > conftest.$ac_ext
22+ python_cv_cc_64bit_output=no
23+ if AC_TRY_EVAL(ac_compile); then
24+ case `/usr/bin/file conftest.$ac_objext` in
25+ *"ELF 64"*)
26+ python_cv_cc_64bit_output=yes
27+ ;;
28+ esac
29+ fi
30+ rm -rf conftest*
31+ ;;
32+esac
33+
34+case $ARCH:$python_cv_cc_64bit_output in
35+powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
36+ LIB="lib64"
37+ ;;
38+*:*)
39+ LIB="lib"
40+ ;;
41+esac
42+AC_MSG_RESULT($LIB)
43
44 AC_SUBST(LIBRARY)
45 AC_MSG_CHECKING(LIBRARY)
75257062 46diff -Nur Python-3.2.orig//Include/pythonrun.h Python-3.2/Include/pythonrun.h
47--- Python-3.2.orig//Include/pythonrun.h 2010-12-27 01:49:31.000000000 +0000
48+++ Python-3.2/Include/pythonrun.h 2011-05-21 21:16:30.000000000 +0100
49@@ -175,6 +175,8 @@
e684db95
AM
50 /* In their own files */
51 PyAPI_FUNC(const char *) Py_GetVersion(void);
52 PyAPI_FUNC(const char *) Py_GetPlatform(void);
53+PyAPI_FUNC(const char *) Py_GetArch(void);
54+PyAPI_FUNC(const char *) Py_GetLib(void);
55 PyAPI_FUNC(const char *) Py_GetCopyright(void);
56 PyAPI_FUNC(const char *) Py_GetCompiler(void);
57 PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
75257062 58diff -Nur Python-3.2.orig//Include/pythonrun.h.orig Python-3.2/Include/pythonrun.h.orig
59--- Python-3.2.orig//Include/pythonrun.h.orig 1970-01-01 01:00:00.000000000 +0100
60+++ Python-3.2/Include/pythonrun.h.orig 2010-12-27 01:49:31.000000000 +0000
61@@ -0,0 +1,251 @@
62+
63+/* Interfaces to parse and execute pieces of python code */
64+
65+#ifndef Py_PYTHONRUN_H
66+#define Py_PYTHONRUN_H
67+#ifdef __cplusplus
68+extern "C" {
69+#endif
70+
71+#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \
72+ CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \
73+ CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL)
74+#define PyCF_MASK_OBSOLETE (CO_NESTED)
75+#define PyCF_SOURCE_IS_UTF8 0x0100
76+#define PyCF_DONT_IMPLY_DEDENT 0x0200
77+#define PyCF_ONLY_AST 0x0400
78+#define PyCF_IGNORE_COOKIE 0x0800
79+
80+#ifndef Py_LIMITED_API
81+typedef struct {
82+ int cf_flags; /* bitmask of CO_xxx flags relevant to future */
83+} PyCompilerFlags;
84+#endif
85+
86+PyAPI_FUNC(void) Py_SetProgramName(wchar_t *);
87+PyAPI_FUNC(wchar_t *) Py_GetProgramName(void);
88+
89+PyAPI_FUNC(void) Py_SetPythonHome(wchar_t *);
90+PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void);
91+
92+PyAPI_FUNC(void) Py_Initialize(void);
93+PyAPI_FUNC(void) Py_InitializeEx(int);
94+PyAPI_FUNC(void) Py_Finalize(void);
95+PyAPI_FUNC(int) Py_IsInitialized(void);
96+PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
97+PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *);
98+
99+#ifndef Py_LIMITED_API
100+PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
101+PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
102+PyAPI_FUNC(int) PyRun_AnyFileExFlags(
103+ FILE *fp,
104+ const char *filename, /* decoded from the filesystem encoding */
105+ int closeit,
106+ PyCompilerFlags *flags);
107+PyAPI_FUNC(int) PyRun_SimpleFileExFlags(
108+ FILE *fp,
109+ const char *filename, /* decoded from the filesystem encoding */
110+ int closeit,
111+ PyCompilerFlags *flags);
112+PyAPI_FUNC(int) PyRun_InteractiveOneFlags(
113+ FILE *fp,
114+ const char *filename, /* decoded from the filesystem encoding */
115+ PyCompilerFlags *flags);
116+PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(
117+ FILE *fp,
118+ const char *filename, /* decoded from the filesystem encoding */
119+ PyCompilerFlags *flags);
120+
121+PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(
122+ const char *s,
123+ const char *filename, /* decoded from the filesystem encoding */
124+ int start,
125+ PyCompilerFlags *flags,
126+ PyArena *arena);
127+PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(
128+ FILE *fp,
129+ const char *filename, /* decoded from the filesystem encoding */
130+ const char* enc,
131+ int start,
132+ char *ps1,
133+ char *ps2,
134+ PyCompilerFlags *flags,
135+ int *errcode,
136+ PyArena *arena);
137+#endif
138+
139+#ifndef PyParser_SimpleParseString
140+#define PyParser_SimpleParseString(S, B) \
141+ PyParser_SimpleParseStringFlags(S, B, 0)
142+#define PyParser_SimpleParseFile(FP, S, B) \
143+ PyParser_SimpleParseFileFlags(FP, S, B, 0)
144+#endif
145+PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int,
146+ int);
147+PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
148+ int, int);
149+
150+#ifndef Py_LIMITED_API
151+PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
152+ PyObject *, PyCompilerFlags *);
153+
154+PyAPI_FUNC(PyObject *) PyRun_FileExFlags(
155+ FILE *fp,
156+ const char *filename, /* decoded from the filesystem encoding */
157+ int start,
158+ PyObject *globals,
159+ PyObject *locals,
160+ int closeit,
161+ PyCompilerFlags *flags);
162+#endif
163+
164+#ifdef Py_LIMITED_API
165+PyAPI_FUNC(PyObject *) Py_CompileString(const char *, const char *, int);
166+#else
167+#define Py_CompileString(str, p, s) Py_CompileStringExFlags(str, p, s, NULL, -1)
168+#define Py_CompileStringFlags(str, p, s, f) Py_CompileStringExFlags(str, p, s, f, -1)
169+PyAPI_FUNC(PyObject *) Py_CompileStringExFlags(
170+ const char *str,
171+ const char *filename, /* decoded from the filesystem encoding */
172+ int start,
173+ PyCompilerFlags *flags,
174+ int optimize);
175+#endif
176+PyAPI_FUNC(struct symtable *) Py_SymtableString(
177+ const char *str,
178+ const char *filename, /* decoded from the filesystem encoding */
179+ int start);
180+
181+PyAPI_FUNC(void) PyErr_Print(void);
182+PyAPI_FUNC(void) PyErr_PrintEx(int);
183+PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *);
184+
185+/* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level
186+ * exit functions.
187+ */
188+#ifndef Py_LIMITED_API
189+PyAPI_FUNC(void) _Py_PyAtExit(void (*func)(void));
190+#endif
191+PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
192+
193+PyAPI_FUNC(void) Py_Exit(int);
194+
195+/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */
196+#ifndef Py_LIMITED_API
197+PyAPI_FUNC(void) _Py_RestoreSignals(void);
198+
199+PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
200+#endif
201+
202+/* Bootstrap */
203+PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv);
204+
205+#ifndef Py_LIMITED_API
206+/* Use macros for a bunch of old variants */
207+#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL)
208+#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL)
209+#define PyRun_AnyFileEx(fp, name, closeit) \
210+ PyRun_AnyFileExFlags(fp, name, closeit, NULL)
211+#define PyRun_AnyFileFlags(fp, name, flags) \
212+ PyRun_AnyFileExFlags(fp, name, 0, flags)
213+#define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL)
214+#define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL)
215+#define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL)
216+#define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL)
217+#define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL)
218+#define PyRun_File(fp, p, s, g, l) \
219+ PyRun_FileExFlags(fp, p, s, g, l, 0, NULL)
220+#define PyRun_FileEx(fp, p, s, g, l, c) \
221+ PyRun_FileExFlags(fp, p, s, g, l, c, NULL)
222+#define PyRun_FileFlags(fp, p, s, g, l, flags) \
223+ PyRun_FileExFlags(fp, p, s, g, l, 0, flags)
224+#endif
225+
226+/* In getpath.c */
227+PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void);
228+PyAPI_FUNC(wchar_t *) Py_GetPrefix(void);
229+PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void);
230+PyAPI_FUNC(wchar_t *) Py_GetPath(void);
231+PyAPI_FUNC(void) Py_SetPath(const wchar_t *);
232+#ifdef MS_WINDOWS
233+int _Py_CheckPython3();
234+#endif
235+
236+/* In their own files */
237+PyAPI_FUNC(const char *) Py_GetVersion(void);
238+PyAPI_FUNC(const char *) Py_GetPlatform(void);
239+PyAPI_FUNC(const char *) Py_GetCopyright(void);
240+PyAPI_FUNC(const char *) Py_GetCompiler(void);
241+PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
242+#ifndef Py_LIMITED_API
243+PyAPI_FUNC(const char *) _Py_svnversion(void);
244+PyAPI_FUNC(const char *) Py_SubversionRevision(void);
245+PyAPI_FUNC(const char *) Py_SubversionShortBranch(void);
246+#endif
247+
248+/* Internal -- various one-time initializations */
249+#ifndef Py_LIMITED_API
250+PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
251+PyAPI_FUNC(PyObject *) _PySys_Init(void);
252+PyAPI_FUNC(void) _PyImport_Init(void);
253+PyAPI_FUNC(void) _PyExc_Init(void);
254+PyAPI_FUNC(void) _PyImportHooks_Init(void);
255+PyAPI_FUNC(int) _PyFrame_Init(void);
256+PyAPI_FUNC(void) _PyFloat_Init(void);
257+PyAPI_FUNC(int) PyByteArray_Init(void);
258+#endif
259+
260+/* Various internal finalizers */
261+#ifndef Py_LIMITED_API
262+PyAPI_FUNC(void) _PyExc_Fini(void);
263+PyAPI_FUNC(void) _PyImport_Fini(void);
264+PyAPI_FUNC(void) PyMethod_Fini(void);
265+PyAPI_FUNC(void) PyFrame_Fini(void);
266+PyAPI_FUNC(void) PyCFunction_Fini(void);
267+PyAPI_FUNC(void) PyDict_Fini(void);
268+PyAPI_FUNC(void) PyTuple_Fini(void);
269+PyAPI_FUNC(void) PyList_Fini(void);
270+PyAPI_FUNC(void) PySet_Fini(void);
271+PyAPI_FUNC(void) PyBytes_Fini(void);
272+PyAPI_FUNC(void) PyByteArray_Fini(void);
273+PyAPI_FUNC(void) PyFloat_Fini(void);
274+PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
275+PyAPI_FUNC(void) _PyGC_Fini(void);
276+#endif
277+
278+/* Stuff with no proper home (yet) */
279+#ifndef Py_LIMITED_API
280+PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *);
281+#endif
282+PyAPI_DATA(int) (*PyOS_InputHook)(void);
283+PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *);
284+#ifndef Py_LIMITED_API
285+PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
286+#endif
287+
288+/* Stack size, in "pointers" (so we get extra safety margins
289+ on 64-bit platforms). On a 32-bit platform, this translates
290+ to a 8k margin. */
291+#define PYOS_STACK_MARGIN 2048
292+
293+#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) && _MSC_VER >= 1300
294+/* Enable stack checking under Microsoft C */
295+#define USE_STACKCHECK
296+#endif
297+
298+#ifdef USE_STACKCHECK
299+/* Check that we aren't overflowing our stack */
300+PyAPI_FUNC(int) PyOS_CheckStack(void);
301+#endif
302+
303+/* Signals */
304+typedef void (*PyOS_sighandler_t)(int);
305+PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int);
306+PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
307+
308+
309+#ifdef __cplusplus
310+}
311+#endif
312+#endif /* !Py_PYTHONRUN_H */
313diff -Nur Python-3.2.orig//Lib/distutils/command/install.py Python-3.2/Lib/distutils/command/install.py
314--- Python-3.2.orig//Lib/distutils/command/install.py 2010-11-25 03:46:44.000000000 +0000
315+++ Python-3.2/Lib/distutils/command/install.py 2011-05-21 21:16:30.000000000 +0100
e3852288
JB
316@@ -27,6 +27,8 @@
317 from site import USER_SITE
318 HAS_USER_SITE = True
e684db95
AM
319
320+libname = sys.lib
321+
322 if sys.version < "2.2":
323 WINDOWS_SCHEME = {
324 'purelib': '$base',
e3852288 325@@ -47,14 +49,14 @@
e684db95
AM
326 INSTALL_SCHEMES = {
327 'unix_prefix': {
328 'purelib': '$base/lib/python$py_version_short/site-packages',
329- 'platlib': '$platbase/lib/python$py_version_short/site-packages',
330+ 'platlib': '$platbase/'+libname+'/python$py_version_short/site-packages',
e3852288 331 'headers': '$base/include/python$py_version_short$abiflags/$dist_name',
e684db95
AM
332 'scripts': '$base/bin',
333 'data' : '$base',
334 },
335 'unix_home': {
336 'purelib': '$base/lib/python',
337- 'platlib': '$base/lib/python',
338+ 'platlib': '$base/'+libname+'/python',
339 'headers': '$base/include/python/$dist_name',
340 'scripts': '$base/bin',
341 'data' : '$base',
75257062 342diff -Nur Python-3.2.orig//Lib/distutils/sysconfig.py Python-3.2/Lib/distutils/sysconfig.py
343--- Python-3.2.orig//Lib/distutils/sysconfig.py 2010-11-24 19:43:47.000000000 +0000
344+++ Python-3.2/Lib/distutils/sysconfig.py 2011-05-21 21:16:30.000000000 +0100
345@@ -124,8 +124,12 @@
e684db95
AM
346 prefix = plat_specific and EXEC_PREFIX or PREFIX
347
348 if os.name == "posix":
349+ if plat_specific:
350+ lib = sys.lib
351+ else:
352+ lib = 'lib'
353 libpython = os.path.join(prefix,
354- "lib", "python" + get_python_version())
355+ lib, "python" + get_python_version())
356 if standard_lib:
357 return libpython
358 else:
75257062 359diff -Nur Python-3.2.orig//Lib/distutils/sysconfig.py.orig Python-3.2/Lib/distutils/sysconfig.py.orig
360--- Python-3.2.orig//Lib/distutils/sysconfig.py.orig 1970-01-01 01:00:00.000000000 +0100
361+++ Python-3.2/Lib/distutils/sysconfig.py.orig 2010-11-24 19:43:47.000000000 +0000
362@@ -0,0 +1,583 @@
363+"""Provide access to Python's configuration information. The specific
364+configuration variables available depend heavily on the platform and
365+configuration. The values may be retrieved using
366+get_config_var(name), and the list of variables is available via
367+get_config_vars().keys(). Additional convenience functions are also
368+available.
369+
370+Written by: Fred L. Drake, Jr.
371+Email: <fdrake@acm.org>
372+"""
373+
374+__revision__ = "$Id$"
375+
376+import os
377+import re
378+import sys
379+
380+from .errors import DistutilsPlatformError
381+
382+# These are needed in a couple of spots, so just compute them once.
383+PREFIX = os.path.normpath(sys.prefix)
384+EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
385+
386+# Path to the base directory of the project. On Windows the binary may
387+# live in project/PCBuild9. If we're dealing with an x64 Windows build,
388+# it'll live in project/PCbuild/amd64.
389+project_base = os.path.dirname(os.path.abspath(sys.executable))
390+if os.name == "nt" and "pcbuild" in project_base[-8:].lower():
391+ project_base = os.path.abspath(os.path.join(project_base, os.path.pardir))
392+# PC/VS7.1
393+if os.name == "nt" and "\\pc\\v" in project_base[-10:].lower():
394+ project_base = os.path.abspath(os.path.join(project_base, os.path.pardir,
395+ os.path.pardir))
396+# PC/AMD64
397+if os.name == "nt" and "\\pcbuild\\amd64" in project_base[-14:].lower():
398+ project_base = os.path.abspath(os.path.join(project_base, os.path.pardir,
399+ os.path.pardir))
400+
401+# python_build: (Boolean) if true, we're either building Python or
402+# building an extension with an un-installed Python, so we use
403+# different (hard-wired) directories.
404+# Setup.local is available for Makefile builds including VPATH builds,
405+# Setup.dist is available on Windows
406+def _python_build():
407+ for fn in ("Setup.dist", "Setup.local"):
408+ if os.path.isfile(os.path.join(project_base, "Modules", fn)):
409+ return True
410+ return False
411+python_build = _python_build()
412+
413+# Calculate the build qualifier flags if they are defined. Adding the flags
414+# to the include and lib directories only makes sense for an installation, not
415+# an in-source build.
416+build_flags = ''
417+try:
418+ if not python_build:
419+ build_flags = sys.abiflags
420+except AttributeError:
421+ # It's not a configure-based build, so the sys module doesn't have
422+ # this attribute, which is fine.
423+ pass
424+
425+def get_python_version():
426+ """Return a string containing the major and minor Python version,
427+ leaving off the patchlevel. Sample return values could be '1.5'
428+ or '2.2'.
429+ """
430+ return sys.version[:3]
431+
432+
433+def get_python_inc(plat_specific=0, prefix=None):
434+ """Return the directory containing installed Python header files.
435+
436+ If 'plat_specific' is false (the default), this is the path to the
437+ non-platform-specific header files, i.e. Python.h and so on;
438+ otherwise, this is the path to platform-specific header files
439+ (namely pyconfig.h).
440+
441+ If 'prefix' is supplied, use it instead of sys.prefix or
442+ sys.exec_prefix -- i.e., ignore 'plat_specific'.
443+ """
444+ if prefix is None:
445+ prefix = plat_specific and EXEC_PREFIX or PREFIX
446+ if os.name == "posix":
447+ if python_build:
448+ # Assume the executable is in the build directory. The
449+ # pyconfig.h file should be in the same directory. Since
450+ # the build directory may not be the source directory, we
451+ # must use "srcdir" from the makefile to find the "Include"
452+ # directory.
453+ base = os.path.dirname(os.path.abspath(sys.executable))
454+ if plat_specific:
455+ return base
456+ else:
457+ incdir = os.path.join(get_config_var('srcdir'), 'Include')
458+ return os.path.normpath(incdir)
459+ python_dir = 'python' + get_python_version() + build_flags
460+ return os.path.join(prefix, "include", python_dir)
461+ elif os.name == "nt":
462+ return os.path.join(prefix, "include")
463+ elif os.name == "os2":
464+ return os.path.join(prefix, "Include")
465+ else:
466+ raise DistutilsPlatformError(
467+ "I don't know where Python installs its C header files "
468+ "on platform '%s'" % os.name)
469+
470+
471+def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
472+ """Return the directory containing the Python library (standard or
473+ site additions).
474+
475+ If 'plat_specific' is true, return the directory containing
476+ platform-specific modules, i.e. any module from a non-pure-Python
477+ module distribution; otherwise, return the platform-shared library
478+ directory. If 'standard_lib' is true, return the directory
479+ containing standard Python library modules; otherwise, return the
480+ directory for site-specific modules.
481+
482+ If 'prefix' is supplied, use it instead of sys.prefix or
483+ sys.exec_prefix -- i.e., ignore 'plat_specific'.
484+ """
485+ if prefix is None:
486+ prefix = plat_specific and EXEC_PREFIX or PREFIX
487+
488+ if os.name == "posix":
489+ libpython = os.path.join(prefix,
490+ "lib", "python" + get_python_version())
491+ if standard_lib:
492+ return libpython
493+ else:
494+ return os.path.join(libpython, "site-packages")
495+ elif os.name == "nt":
496+ if standard_lib:
497+ return os.path.join(prefix, "Lib")
498+ else:
499+ if get_python_version() < "2.2":
500+ return prefix
501+ else:
502+ return os.path.join(prefix, "Lib", "site-packages")
503+ elif os.name == "os2":
504+ if standard_lib:
505+ return os.path.join(prefix, "Lib")
506+ else:
507+ return os.path.join(prefix, "Lib", "site-packages")
508+ else:
509+ raise DistutilsPlatformError(
510+ "I don't know where Python installs its library "
511+ "on platform '%s'" % os.name)
512+
513+
514+def customize_compiler(compiler):
515+ """Do any platform-specific customization of a CCompiler instance.
516+
517+ Mainly needed on Unix, so we can plug in the information that
518+ varies across Unices and is stored in Python's Makefile.
519+ """
520+ if compiler.compiler_type == "unix":
521+ (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \
522+ get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
523+ 'CCSHARED', 'LDSHARED', 'SO', 'AR', 'ARFLAGS')
524+
525+ if 'CC' in os.environ:
526+ cc = os.environ['CC']
527+ if 'CXX' in os.environ:
528+ cxx = os.environ['CXX']
529+ if 'LDSHARED' in os.environ:
530+ ldshared = os.environ['LDSHARED']
531+ if 'CPP' in os.environ:
532+ cpp = os.environ['CPP']
533+ else:
534+ cpp = cc + " -E" # not always
535+ if 'LDFLAGS' in os.environ:
536+ ldshared = ldshared + ' ' + os.environ['LDFLAGS']
537+ if 'CFLAGS' in os.environ:
538+ cflags = opt + ' ' + os.environ['CFLAGS']
539+ ldshared = ldshared + ' ' + os.environ['CFLAGS']
540+ if 'CPPFLAGS' in os.environ:
541+ cpp = cpp + ' ' + os.environ['CPPFLAGS']
542+ cflags = cflags + ' ' + os.environ['CPPFLAGS']
543+ ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
544+ if 'AR' in os.environ:
545+ ar = os.environ['AR']
546+ if 'ARFLAGS' in os.environ:
547+ archiver = ar + ' ' + os.environ['ARFLAGS']
548+ else:
549+ archiver = ar + ' ' + ar_flags
550+
551+ cc_cmd = cc + ' ' + cflags
552+ compiler.set_executables(
553+ preprocessor=cpp,
554+ compiler=cc_cmd,
555+ compiler_so=cc_cmd + ' ' + ccshared,
556+ compiler_cxx=cxx,
557+ linker_so=ldshared,
558+ linker_exe=cc,
559+ archiver=archiver)
560+
561+ compiler.shared_lib_extension = so_ext
562+
563+
564+def get_config_h_filename():
565+ """Return full pathname of installed pyconfig.h file."""
566+ if python_build:
567+ if os.name == "nt":
568+ inc_dir = os.path.join(project_base, "PC")
569+ else:
570+ inc_dir = project_base
571+ else:
572+ inc_dir = get_python_inc(plat_specific=1)
573+ if get_python_version() < '2.2':
574+ config_h = 'config.h'
575+ else:
576+ # The name of the config.h file changed in 2.2
577+ config_h = 'pyconfig.h'
578+ return os.path.join(inc_dir, config_h)
579+
580+
581+def get_makefile_filename():
582+ """Return full pathname of installed Makefile from the Python build."""
583+ if python_build:
584+ return os.path.join(os.path.dirname(sys.executable), "Makefile")
585+ lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
586+ config_file = 'config-{}{}'.format(get_python_version(), build_flags)
587+ return os.path.join(lib_dir, config_file, 'Makefile')
588+
589+
590+def parse_config_h(fp, g=None):
591+ """Parse a config.h-style file.
592+
593+ A dictionary containing name/value pairs is returned. If an
594+ optional dictionary is passed in as the second argument, it is
595+ used instead of a new dictionary.
596+ """
597+ if g is None:
598+ g = {}
599+ define_rx = re.compile("#define ([A-Z][A-Za-z0-9_]+) (.*)\n")
600+ undef_rx = re.compile("/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/\n")
601+ #
602+ while True:
603+ line = fp.readline()
604+ if not line:
605+ break
606+ m = define_rx.match(line)
607+ if m:
608+ n, v = m.group(1, 2)
609+ try: v = int(v)
610+ except ValueError: pass
611+ g[n] = v
612+ else:
613+ m = undef_rx.match(line)
614+ if m:
615+ g[m.group(1)] = 0
616+ return g
617+
618+
619+# Regexes needed for parsing Makefile (and similar syntaxes,
620+# like old-style Setup files).
621+_variable_rx = re.compile("([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)")
622+_findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)")
623+_findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}")
624+
625+def parse_makefile(fn, g=None):
626+ """Parse a Makefile-style file.
627+
628+ A dictionary containing name/value pairs is returned. If an
629+ optional dictionary is passed in as the second argument, it is
630+ used instead of a new dictionary.
631+ """
632+ from distutils.text_file import TextFile
633+ fp = TextFile(fn, strip_comments=1, skip_blanks=1, join_lines=1, errors="surrogateescape")
634+
635+ if g is None:
636+ g = {}
637+ done = {}
638+ notdone = {}
639+
640+ while True:
641+ line = fp.readline()
642+ if line is None: # eof
643+ break
644+ m = _variable_rx.match(line)
645+ if m:
646+ n, v = m.group(1, 2)
647+ v = v.strip()
648+ # `$$' is a literal `$' in make
649+ tmpv = v.replace('$$', '')
650+
651+ if "$" in tmpv:
652+ notdone[n] = v
653+ else:
654+ try:
655+ v = int(v)
656+ except ValueError:
657+ # insert literal `$'
658+ done[n] = v.replace('$$', '$')
659+ else:
660+ done[n] = v
661+
662+ # Variables with a 'PY_' prefix in the makefile. These need to
663+ # be made available without that prefix through sysconfig.
664+ # Special care is needed to ensure that variable expansion works, even
665+ # if the expansion uses the name without a prefix.
666+ renamed_variables = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS')
667+
668+ # do variable interpolation here
669+ while notdone:
670+ for name in list(notdone):
671+ value = notdone[name]
672+ m = _findvar1_rx.search(value) or _findvar2_rx.search(value)
673+ if m:
674+ n = m.group(1)
675+ found = True
676+ if n in done:
677+ item = str(done[n])
678+ elif n in notdone:
679+ # get it on a subsequent round
680+ found = False
681+ elif n in os.environ:
682+ # do it like make: fall back to environment
683+ item = os.environ[n]
684+
685+ elif n in renamed_variables:
686+ if name.startswith('PY_') and name[3:] in renamed_variables:
687+ item = ""
688+
689+ elif 'PY_' + n in notdone:
690+ found = False
691+
692+ else:
693+ item = str(done['PY_' + n])
694+ else:
695+ done[n] = item = ""
696+ if found:
697+ after = value[m.end():]
698+ value = value[:m.start()] + item + after
699+ if "$" in after:
700+ notdone[name] = value
701+ else:
702+ try: value = int(value)
703+ except ValueError:
704+ done[name] = value.strip()
705+ else:
706+ done[name] = value
707+ del notdone[name]
708+
709+ if name.startswith('PY_') \
710+ and name[3:] in renamed_variables:
711+
712+ name = name[3:]
713+ if name not in done:
714+ done[name] = value
715+ else:
716+ # bogus variable reference; just drop it since we can't deal
717+ del notdone[name]
718+
719+ fp.close()
720+
721+ # strip spurious spaces
722+ for k, v in done.items():
723+ if isinstance(v, str):
724+ done[k] = v.strip()
725+
726+ # save the results in the global dictionary
727+ g.update(done)
728+ return g
729+
730+
731+def expand_makefile_vars(s, vars):
732+ """Expand Makefile-style variables -- "${foo}" or "$(foo)" -- in
733+ 'string' according to 'vars' (a dictionary mapping variable names to
734+ values). Variables not present in 'vars' are silently expanded to the
735+ empty string. The variable values in 'vars' should not contain further
736+ variable expansions; if 'vars' is the output of 'parse_makefile()',
737+ you're fine. Returns a variable-expanded version of 's'.
738+ """
739+
740+ # This algorithm does multiple expansion, so if vars['foo'] contains
741+ # "${bar}", it will expand ${foo} to ${bar}, and then expand
742+ # ${bar}... and so forth. This is fine as long as 'vars' comes from
743+ # 'parse_makefile()', which takes care of such expansions eagerly,
744+ # according to make's variable expansion semantics.
745+
746+ while True:
747+ m = _findvar1_rx.search(s) or _findvar2_rx.search(s)
748+ if m:
749+ (beg, end) = m.span()
750+ s = s[0:beg] + vars.get(m.group(1)) + s[end:]
751+ else:
752+ break
753+ return s
754+
755+
756+_config_vars = None
757+
758+def _init_posix():
759+ """Initialize the module as appropriate for POSIX systems."""
760+ g = {}
761+ # load the installed Makefile:
762+ try:
763+ filename = get_makefile_filename()
764+ parse_makefile(filename, g)
765+ except IOError as msg:
766+ my_msg = "invalid Python installation: unable to open %s" % filename
767+ if hasattr(msg, "strerror"):
768+ my_msg = my_msg + " (%s)" % msg.strerror
769+
770+ raise DistutilsPlatformError(my_msg)
771+
772+ # load the installed pyconfig.h:
773+ try:
774+ filename = get_config_h_filename()
775+ with open(filename) as file:
776+ parse_config_h(file, g)
777+ except IOError as msg:
778+ my_msg = "invalid Python installation: unable to open %s" % filename
779+ if hasattr(msg, "strerror"):
780+ my_msg = my_msg + " (%s)" % msg.strerror
781+
782+ raise DistutilsPlatformError(my_msg)
783+
784+ # On MacOSX we need to check the setting of the environment variable
785+ # MACOSX_DEPLOYMENT_TARGET: configure bases some choices on it so
786+ # it needs to be compatible.
787+ # If it isn't set we set it to the configure-time value
788+ if sys.platform == 'darwin' and 'MACOSX_DEPLOYMENT_TARGET' in g:
789+ cfg_target = g['MACOSX_DEPLOYMENT_TARGET']
790+ cur_target = os.getenv('MACOSX_DEPLOYMENT_TARGET', '')
791+ if cur_target == '':
792+ cur_target = cfg_target
793+ os.putenv('MACOSX_DEPLOYMENT_TARGET', cfg_target)
794+ elif [int(x) for x in cfg_target.split('.')] > [int(x) for x in cur_target.split('.')]:
795+ my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: now "%s" but "%s" during configure'
796+ % (cur_target, cfg_target))
797+ raise DistutilsPlatformError(my_msg)
798+
799+ # On AIX, there are wrong paths to the linker scripts in the Makefile
800+ # -- these paths are relative to the Python source, but when installed
801+ # the scripts are in another directory.
802+ if python_build:
803+ g['LDSHARED'] = g['BLDSHARED']
804+
805+ elif get_python_version() < '2.1':
806+ # The following two branches are for 1.5.2 compatibility.
807+ if sys.platform == 'aix4': # what about AIX 3.x ?
808+ # Linker script is in the config directory, not in Modules as the
809+ # Makefile says.
810+ python_lib = get_python_lib(standard_lib=1)
811+ ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix')
812+ python_exp = os.path.join(python_lib, 'config', 'python.exp')
813+
814+ g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp)
815+
816+ global _config_vars
817+ _config_vars = g
818+
819+
820+def _init_nt():
821+ """Initialize the module as appropriate for NT"""
822+ g = {}
823+ # set basic install directories
824+ g['LIBDEST'] = get_python_lib(plat_specific=0, standard_lib=1)
825+ g['BINLIBDEST'] = get_python_lib(plat_specific=1, standard_lib=1)
826+
827+ # XXX hmmm.. a normal install puts include files here
828+ g['INCLUDEPY'] = get_python_inc(plat_specific=0)
829+
830+ g['SO'] = '.pyd'
831+ g['EXE'] = ".exe"
832+ g['VERSION'] = get_python_version().replace(".", "")
833+ g['BINDIR'] = os.path.dirname(os.path.abspath(sys.executable))
834+
835+ global _config_vars
836+ _config_vars = g
837+
838+
839+def _init_os2():
840+ """Initialize the module as appropriate for OS/2"""
841+ g = {}
842+ # set basic install directories
843+ g['LIBDEST'] = get_python_lib(plat_specific=0, standard_lib=1)
844+ g['BINLIBDEST'] = get_python_lib(plat_specific=1, standard_lib=1)
845+
846+ # XXX hmmm.. a normal install puts include files here
847+ g['INCLUDEPY'] = get_python_inc(plat_specific=0)
848+
849+ g['SO'] = '.pyd'
850+ g['EXE'] = ".exe"
851+
852+ global _config_vars
853+ _config_vars = g
854+
855+
856+def get_config_vars(*args):
857+ """With no arguments, return a dictionary of all configuration
858+ variables relevant for the current platform. Generally this includes
859+ everything needed to build extensions and install both pure modules and
860+ extensions. On Unix, this means every variable defined in Python's
861+ installed Makefile; on Windows and Mac OS it's a much smaller set.
862+
863+ With arguments, return a list of values that result from looking up
864+ each argument in the configuration variable dictionary.
865+ """
866+ global _config_vars
867+ if _config_vars is None:
868+ func = globals().get("_init_" + os.name)
869+ if func:
870+ func()
871+ else:
872+ _config_vars = {}
873+
874+ # Normalized versions of prefix and exec_prefix are handy to have;
875+ # in fact, these are the standard versions used most places in the
876+ # Distutils.
877+ _config_vars['prefix'] = PREFIX
878+ _config_vars['exec_prefix'] = EXEC_PREFIX
879+
880+ # Convert srcdir into an absolute path if it appears necessary.
881+ # Normally it is relative to the build directory. However, during
882+ # testing, for example, we might be running a non-installed python
883+ # from a different directory.
884+ if python_build and os.name == "posix":
885+ base = os.path.dirname(os.path.abspath(sys.executable))
886+ if (not os.path.isabs(_config_vars['srcdir']) and
887+ base != os.getcwd()):
888+ # srcdir is relative and we are not in the same directory
889+ # as the executable. Assume executable is in the build
890+ # directory and make srcdir absolute.
891+ srcdir = os.path.join(base, _config_vars['srcdir'])
892+ _config_vars['srcdir'] = os.path.normpath(srcdir)
893+
894+ if sys.platform == 'darwin':
895+ kernel_version = os.uname()[2] # Kernel version (8.4.3)
896+ major_version = int(kernel_version.split('.')[0])
897+
898+ if major_version < 8:
899+ # On Mac OS X before 10.4, check if -arch and -isysroot
900+ # are in CFLAGS or LDFLAGS and remove them if they are.
901+ # This is needed when building extensions on a 10.3 system
902+ # using a universal build of python.
903+ for key in ('LDFLAGS', 'BASECFLAGS',
904+ # a number of derived variables. These need to be
905+ # patched up as well.
906+ 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
907+ flags = _config_vars[key]
908+ flags = re.sub('-arch\s+\w+\s', ' ', flags, re.ASCII)
909+ flags = re.sub('-isysroot [^ \t]*', ' ', flags)
910+ _config_vars[key] = flags
911+
912+ else:
913+
914+ # Allow the user to override the architecture flags using
915+ # an environment variable.
916+ # NOTE: This name was introduced by Apple in OSX 10.5 and
917+ # is used by several scripting languages distributed with
918+ # that OS release.
919+
920+ if 'ARCHFLAGS' in os.environ:
921+ arch = os.environ['ARCHFLAGS']
922+ for key in ('LDFLAGS', 'BASECFLAGS',
923+ # a number of derived variables. These need to be
924+ # patched up as well.
925+ 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
926+
927+ flags = _config_vars[key]
928+ flags = re.sub('-arch\s+\w+\s', ' ', flags)
929+ flags = flags + ' ' + arch
930+ _config_vars[key] = flags
931+
932+ if args:
933+ vals = []
934+ for name in args:
935+ vals.append(_config_vars.get(name))
936+ return vals
937+ else:
938+ return _config_vars
939+
940+def get_config_var(name):
941+ """Return the value of a single variable using the dictionary
942+ returned by 'get_config_vars()'. Equivalent to
943+ get_config_vars().get(name)
944+ """
945+ return get_config_vars().get(name)
946diff -Nur Python-3.2.orig//Lib/distutils/tests/test_install.py Python-3.2/Lib/distutils/tests/test_install.py
947--- Python-3.2.orig//Lib/distutils/tests/test_install.py 2010-11-20 19:04:17.000000000 +0000
948+++ Python-3.2/Lib/distutils/tests/test_install.py 2011-05-21 21:16:30.000000000 +0100
949@@ -49,8 +49,9 @@
e684db95
AM
950 self.assertEqual(got, expected)
951
952 libdir = os.path.join(destination, "lib", "python")
953+ platlibdir = os.path.join(destination, sys.lib, "python")
954 check_path(cmd.install_lib, libdir)
955- check_path(cmd.install_platlib, libdir)
956+ check_path(cmd.install_platlib, platlibdir)
957 check_path(cmd.install_purelib, libdir)
958 check_path(cmd.install_headers,
959 os.path.join(destination, "include", "python", "foopkg"))
75257062 960diff -Nur Python-3.2.orig//Lib/distutils/tests/test_install.py.orig Python-3.2/Lib/distutils/tests/test_install.py.orig
961--- Python-3.2.orig//Lib/distutils/tests/test_install.py.orig 1970-01-01 01:00:00.000000000 +0100
962+++ Python-3.2/Lib/distutils/tests/test_install.py.orig 2010-11-20 19:04:17.000000000 +0000
963@@ -0,0 +1,206 @@
964+"""Tests for distutils.command.install."""
965+
966+import os
967+import os.path
968+import sys
969+import unittest
970+import site
971+
972+from test.support import captured_stdout, run_unittest
973+
974+from distutils.command.install import install
975+from distutils.command import install as install_module
976+from distutils.command.install import INSTALL_SCHEMES
977+from distutils.core import Distribution
978+from distutils.errors import DistutilsOptionError
979+
980+from distutils.tests import support
981+
982+class InstallTestCase(support.TempdirManager,
983+ support.EnvironGuard,
984+ support.LoggingSilencer,
985+ unittest.TestCase):
986+
987+ def test_home_installation_scheme(self):
988+ # This ensure two things:
989+ # - that --home generates the desired set of directory names
990+ # - test --home is supported on all platforms
991+ builddir = self.mkdtemp()
992+ destination = os.path.join(builddir, "installation")
993+
994+ dist = Distribution({"name": "foopkg"})
995+ # script_name need not exist, it just need to be initialized
996+ dist.script_name = os.path.join(builddir, "setup.py")
997+ dist.command_obj["build"] = support.DummyCommand(
998+ build_base=builddir,
999+ build_lib=os.path.join(builddir, "lib"),
1000+ )
1001+
1002+ cmd = install(dist)
1003+ cmd.home = destination
1004+ cmd.ensure_finalized()
1005+
1006+ self.assertEqual(cmd.install_base, destination)
1007+ self.assertEqual(cmd.install_platbase, destination)
1008+
1009+ def check_path(got, expected):
1010+ got = os.path.normpath(got)
1011+ expected = os.path.normpath(expected)
1012+ self.assertEqual(got, expected)
1013+
1014+ libdir = os.path.join(destination, "lib", "python")
1015+ check_path(cmd.install_lib, libdir)
1016+ check_path(cmd.install_platlib, libdir)
1017+ check_path(cmd.install_purelib, libdir)
1018+ check_path(cmd.install_headers,
1019+ os.path.join(destination, "include", "python", "foopkg"))
1020+ check_path(cmd.install_scripts, os.path.join(destination, "bin"))
1021+ check_path(cmd.install_data, destination)
1022+
1023+ def test_user_site(self):
1024+ # site.USER_SITE was introduced in 2.6
1025+ if sys.version < '2.6':
1026+ return
1027+
1028+ # preparing the environement for the test
1029+ self.old_user_base = site.USER_BASE
1030+ self.old_user_site = site.USER_SITE
1031+ self.tmpdir = self.mkdtemp()
1032+ self.user_base = os.path.join(self.tmpdir, 'B')
1033+ self.user_site = os.path.join(self.tmpdir, 'S')
1034+ site.USER_BASE = self.user_base
1035+ site.USER_SITE = self.user_site
1036+ install_module.USER_BASE = self.user_base
1037+ install_module.USER_SITE = self.user_site
1038+
1039+ def _expanduser(path):
1040+ return self.tmpdir
1041+ self.old_expand = os.path.expanduser
1042+ os.path.expanduser = _expanduser
1043+
1044+ try:
1045+ # this is the actual test
1046+ self._test_user_site()
1047+ finally:
1048+ site.USER_BASE = self.old_user_base
1049+ site.USER_SITE = self.old_user_site
1050+ install_module.USER_BASE = self.old_user_base
1051+ install_module.USER_SITE = self.old_user_site
1052+ os.path.expanduser = self.old_expand
1053+
1054+ def _test_user_site(self):
1055+ for key in ('nt_user', 'unix_user', 'os2_home'):
1056+ self.assertTrue(key in INSTALL_SCHEMES)
1057+
1058+ dist = Distribution({'name': 'xx'})
1059+ cmd = install(dist)
1060+
1061+ # making sure the user option is there
1062+ options = [name for name, short, lable in
1063+ cmd.user_options]
1064+ self.assertTrue('user' in options)
1065+
1066+ # setting a value
1067+ cmd.user = 1
1068+
1069+ # user base and site shouldn't be created yet
1070+ self.assertTrue(not os.path.exists(self.user_base))
1071+ self.assertTrue(not os.path.exists(self.user_site))
1072+
1073+ # let's run finalize
1074+ cmd.ensure_finalized()
1075+
1076+ # now they should
1077+ self.assertTrue(os.path.exists(self.user_base))
1078+ self.assertTrue(os.path.exists(self.user_site))
1079+
1080+ self.assertTrue('userbase' in cmd.config_vars)
1081+ self.assertTrue('usersite' in cmd.config_vars)
1082+
1083+ def test_handle_extra_path(self):
1084+ dist = Distribution({'name': 'xx', 'extra_path': 'path,dirs'})
1085+ cmd = install(dist)
1086+
1087+ # two elements
1088+ cmd.handle_extra_path()
1089+ self.assertEqual(cmd.extra_path, ['path', 'dirs'])
1090+ self.assertEqual(cmd.extra_dirs, 'dirs')
1091+ self.assertEqual(cmd.path_file, 'path')
1092+
1093+ # one element
1094+ cmd.extra_path = ['path']
1095+ cmd.handle_extra_path()
1096+ self.assertEqual(cmd.extra_path, ['path'])
1097+ self.assertEqual(cmd.extra_dirs, 'path')
1098+ self.assertEqual(cmd.path_file, 'path')
1099+
1100+ # none
1101+ dist.extra_path = cmd.extra_path = None
1102+ cmd.handle_extra_path()
1103+ self.assertEqual(cmd.extra_path, None)
1104+ self.assertEqual(cmd.extra_dirs, '')
1105+ self.assertEqual(cmd.path_file, None)
1106+
1107+ # three elements (no way !)
1108+ cmd.extra_path = 'path,dirs,again'
1109+ self.assertRaises(DistutilsOptionError, cmd.handle_extra_path)
1110+
1111+ def test_finalize_options(self):
1112+ dist = Distribution({'name': 'xx'})
1113+ cmd = install(dist)
1114+
1115+ # must supply either prefix/exec-prefix/home or
1116+ # install-base/install-platbase -- not both
1117+ cmd.prefix = 'prefix'
1118+ cmd.install_base = 'base'
1119+ self.assertRaises(DistutilsOptionError, cmd.finalize_options)
1120+
1121+ # must supply either home or prefix/exec-prefix -- not both
1122+ cmd.install_base = None
1123+ cmd.home = 'home'
1124+ self.assertRaises(DistutilsOptionError, cmd.finalize_options)
1125+
1126+ # can't combine user with with prefix/exec_prefix/home or
1127+ # install_(plat)base
1128+ cmd.prefix = None
1129+ cmd.user = 'user'
1130+ self.assertRaises(DistutilsOptionError, cmd.finalize_options)
1131+
1132+ def test_record(self):
1133+
1134+ install_dir = self.mkdtemp()
1135+ pkgdir, dist = self.create_dist()
1136+
1137+ dist = Distribution()
1138+ cmd = install(dist)
1139+ dist.command_obj['install'] = cmd
1140+ cmd.root = install_dir
1141+ cmd.record = os.path.join(pkgdir, 'RECORD')
1142+ cmd.ensure_finalized()
1143+
1144+ cmd.run()
1145+
1146+ # let's check the RECORD file was created with one
1147+ # line (the egg info file)
1148+ f = open(cmd.record)
1149+ try:
1150+ self.assertEqual(len(f.readlines()), 1)
1151+ finally:
1152+ f.close()
1153+
1154+ def test_debug_mode(self):
1155+ # this covers the code called when DEBUG is set
1156+ old_logs_len = len(self.logs)
1157+ install_module.DEBUG = True
1158+ try:
1159+ with captured_stdout() as stdout:
1160+ self.test_record()
1161+ finally:
1162+ install_module.DEBUG = False
1163+ self.assertTrue(len(self.logs) > old_logs_len)
1164+
1165+def test_suite():
1166+ return unittest.makeSuite(InstallTestCase)
1167+
1168+if __name__ == "__main__":
1169+ run_unittest(test_suite())
1170diff -Nur Python-3.2.orig//Lib/site.py Python-3.2/Lib/site.py
1171--- Python-3.2.orig//Lib/site.py 2010-12-26 19:54:29.000000000 +0000
1172+++ Python-3.2/Lib/site.py 2011-05-21 21:16:30.000000000 +0100
e3852288 1173@@ -285,13 +285,16 @@
04df829f 1174 if sys.platform in ('os2emx', 'riscos'):
e3852288 1175 sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
04df829f 1176 elif os.sep == '/':
e3852288
JB
1177- sitepackages.append(os.path.join(prefix, "lib",
1178+ sitepackages.append(os.path.join(prefix, sys.lib,
04df829f 1179 "python" + sys.version[:3],
1180 "site-packages"))
e3852288
JB
1181- sitepackages.append(os.path.join(prefix, "lib", "site-python"))
1182+ sitepackages.append(os.path.join(prefix, sys.lib, "site-python"))
04df829f 1183+ if sys.lib != 'lib':
e3852288
JB
1184+ sitepackages.append(os.path.join(prefix, "lib", "python" + sys.version[:3], "site-packages"))
1185+ sitepackages.append(os.path.join(prefix, "lib", "site-python"))
04df829f 1186 else:
e3852288
JB
1187 sitepackages.append(prefix)
1188- sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
1189+ sitepackages.append(os.path.join(prefix, sys.lib, "site-packages"))
04df829f 1190 if sys.platform == "darwin":
1191 # for framework builds *only* we add the standard Apple
e3852288 1192 # locations.
75257062 1193diff -Nur Python-3.2.orig//Lib/sysconfig.py Python-3.2/Lib/sysconfig.py
1194--- Python-3.2.orig//Lib/sysconfig.py 2010-11-25 01:34:47.000000000 +0000
1195+++ Python-3.2/Lib/sysconfig.py 2011-05-21 21:23:17.000000000 +0100
1196@@ -21,10 +21,10 @@
1197
1198 _INSTALL_SCHEMES = {
1199 'posix_prefix': {
1200- 'stdlib': '{base}/lib/python{py_version_short}',
1201- 'platstdlib': '{platbase}/lib/python{py_version_short}',
1202+ 'stdlib': '{base}/' + sys.lib + '/python{py_version_short}',
1203+ 'platstdlib': '{platbase}/' + sys.lib + '/python{py_version_short}',
1204 'purelib': '{base}/lib/python{py_version_short}/site-packages',
1205- 'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
1206+ 'platlib': '{platbase}/' + sys.lib + '/python{py_version_short}/site-packages',
1207 'include':
1208 '{base}/include/python{py_version_short}{abiflags}',
1209 'platinclude':
1210@@ -33,10 +33,10 @@
1211 'data': '{base}',
1212 },
1213 'posix_home': {
1214- 'stdlib': '{base}/lib/python',
1215- 'platstdlib': '{base}/lib/python',
1216+ 'stdlib': '{base}/' + sys.lib + '/python',
1217+ 'platstdlib': '{base}/' + sys.lib + '/python',
1218 'purelib': '{base}/lib/python',
1219- 'platlib': '{base}/lib/python',
1220+ 'platlib': '{base}/' + sys.lib + '/python',
1221 'include': '{base}/include/python',
1222 'platinclude': '{base}/include/python',
1223 'scripts': '{base}/bin',
1224diff -Nur Python-3.2.orig//Makefile.pre.in Python-3.2/Makefile.pre.in
1225--- Python-3.2.orig//Makefile.pre.in 2011-02-19 08:47:14.000000000 +0000
1226+++ Python-3.2/Makefile.pre.in 2011-05-21 21:16:30.000000000 +0100
e3852288 1227@@ -86,6 +86,8 @@
e684db95
AM
1228
1229 # Machine-dependent subdirectories
1230 MACHDEP= @MACHDEP@
1231+LIB= @LIB@
1232+ARCH= @ARCH@
1233
1234 # Install prefix for architecture-independent files
1235 prefix= @prefix@
e3852288 1236@@ -102,7 +104,7 @@
e684db95
AM
1237 MANDIR= @mandir@
1238 INCLUDEDIR= @includedir@
1239 CONFINCLUDEDIR= $(exec_prefix)/include
1240-SCRIPTDIR= $(prefix)/lib
1241+SCRIPTDIR= $(prefix)/$(LIB)
e3852288 1242 ABIFLAGS= @ABIFLAGS@
e684db95
AM
1243
1244 # Detailed destination directories
e3852288
JB
1245@@ -605,7 +607,7 @@
1246 Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
e684db95
AM
1247
1248 Python/getplatform.o: $(srcdir)/Python/getplatform.c
e3852288
JB
1249- $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
1250+ $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
e684db95
AM
1251
1252 Python/importdl.o: $(srcdir)/Python/importdl.c
e3852288 1253 $(CC) -c $(PY_CORE_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
75257062 1254diff -Nur Python-3.2.orig//Modules/getpath.c Python-3.2/Modules/getpath.c
1255--- Python-3.2.orig//Modules/getpath.c 2010-12-03 20:14:31.000000000 +0000
1256+++ Python-3.2/Modules/getpath.c 2011-05-21 21:16:30.000000000 +0100
e3852288 1257@@ -121,9 +121,17 @@
e684db95
AM
1258 #define EXEC_PREFIX PREFIX
1259 #endif
1260
1261+#ifndef LIB_PYTHON
1262+#if defined(__x86_64__) || (defined(__sparc__) && defined(__arch64__)) || defined(__powerpc64__) || defined(__s390x__)
a1d9b939 1263+#define LIB_PYTHON L"lib64/python"
e684db95 1264+#else
a1d9b939 1265+#define LIB_PYTHON L"lib/python"
e684db95
AM
1266+#endif
1267+#endif
1268+
1269 #ifndef PYTHONPATH
1270-#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
1271- EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
1272+#define PYTHONPATH PREFIX "/" LIB_PYTHON VERSION ":" \
1273+ EXEC_PREFIX "/" LIB_PYTHON VERSION "/lib-dynload:"
1274 #endif
1275
1276 #ifndef LANDMARK
e3852288 1277@@ -134,7 +142,7 @@
04df829f 1278 static wchar_t exec_prefix[MAXPATHLEN+1];
1279 static wchar_t progpath[MAXPATHLEN+1];
1280 static wchar_t *module_search_path = NULL;
e3852288
JB
1281-static wchar_t *lib_python = L"lib/python" VERSION;
1282+static wchar_t *lib_python = LIB_PYTHON VERSION;
04df829f 1283
e3852288
JB
1284 static void
1285 reduce(wchar_t *dir)
75257062 1286diff -Nur Python-3.2.orig//Python/getplatform.c Python-3.2/Python/getplatform.c
1287--- Python-3.2.orig//Python/getplatform.c 2000-09-02 00:29:29.000000000 +0100
1288+++ Python-3.2/Python/getplatform.c 2011-05-21 21:16:30.000000000 +0100
e684db95
AM
1289@@ -10,3 +10,23 @@
1290 {
1291 return PLATFORM;
1292 }
1293+
1294+#ifndef ARCH
1295+#define ARCH "unknown"
1296+#endif
1297+
1298+const char *
1299+Py_GetArch(void)
1300+{
1301+ return ARCH;
1302+}
1303+
1304+#ifndef LIB
1305+#define LIB "lib"
1306+#endif
1307+
1308+const char *
1309+Py_GetLib(void)
1310+{
1311+ return LIB;
1312+}
75257062 1313diff -Nur Python-3.2.orig//Python/sysmodule.c Python-3.2/Python/sysmodule.c
1314--- Python-3.2.orig//Python/sysmodule.c 2011-01-05 20:08:25.000000000 +0000
1315+++ Python-3.2/Python/sysmodule.c 2011-05-21 21:16:30.000000000 +0100
e3852288
JB
1316@@ -1608,6 +1608,10 @@
1317 PyUnicode_FromString(Py_GetCopyright()));
1318 SET_SYS_FROM_STRING("platform",
1319 PyUnicode_FromString(Py_GetPlatform()));
1320+ SET_SYS_FROM_STRING("arch",
1321+ PyUnicode_FromString(Py_GetArch()));
1322+ SET_SYS_FROM_STRING("lib",
1323+ PyUnicode_FromString(Py_GetLib()));
1324 SET_SYS_FROM_STRING("executable",
1325 PyUnicode_FromWideChar(
1326 Py_GetProgramFullPath(), -1));
75257062 1327diff -Nur Python-3.2.orig//setup.py Python-3.2/setup.py
1328--- Python-3.2.orig//setup.py 2010-12-28 09:51:43.000000000 +0000
1329+++ Python-3.2/setup.py 2011-05-21 21:16:30.000000000 +0100
e3852288
JB
1330@@ -422,12 +422,12 @@
1331 add_dir_to_list(self.compiler.include_dirs,
1332 sysconfig.get_config_var("INCLUDEDIR"))
e684db95
AM
1333
1334+ libname = sys.lib
1335 # lib_dirs and inc_dirs are used to search for files;
1336 # if a file is found in one of those directories, it can
1337 # be assumed that no additional -I,-L directives are needed.
1338 lib_dirs = self.compiler.library_dirs + [
1339- '/lib64', '/usr/lib64',
1340- '/lib', '/usr/lib',
1341+ libname, '/usr/'+libname
1342 ]
1343 inc_dirs = self.compiler.include_dirs + ['/usr/include']
1344 exts = []
e3852288
JB
1345@@ -620,11 +620,11 @@
1346 elif curses_library:
1347 readline_libs.append(curses_library)
e684db95 1348 elif self.compiler.find_library_file(lib_dirs +
e3852288
JB
1349- ['/usr/lib/termcap'],
1350+ ['/usr/' + libname + '/termcap'],
1351 'termcap'):
e684db95
AM
1352 readline_libs.append('termcap')
1353 exts.append( Extension('readline', ['readline.c'],
1354- library_dirs=['/usr/lib/termcap'],
e3852288 1355+ library_dirs=['/usr/' + libname + '/termcap'],
e684db95
AM
1356 extra_link_args=readline_extra_link_args,
1357 libraries=readline_libs) )
e3852288 1358 else:
This page took 0.479997 seconds and 4 git commands to generate.