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
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
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
@ -17,17 +17,11 @@
#include "Python.h"
extern void initarray(void);
#ifndef MS_WINI64
extern void initaudioop(void);
#endif
extern void initbinascii(void);
extern void initcmath(void);
extern void initerrno(void);
extern void initfuture_builtins(void);
extern void initgc(void);
#ifndef MS_WINI64
extern void initimageop(void);
#endif
extern void initmath(void);
extern void init_md5(void);
extern void initedk2(void);
@ -41,10 +35,6 @@ extern void inittime(void);
extern void initthread(void);
extern void initcStringIO(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_weakref(void);
extern void init_hotshot(void);
@ -83,95 +73,72 @@ extern void _PyWarnings_Init(void);
extern void init_socket(void);
extern void initselect(void);
/* tools/freeze/makeconfig.py marker for additional "extern" */
/* -- ADDMODULE MARKER 1 -- */
extern void PyMarshal_Init(void);
extern void initimp(void);
struct _inittab _PyImport_Inittab[] = {
{"array", initarray},
{"_ast", init_ast},
{"binascii", initbinascii},
{"errno", initerrno},
{"future_builtins", initfuture_builtins},
{"gc", initgc},
{"signal", initsignal},
{"edk2", initedk2},
{"operator", initoperator},
{"_weakref", init_weakref},
{"math", initmath},
{"time", inittime},
{"datetime", initdatetime},
{"cStringIO", initcStringIO},
{"_codecs", init_codecs},
//{"_ast", init_ast},
//{"_bisect", init_bisect},
//{"_codecs", init_codecs},
//{"_collections", init_collections},
//{"_functools", init_functools},
//{"_heapq", init_heapq},
//{"_io", init_io},
//{"_json", init_json},
//{"_md5", init_md5},
//{"_random", init_random},
//{"_sha", init_sha},
//{"_sha256", init_sha256},
//{"_sha512", init_sha512},
//{"_socket", init_socket},
//{"_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 */
{"_multibytecodec", init_multibytecodec},
{"_codecs_cn", init_codecs_cn},
{"_codecs_hk", init_codecs_hk},
{"_codecs_iso2022", init_codecs_iso2022},
{"_codecs_jp", init_codecs_jp},
{"_codecs_kr", init_codecs_kr},
{"_codecs_tw", init_codecs_tw},
//{"_multibytecodec", init_multibytecodec},
//{"_codecs_cn", init_codecs_cn},
//{"_codecs_hk", init_codecs_hk},
//{"_codecs_iso2022", init_codecs_iso2022},
//{"_codecs_jp", init_codecs_jp},
//{"_codecs_kr", init_codecs_kr},
//{"_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
{"thread", initthread},
#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},
//{"_lsprof", init_lsprof},
//{"mmap", initmmap},
//{"_winreg", init_winreg},
#if 0
{"_symtable", init_symtable},
{"_csv", init_csv},
{"zipimport", initzipimport},
{"zlib", initzlib},
#endif
/* tools/freeze/makeconfig.py marker for additional "_inittab" entries */
/* -- ADDMODULE MARKER 2 -- */
/* This module "lives in" with marshal.c */
{"marshal", PyMarshal_Init},
/* This lives in with import.c */
{"imp", initimp},
/* These four modules should always be built in. */
{"edk2", initedk2},
{"errno", initerrno},
{"imp", initimp}, /* We get this for free from Python/import.c */
{"marshal", PyMarshal_Init}, /* We get this for free from Python/marshal.c */
/* These entries are here for sys.builtin_module_names */
{"__main__", NULL},
@ -180,8 +147,6 @@ struct _inittab _PyImport_Inittab[] = {
{"exceptions", NULL},
{"_warnings", _PyWarnings_Init},
{"_io", init_io},
/* Sentinel */
{0, 0}
};

View File

@ -1,7 +1,7 @@
## @file
# 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
# 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
@ -64,7 +64,6 @@
#Python
PyMod-2.7.2/Python/getcopyright.c
PyMod-2.7.2/Python/import.c
PyMod-2.7.2/Python/marshal.c
Python-2.7.2/Python/_warnings.c
@ -87,6 +86,7 @@
Python-2.7.2/Python/getplatform.c
Python-2.7.2/Python/getversion.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/modsupport.c
Python-2.7.2/Python/mysnprintf.c
@ -108,14 +108,14 @@
# Python-$(PYTHON_VERSION)/Python/thread.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/errnomodule.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/_codecsmodule.c
Python-2.7.2/Modules/_collectionsmodule.c
@ -149,14 +149,9 @@
Python-2.7.2/Modules/timemodule.c
Python-2.7.2/Modules/xxsubtype.c
# Python-$(PYTHON_VERSION)/Modules/imageop.c
# Python-$(PYTHON_VERSION)/Modules/_csv.c
# Python-$(PYTHON_VERSION)/Modules/symtablemodule.c
# Python-$(PYTHON_VERSION)/Modules/_hotshot.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/threadmodule.c
# Python-$(PYTHON_VERSION)/Modules/zipimport.c