1 diff -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
18 +case $ac_sys_system in
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
26 + python_cv_cc_64bit_output=yes
34 +case $ARCH:$python_cv_cc_64bit_output in
35 +powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
45 AC_MSG_CHECKING(LIBRARY)
46 diff -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
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);
58 diff -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
63 +/* Interfaces to parse and execute pieces of python code */
65 +#ifndef Py_PYTHONRUN_H
66 +#define Py_PYTHONRUN_H
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
80 +#ifndef Py_LIMITED_API
82 + int cf_flags; /* bitmask of CO_xxx flags relevant to future */
86 +PyAPI_FUNC(void) Py_SetProgramName(wchar_t *);
87 +PyAPI_FUNC(wchar_t *) Py_GetProgramName(void);
89 +PyAPI_FUNC(void) Py_SetPythonHome(wchar_t *);
90 +PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void);
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 *);
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(
104 + const char *filename, /* decoded from the filesystem encoding */
106 + PyCompilerFlags *flags);
107 +PyAPI_FUNC(int) PyRun_SimpleFileExFlags(
109 + const char *filename, /* decoded from the filesystem encoding */
111 + PyCompilerFlags *flags);
112 +PyAPI_FUNC(int) PyRun_InteractiveOneFlags(
114 + const char *filename, /* decoded from the filesystem encoding */
115 + PyCompilerFlags *flags);
116 +PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(
118 + const char *filename, /* decoded from the filesystem encoding */
119 + PyCompilerFlags *flags);
121 +PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(
123 + const char *filename, /* decoded from the filesystem encoding */
125 + PyCompilerFlags *flags,
127 +PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(
129 + const char *filename, /* decoded from the filesystem encoding */
134 + PyCompilerFlags *flags,
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)
145 +PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int,
147 +PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
150 +#ifndef Py_LIMITED_API
151 +PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
152 + PyObject *, PyCompilerFlags *);
154 +PyAPI_FUNC(PyObject *) PyRun_FileExFlags(
156 + const char *filename, /* decoded from the filesystem encoding */
161 + PyCompilerFlags *flags);
164 +#ifdef Py_LIMITED_API
165 +PyAPI_FUNC(PyObject *) Py_CompileString(const char *, const char *, int);
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(
171 + const char *filename, /* decoded from the filesystem encoding */
173 + PyCompilerFlags *flags,
176 +PyAPI_FUNC(struct symtable *) Py_SymtableString(
178 + const char *filename, /* decoded from the filesystem encoding */
181 +PyAPI_FUNC(void) PyErr_Print(void);
182 +PyAPI_FUNC(void) PyErr_PrintEx(int);
183 +PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *);
185 +/* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level
188 +#ifndef Py_LIMITED_API
189 +PyAPI_FUNC(void) _Py_PyAtExit(void (*func)(void));
191 +PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
193 +PyAPI_FUNC(void) Py_Exit(int);
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);
199 +PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
203 +PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv);
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)
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 *);
233 +int _Py_CheckPython3();
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);
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);
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);
278 +/* Stuff with no proper home (yet) */
279 +#ifndef Py_LIMITED_API
280 +PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *);
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;
288 +/* Stack size, in "pointers" (so we get extra safety margins
289 + on 64-bit platforms). On a 32-bit platform, this translates
291 +#define PYOS_STACK_MARGIN 2048
293 +#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) && _MSC_VER >= 1300
294 +/* Enable stack checking under Microsoft C */
295 +#define USE_STACKCHECK
298 +#ifdef USE_STACKCHECK
299 +/* Check that we aren't overflowing our stack */
300 +PyAPI_FUNC(int) PyOS_CheckStack(void);
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);
312 +#endif /* !Py_PYTHONRUN_H */
313 diff -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
317 from site import USER_SITE
322 if sys.version < "2.2":
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',
331 'headers': '$base/include/python$py_version_short$abiflags/$dist_name',
332 'scripts': '$base/bin',
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',
342 diff -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
346 prefix = plat_specific and EXEC_PREFIX or PREFIX
348 if os.name == "posix":
353 libpython = os.path.join(prefix,
354 - "lib", "python" + get_python_version())
355 + lib, "python" + get_python_version())
359 diff -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
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
370 +Written by: Fred L. Drake, Jr.
371 +Email: <fdrake@acm.org>
374 +__revision__ = "$Id$"
380 +from .errors import DistutilsPlatformError
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)
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))
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,
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,
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)):
411 +python_build = _python_build()
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.
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.
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'
430 + return sys.version[:3]
433 +def get_python_inc(plat_specific=0, prefix=None):
434 + """Return the directory containing installed Python header files.
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).
441 + If 'prefix' is supplied, use it instead of sys.prefix or
442 + sys.exec_prefix -- i.e., ignore 'plat_specific'.
445 + prefix = plat_specific and EXEC_PREFIX or PREFIX
446 + if os.name == "posix":
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"
453 + base = os.path.dirname(os.path.abspath(sys.executable))
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")
466 + raise DistutilsPlatformError(
467 + "I don't know where Python installs its C header files "
468 + "on platform '%s'" % os.name)
471 +def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
472 + """Return the directory containing the Python library (standard or
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.
482 + If 'prefix' is supplied, use it instead of sys.prefix or
483 + sys.exec_prefix -- i.e., ignore 'plat_specific'.
486 + prefix = plat_specific and EXEC_PREFIX or PREFIX
488 + if os.name == "posix":
489 + libpython = os.path.join(prefix,
490 + "lib", "python" + get_python_version())
494 + return os.path.join(libpython, "site-packages")
495 + elif os.name == "nt":
497 + return os.path.join(prefix, "Lib")
499 + if get_python_version() < "2.2":
502 + return os.path.join(prefix, "Lib", "site-packages")
503 + elif os.name == "os2":
505 + return os.path.join(prefix, "Lib")
507 + return os.path.join(prefix, "Lib", "site-packages")
509 + raise DistutilsPlatformError(
510 + "I don't know where Python installs its library "
511 + "on platform '%s'" % os.name)
514 +def customize_compiler(compiler):
515 + """Do any platform-specific customization of a CCompiler instance.
517 + Mainly needed on Unix, so we can plug in the information that
518 + varies across Unices and is stored in Python's Makefile.
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')
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']
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']
549 + archiver = ar + ' ' + ar_flags
551 + cc_cmd = cc + ' ' + cflags
552 + compiler.set_executables(
555 + compiler_so=cc_cmd + ' ' + ccshared,
557 + linker_so=ldshared,
561 + compiler.shared_lib_extension = so_ext
564 +def get_config_h_filename():
565 + """Return full pathname of installed pyconfig.h file."""
567 + if os.name == "nt":
568 + inc_dir = os.path.join(project_base, "PC")
570 + inc_dir = project_base
572 + inc_dir = get_python_inc(plat_specific=1)
573 + if get_python_version() < '2.2':
574 + config_h = 'config.h'
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)
581 +def get_makefile_filename():
582 + """Return full pathname of installed Makefile from the 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')
590 +def parse_config_h(fp, g=None):
591 + """Parse a config.h-style file.
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.
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")
603 + line = fp.readline()
606 + m = define_rx.match(line)
608 + n, v = m.group(1, 2)
610 + except ValueError: pass
613 + m = undef_rx.match(line)
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_]*)}")
625 +def parse_makefile(fn, g=None):
626 + """Parse a Makefile-style file.
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.
632 + from distutils.text_file import TextFile
633 + fp = TextFile(fn, strip_comments=1, skip_blanks=1, join_lines=1, errors="surrogateescape")
641 + line = fp.readline()
642 + if line is None: # eof
644 + m = _variable_rx.match(line)
646 + n, v = m.group(1, 2)
648 + # `$$' is a literal `$' in make
649 + tmpv = v.replace('$$', '')
657 + # insert literal `$'
658 + done[n] = v.replace('$$', '$')
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')
668 + # do variable interpolation here
670 + for name in list(notdone):
671 + value = notdone[name]
672 + m = _findvar1_rx.search(value) or _findvar2_rx.search(value)
677 + item = str(done[n])
679 + # get it on a subsequent round
681 + elif n in os.environ:
682 + # do it like make: fall back to environment
683 + item = os.environ[n]
685 + elif n in renamed_variables:
686 + if name.startswith('PY_') and name[3:] in renamed_variables:
689 + elif 'PY_' + n in notdone:
693 + item = str(done['PY_' + n])
695 + done[n] = item = ""
697 + after = value[m.end():]
698 + value = value[:m.start()] + item + after
700 + notdone[name] = value
702 + try: value = int(value)
704 + done[name] = value.strip()
709 + if name.startswith('PY_') \
710 + and name[3:] in renamed_variables:
713 + if name not in done:
716 + # bogus variable reference; just drop it since we can't deal
721 + # strip spurious spaces
722 + for k, v in done.items():
723 + if isinstance(v, str):
724 + done[k] = v.strip()
726 + # save the results in the global dictionary
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'.
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.
747 + m = _findvar1_rx.search(s) or _findvar2_rx.search(s)
749 + (beg, end) = m.span()
750 + s = s[0:beg] + vars.get(m.group(1)) + s[end:]
759 + """Initialize the module as appropriate for POSIX systems."""
761 + # load the installed Makefile:
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
770 + raise DistutilsPlatformError(my_msg)
772 + # load the installed pyconfig.h:
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
782 + raise DistutilsPlatformError(my_msg)
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)
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.
803 + g['LDSHARED'] = g['BLDSHARED']
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
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')
814 + g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp)
816 + global _config_vars
821 + """Initialize the module as appropriate for NT"""
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)
827 + # XXX hmmm.. a normal install puts include files here
828 + g['INCLUDEPY'] = get_python_inc(plat_specific=0)
832 + g['VERSION'] = get_python_version().replace(".", "")
833 + g['BINDIR'] = os.path.dirname(os.path.abspath(sys.executable))
835 + global _config_vars
840 + """Initialize the module as appropriate for OS/2"""
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)
846 + # XXX hmmm.. a normal install puts include files here
847 + g['INCLUDEPY'] = get_python_inc(plat_specific=0)
852 + global _config_vars
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.
863 + With arguments, return a list of values that result from looking up
864 + each argument in the configuration variable dictionary.
866 + global _config_vars
867 + if _config_vars is None:
868 + func = globals().get("_init_" + os.name)
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
877 + _config_vars['prefix'] = PREFIX
878 + _config_vars['exec_prefix'] = EXEC_PREFIX
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)
894 + if sys.platform == 'darwin':
895 + kernel_version = os.uname()[2] # Kernel version (8.4.3)
896 + major_version = int(kernel_version.split('.')[0])
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
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
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'):
927 + flags = _config_vars[key]
928 + flags = re.sub('-arch\s+\w+\s', ' ', flags)
929 + flags = flags + ' ' + arch
930 + _config_vars[key] = flags
935 + vals.append(_config_vars.get(name))
938 + return _config_vars
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)
945 + return get_config_vars().get(name)
946 diff -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
950 self.assertEqual(got, expected)
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"))
960 diff -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
964 +"""Tests for distutils.command.install."""
972 +from test.support import captured_stdout, run_unittest
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
980 +from distutils.tests import support
982 +class InstallTestCase(support.TempdirManager,
983 + support.EnvironGuard,
984 + support.LoggingSilencer,
985 + unittest.TestCase):
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")
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"),
1002 + cmd = install(dist)
1003 + cmd.home = destination
1004 + cmd.ensure_finalized()
1006 + self.assertEqual(cmd.install_base, destination)
1007 + self.assertEqual(cmd.install_platbase, destination)
1009 + def check_path(got, expected):
1010 + got = os.path.normpath(got)
1011 + expected = os.path.normpath(expected)
1012 + self.assertEqual(got, expected)
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)
1023 + def test_user_site(self):
1024 + # site.USER_SITE was introduced in 2.6
1025 + if sys.version < '2.6':
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
1039 + def _expanduser(path):
1040 + return self.tmpdir
1041 + self.old_expand = os.path.expanduser
1042 + os.path.expanduser = _expanduser
1045 + # this is the actual test
1046 + self._test_user_site()
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
1054 + def _test_user_site(self):
1055 + for key in ('nt_user', 'unix_user', 'os2_home'):
1056 + self.assertTrue(key in INSTALL_SCHEMES)
1058 + dist = Distribution({'name': 'xx'})
1059 + cmd = install(dist)
1061 + # making sure the user option is there
1062 + options = [name for name, short, lable in
1064 + self.assertTrue('user' in options)
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))
1073 + # let's run finalize
1074 + cmd.ensure_finalized()
1077 + self.assertTrue(os.path.exists(self.user_base))
1078 + self.assertTrue(os.path.exists(self.user_site))
1080 + self.assertTrue('userbase' in cmd.config_vars)
1081 + self.assertTrue('usersite' in cmd.config_vars)
1083 + def test_handle_extra_path(self):
1084 + dist = Distribution({'name': 'xx', 'extra_path': 'path,dirs'})
1085 + cmd = install(dist)
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')
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')
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)
1107 + # three elements (no way !)
1108 + cmd.extra_path = 'path,dirs,again'
1109 + self.assertRaises(DistutilsOptionError, cmd.handle_extra_path)
1111 + def test_finalize_options(self):
1112 + dist = Distribution({'name': 'xx'})
1113 + cmd = install(dist)
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)
1121 + # must supply either home or prefix/exec-prefix -- not both
1122 + cmd.install_base = None
1124 + self.assertRaises(DistutilsOptionError, cmd.finalize_options)
1126 + # can't combine user with with prefix/exec_prefix/home or
1127 + # install_(plat)base
1130 + self.assertRaises(DistutilsOptionError, cmd.finalize_options)
1132 + def test_record(self):
1134 + install_dir = self.mkdtemp()
1135 + pkgdir, dist = self.create_dist()
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()
1146 + # let's check the RECORD file was created with one
1147 + # line (the egg info file)
1148 + f = open(cmd.record)
1150 + self.assertEqual(len(f.readlines()), 1)
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
1159 + with captured_stdout() as stdout:
1160 + self.test_record()
1162 + install_module.DEBUG = False
1163 + self.assertTrue(len(self.logs) > old_logs_len)
1166 + return unittest.makeSuite(InstallTestCase)
1168 +if __name__ == "__main__":
1169 + run_unittest(test_suite())
1170 diff -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
1173 @@ -285,13 +285,16 @@
1174 if sys.platform in ('os2emx', 'riscos'):
1175 sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
1177 - sitepackages.append(os.path.join(prefix, "lib",
1178 + sitepackages.append(os.path.join(prefix, sys.lib,
1179 "python" + sys.version[:3],
1181 - sitepackages.append(os.path.join(prefix, "lib", "site-python"))
1182 + sitepackages.append(os.path.join(prefix, sys.lib, "site-python"))
1183 + if sys.lib != 'lib':
1184 + sitepackages.append(os.path.join(prefix, "lib", "python" + sys.version[:3], "site-packages"))
1185 + sitepackages.append(os.path.join(prefix, "lib", "site-python"))
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"))
1190 if sys.platform == "darwin":
1191 # for framework builds *only* we add the standard Apple
1193 diff -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
1198 _INSTALL_SCHEMES = {
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',
1208 '{base}/include/python{py_version_short}{abiflags}',
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',
1224 diff -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
1229 # Machine-dependent subdirectories
1234 # Install prefix for architecture-independent files
1238 INCLUDEDIR= @includedir@
1239 CONFINCLUDEDIR= $(exec_prefix)/include
1240 -SCRIPTDIR= $(prefix)/lib
1241 +SCRIPTDIR= $(prefix)/$(LIB)
1242 ABIFLAGS= @ABIFLAGS@
1244 # Detailed destination directories
1246 Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
1248 Python/getplatform.o: $(srcdir)/Python/getplatform.c
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
1252 Python/importdl.o: $(srcdir)/Python/importdl.c
1253 $(CC) -c $(PY_CORE_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
1254 diff -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
1257 @@ -121,9 +121,17 @@
1258 #define EXEC_PREFIX PREFIX
1262 +#if defined(__x86_64__) || (defined(__sparc__) && defined(__arch64__)) || defined(__powerpc64__) || defined(__s390x__)
1263 +#define LIB_PYTHON L"lib64/python"
1265 +#define LIB_PYTHON L"lib/python"
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:"
1278 static wchar_t exec_prefix[MAXPATHLEN+1];
1279 static wchar_t progpath[MAXPATHLEN+1];
1280 static wchar_t *module_search_path = NULL;
1281 -static wchar_t *lib_python = L"lib/python" VERSION;
1282 +static wchar_t *lib_python = LIB_PYTHON VERSION;
1285 reduce(wchar_t *dir)
1286 diff -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
1295 +#define ARCH "unknown"
1313 diff -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
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));
1327 diff -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
1330 @@ -422,12 +422,12 @@
1331 add_dir_to_list(self.compiler.include_dirs,
1332 sysconfig.get_config_var("INCLUDEDIR"))
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
1343 inc_dirs = self.compiler.include_dirs + ['/usr/include']
1345 @@ -620,11 +620,11 @@
1346 elif curses_library:
1347 readline_libs.append(curses_library)
1348 elif self.compiler.find_library_file(lib_dirs +
1349 - ['/usr/lib/termcap'],
1350 + ['/usr/' + libname + '/termcap'],
1352 readline_libs.append('termcap')
1353 exts.append( Extension('readline', ['readline.c'],
1354 - library_dirs=['/usr/lib/termcap'],
1355 + library_dirs=['/usr/' + libname + '/termcap'],
1356 extra_link_args=readline_extra_link_args,
1357 libraries=readline_libs) )