AppPkg/Applications/Python: Fix a mis-located module and establish the minimum set of built-in modules needed for Python to start and run.

Signed-off-by: darylm503
Reviewed-by: leegrosenbaum


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12958 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
darylm503 2012-01-27 01:06:16 +00:00
parent b410d6e4ce
commit ae78a89c94
2 changed files with 57 additions and 97 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
Python Module configuration. Python Module configuration.
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> Copyright (c) 2011-2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution. the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at The full text of the license may be found at
@ -17,17 +17,11 @@
#include "Python.h" #include "Python.h"
extern void initarray(void); extern void initarray(void);
#ifndef MS_WINI64
extern void initaudioop(void);
#endif
extern void initbinascii(void); extern void initbinascii(void);
extern void initcmath(void); extern void initcmath(void);
extern void initerrno(void); extern void initerrno(void);
extern void initfuture_builtins(void); extern void initfuture_builtins(void);
extern void initgc(void); extern void initgc(void);
#ifndef MS_WINI64
extern void initimageop(void);
#endif
extern void initmath(void); extern void initmath(void);
extern void init_md5(void); extern void init_md5(void);
extern void initedk2(void); extern void initedk2(void);
@ -41,10 +35,6 @@ extern void inittime(void);
extern void initthread(void); extern void initthread(void);
extern void initcStringIO(void); extern void initcStringIO(void);
extern void initcPickle(void); extern void initcPickle(void);
#ifdef WIN32
extern void initmsvcrt(void);
extern void init_locale(void);
#endif
extern void init_codecs(void); extern void init_codecs(void);
extern void init_weakref(void); extern void init_weakref(void);
extern void init_hotshot(void); extern void init_hotshot(void);
@ -83,95 +73,72 @@ extern void _PyWarnings_Init(void);
extern void init_socket(void); extern void init_socket(void);
extern void initselect(void); extern void initselect(void);
/* tools/freeze/makeconfig.py marker for additional "extern" */
/* -- ADDMODULE MARKER 1 -- */
extern void PyMarshal_Init(void); extern void PyMarshal_Init(void);
extern void initimp(void); extern void initimp(void);
struct _inittab _PyImport_Inittab[] = { struct _inittab _PyImport_Inittab[] = {
{"array", initarray}, //{"_ast", init_ast},
{"_ast", init_ast}, //{"_bisect", init_bisect},
{"binascii", initbinascii}, //{"_codecs", init_codecs},
{"errno", initerrno}, //{"_collections", init_collections},
{"future_builtins", initfuture_builtins}, //{"_functools", init_functools},
{"gc", initgc}, //{"_heapq", init_heapq},
{"signal", initsignal}, //{"_io", init_io},
{"edk2", initedk2}, //{"_json", init_json},
{"operator", initoperator}, //{"_md5", init_md5},
{"_weakref", init_weakref}, //{"_random", init_random},
{"math", initmath}, //{"_sha", init_sha},
{"time", inittime}, //{"_sha256", init_sha256},
{"datetime", initdatetime}, //{"_sha512", init_sha512},
{"cStringIO", initcStringIO}, //{"_socket", init_socket},
{"_codecs", init_codecs}, //{"_sre", init_sre},
//{"_struct", init_struct},
//{"_weakref", init_weakref},
//{"array", initarray},
//{"binascii", initbinascii},
//{"cmath", initcmath},
//{"cPickle", initcPickle},
//{"cStringIO", initcStringIO},
//{"datetime", initdatetime},
//{"future_builtins", initfuture_builtins},
//{"gc", initgc},
//{"itertools", inititertools},
//{"math", initmath},
//{"operator", initoperator},
//{"parser", initparser},
//{"select", initselect},
//{"signal", initsignal},
//{"strop", initstrop},
//{"time", inittime},
//{"xxsubtype", initxxsubtype},
//{"zipimport", initzipimport},
//{"zlib", initzlib},
/* CJK codecs */ /* CJK codecs */
{"_multibytecodec", init_multibytecodec}, //{"_multibytecodec", init_multibytecodec},
{"_codecs_cn", init_codecs_cn}, //{"_codecs_cn", init_codecs_cn},
{"_codecs_hk", init_codecs_hk}, //{"_codecs_hk", init_codecs_hk},
{"_codecs_iso2022", init_codecs_iso2022}, //{"_codecs_iso2022", init_codecs_iso2022},
{"_codecs_jp", init_codecs_jp}, //{"_codecs_jp", init_codecs_jp},
{"_codecs_kr", init_codecs_kr}, //{"_codecs_kr", init_codecs_kr},
{"_codecs_tw", init_codecs_tw}, //{"_codecs_tw", init_codecs_tw},
{"_bisect", init_bisect},
{"_md5", init_md5},
{"_sha", init_sha},
{"_sha256", init_sha256},
{"_sha512", init_sha512},
{"_random", init_random},
{"_heapq", init_heapq},
{"itertools", inititertools},
{"_collections", init_collections},
{"_sre", init_sre},
{"parser", initparser},
{"_struct", init_struct},
{"cPickle", initcPickle},
{"strop", initstrop},
{"_functools", init_functools},
{"cmath", initcmath},
{"_json", init_json},
{"_socket", init_socket},
{"select", initselect},
{"xxsubtype", initxxsubtype},
#if 0
#ifndef MS_WINI64
{"imageop", initimageop},
#endif
#ifdef WITH_THREAD #ifdef WITH_THREAD
{"thread", initthread}, {"thread", initthread},
#endif #endif
#ifdef WIN32
{"msvcrt", initmsvcrt},
{"_locale", init_locale},
#endif
/* XXX Should _subprocess go in a WIN32 block? not WIN64? */
//{"_subprocess", init_subprocess},
//{"_hotshot", init_hotshot}, #if 0
//{"_lsprof", init_lsprof},
//{"mmap", initmmap},
//{"_winreg", init_winreg},
{"_symtable", init_symtable}, {"_symtable", init_symtable},
{"_csv", init_csv}, {"_csv", init_csv},
{"zipimport", initzipimport},
{"zlib", initzlib},
#endif #endif
/* tools/freeze/makeconfig.py marker for additional "_inittab" entries */ /* These four modules should always be built in. */
/* -- ADDMODULE MARKER 2 -- */ {"edk2", initedk2},
{"errno", initerrno},
/* This module "lives in" with marshal.c */ {"imp", initimp}, /* We get this for free from Python/import.c */
{"marshal", PyMarshal_Init}, {"marshal", PyMarshal_Init}, /* We get this for free from Python/marshal.c */
/* This lives in with import.c */
{"imp", initimp},
/* These entries are here for sys.builtin_module_names */ /* These entries are here for sys.builtin_module_names */
{"__main__", NULL}, {"__main__", NULL},
@ -180,8 +147,6 @@ struct _inittab _PyImport_Inittab[] = {
{"exceptions", NULL}, {"exceptions", NULL},
{"_warnings", _PyWarnings_Init}, {"_warnings", _PyWarnings_Init},
{"_io", init_io},
/* Sentinel */ /* Sentinel */
{0, 0} {0, 0}
}; };

View File

@ -1,7 +1,7 @@
## @file ## @file
# PythonCore.inf # PythonCore.inf
# #
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2011-2012, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -64,7 +64,6 @@
#Python #Python
PyMod-2.7.2/Python/getcopyright.c PyMod-2.7.2/Python/getcopyright.c
PyMod-2.7.2/Python/import.c
PyMod-2.7.2/Python/marshal.c PyMod-2.7.2/Python/marshal.c
Python-2.7.2/Python/_warnings.c Python-2.7.2/Python/_warnings.c
@ -87,6 +86,7 @@
Python-2.7.2/Python/getplatform.c Python-2.7.2/Python/getplatform.c
Python-2.7.2/Python/getversion.c Python-2.7.2/Python/getversion.c
Python-2.7.2/Python/graminit.c Python-2.7.2/Python/graminit.c
Python-2.7.2/Python/import.c
Python-2.7.2/Python/importdl.c Python-2.7.2/Python/importdl.c
Python-2.7.2/Python/modsupport.c Python-2.7.2/Python/modsupport.c
Python-2.7.2/Python/mysnprintf.c Python-2.7.2/Python/mysnprintf.c
@ -108,14 +108,14 @@
# Python-$(PYTHON_VERSION)/Python/thread.c # Python-$(PYTHON_VERSION)/Python/thread.c
#Modules -- See Efi/config.c #Modules -- See Efi/config.c
Python-2.7.2/Modules/main.c
Python-2.7.2/Modules/python.c
Python-2.7.2/Modules/getbuildinfo.c
PyMod-2.7.2/Modules/_sre.c PyMod-2.7.2/Modules/_sre.c
PyMod-2.7.2/Modules/errnomodule.c PyMod-2.7.2/Modules/errnomodule.c
PyMod-2.7.2/Modules/selectmodule.c PyMod-2.7.2/Modules/selectmodule.c
Python-2.7.2/Modules/getbuildinfo.c
Python-2.7.2/Modules/main.c
Python-2.7.2/Modules/python.c
Python-2.7.2/Modules/_bisectmodule.c Python-2.7.2/Modules/_bisectmodule.c
Python-2.7.2/Modules/_codecsmodule.c Python-2.7.2/Modules/_codecsmodule.c
Python-2.7.2/Modules/_collectionsmodule.c Python-2.7.2/Modules/_collectionsmodule.c
@ -149,14 +149,9 @@
Python-2.7.2/Modules/timemodule.c Python-2.7.2/Modules/timemodule.c
Python-2.7.2/Modules/xxsubtype.c Python-2.7.2/Modules/xxsubtype.c
# Python-$(PYTHON_VERSION)/Modules/imageop.c
# Python-$(PYTHON_VERSION)/Modules/_csv.c # Python-$(PYTHON_VERSION)/Modules/_csv.c
# Python-$(PYTHON_VERSION)/Modules/symtablemodule.c # Python-$(PYTHON_VERSION)/Modules/symtablemodule.c
# Python-$(PYTHON_VERSION)/Modules/_hotshot.c
# Python-$(PYTHON_VERSION)/Modules/_localemodule.c # Python-$(PYTHON_VERSION)/Modules/_localemodule.c
# Python-$(PYTHON_VERSION)/Modules/_lsprof.c
# Python-$(PYTHON_VERSION)/Modules/audioop.c
# Python-$(PYTHON_VERSION)/Modules/mmapmodule.c
# Python-$(PYTHON_VERSION)/Modules/rotatingtree.c # Python-$(PYTHON_VERSION)/Modules/rotatingtree.c
# Python-$(PYTHON_VERSION)/Modules/threadmodule.c # Python-$(PYTHON_VERSION)/Modules/threadmodule.c
# Python-$(PYTHON_VERSION)/Modules/zipimport.c # Python-$(PYTHON_VERSION)/Modules/zipimport.c