AppPkg/Applications/Python: Add support for the pyexpat module.

Add required flags to [BuildOptions] in PythonCore.inf.
Add initialization routine to Efi/config.c.
Alter #include targets if building for UEFI in expat_external.h and xmlparse.c.
Add expat modifications to PyMod-2.7.2/Modules/expat.

Contributed-under: TianoCore Contribution Agreement 1.0
Submitted-by:   Duane Voth <duanev@gmail.com>
Signed-off-by:  daryl.mcdaniel@intel.com
Reviewed-by:    duanev@gmail.com
Reviewed-by:    daryl.mcdaniel@intel.com


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14071 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
darylm503 2013-01-18 20:36:27 +00:00
parent 23b0693579
commit ffc6107d40
6 changed files with 6480 additions and 60 deletions
AppPkg/Applications/Python
Efi
PyMod-2.7.2/Modules/expat
Python-2.7.2/Modules/expat
PythonCore.inf

@ -17,46 +17,59 @@
#include "Python.h"
extern void initarray(void);
extern void init_ast(void);
extern void initbinascii(void);
extern void init_bisect(void);
extern void initcmath(void);
extern void init_codecs(void);
extern void init_collections(void);
extern void initcPickle(void);
extern void initcStringIO(void);
extern void init_csv(void);
extern void init_ctypes(void);
extern void initdatetime(void);
extern void initedk2(void);
extern void initerrno(void);
extern void init_functools(void);
extern void initfuture_builtins(void);
extern void initgc(void);
extern void init_heapq(void);
extern void init_hotshot(void);
extern void initimp(void);
extern void init_io(void);
extern void inititertools(void);
extern void init_json(void);
extern void init_lsprof(void);
extern void initmath(void);
extern void init_md5(void);
extern void initedk2(void);
extern void initmmap(void);
extern void initoperator(void);
extern void initsignal(void);
extern void initparser(void);
extern void initpyexpat(void);
extern void init_random(void);
extern void initselect(void);
extern void init_sha(void);
extern void init_sha256(void);
extern void init_sha512(void);
extern void initsignal(void);
extern void init_socket(void);
extern void init_sre(void);
extern void initstrop(void);
extern void inittime(void);
extern void init_struct(void);
extern void init_subprocess(void);
extern void init_symtable(void);
extern void initthread(void);
extern void initcStringIO(void);
extern void initcPickle(void);
extern void init_codecs(void);
extern void inittime(void);
extern void initunicodedata(void);
extern void init_weakref(void);
extern void init_hotshot(void);
extern void init_winreg(void);
extern void initxxsubtype(void);
extern void initzipimport(void);
extern void init_random(void);
extern void inititertools(void);
extern void init_collections(void);
extern void init_heapq(void);
extern void init_bisect(void);
extern void init_symtable(void);
extern void initmmap(void);
extern void init_csv(void);
extern void init_sre(void);
extern void initparser(void);
extern void init_winreg(void);
extern void init_struct(void);
extern void initdatetime(void);
extern void init_functools(void);
extern void init_json(void);
extern void initzlib(void);
extern void PyMarshal_Init(void);
extern void _PyWarnings_Init(void);
extern void init_multibytecodec(void);
extern void init_codecs_cn(void);
extern void init_codecs_hk(void);
@ -64,26 +77,13 @@ extern void init_codecs_iso2022(void);
extern void init_codecs_jp(void);
extern void init_codecs_kr(void);
extern void init_codecs_tw(void);
extern void init_subprocess(void);
extern void init_lsprof(void);
extern void init_ast(void);
extern void init_io(void);
extern void _PyWarnings_Init(void);
extern void init_socket(void);
extern void initselect(void);
extern void PyMarshal_Init(void);
extern void initimp(void);
extern void initunicodedata(void);
extern void init_ctypes(void);
struct _inittab _PyImport_Inittab[] = {
//{"_ast", init_ast},
//{"_bisect", init_bisect}, /* A fast version of bisect.py */
//{"_bisect", init_bisect}, /* A fast version of bisect.py */
//{"_csv", init_csv},
//{"_heapq", init_heapq}, /* A fast version of heapq.py */
//{"_heapq", init_heapq}, /* A fast version of heapq.py */
//{"_io", init_io},
//{"_json", init_json},
//{"_md5", init_md5},
@ -99,9 +99,10 @@ struct _inittab _PyImport_Inittab[] = {
//{"datetime", initdatetime},
//{"future_builtins", initfuture_builtins},
//{"parser", initparser},
//{"pyexpat", initpyexpat},
//{"select", initselect},
//{"signal", initsignal},
//{"strop", initstrop}, /* redefines some string operations that are 100-1000 times faster */
//{"strop", initstrop}, /* redefines some string operations that are 100-1000 times faster */
//{"unicodedata", initunicodedata},
//{"xxsubtype", initxxsubtype},
//{"zipimport", initzipimport},

@ -0,0 +1,121 @@
/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
See the file COPYING for copying permission.
*/
#ifndef Expat_External_INCLUDED
#define Expat_External_INCLUDED 1
/* External API definitions */
/* Namespace external symbols to allow multiple libexpat version to
co-exist. */
#if !defined(UEFI_C_SOURCE)
#include "pyexpatns.h"
#endif
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
#define XML_USE_MSC_EXTENSIONS 1
#endif
/* Expat tries very hard to make the API boundary very specifically
defined. There are two macros defined to control this boundary;
each of these can be defined before including this header to
achieve some different behavior, but doing so it not recommended or
tested frequently.
XMLCALL - The calling convention to use for all calls across the
"library boundary." This will default to cdecl, and
try really hard to tell the compiler that's what we
want.
XMLIMPORT - Whatever magic is needed to note that a function is
to be imported from a dynamically loaded library
(.dll, .so, or .sl, depending on your platform).
The XMLCALL macro was added in Expat 1.95.7. The only one which is
expected to be directly useful in client code is XMLCALL.
Note that on at least some Unix versions, the Expat library must be
compiled with the cdecl calling convention as the default since
system headers may assume the cdecl convention.
*/
#ifndef XMLCALL
#if defined(XML_USE_MSC_EXTENSIONS)
#define XMLCALL __cdecl
#elif defined(__GNUC__) && defined(__i386)
#define XMLCALL __attribute__((cdecl))
#else
/* For any platform which uses this definition and supports more than
one calling convention, we need to extend this definition to
declare the convention used on that platform, if it's possible to
do so.
If this is the case for your platform, please file a bug report
with information on how to identify your platform via the C
pre-processor and how to specify the same calling convention as the
platform's malloc() implementation.
*/
#define XMLCALL
#endif
#endif /* not defined XMLCALL */
#if !defined(XML_STATIC) && !defined(XMLIMPORT)
#ifndef XML_BUILDING_EXPAT
/* using Expat from an application */
#ifdef XML_USE_MSC_EXTENSIONS
#define XMLIMPORT __declspec(dllimport)
#endif
#endif
#endif /* not defined XML_STATIC */
/* If we didn't define it above, define it away: */
#ifndef XMLIMPORT
#define XMLIMPORT
#endif
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
#ifdef __cplusplus
extern "C" {
#endif
#ifdef XML_UNICODE_WCHAR_T
#define XML_UNICODE
#endif
#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
#ifdef XML_UNICODE_WCHAR_T
typedef wchar_t XML_Char;
typedef wchar_t XML_LChar;
#else
typedef unsigned short XML_Char;
typedef char XML_LChar;
#endif /* XML_UNICODE_WCHAR_T */
#else /* Information is UTF-8 encoded. */
typedef char XML_Char;
typedef char XML_LChar;
#endif /* XML_UNICODE */
#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
typedef __int64 XML_Index;
typedef unsigned __int64 XML_Size;
#else
typedef long long XML_Index;
typedef unsigned long long XML_Size;
#endif
#else
typedef long XML_Index;
typedef unsigned long XML_Size;
#endif /* XML_LARGE_SIZE */
#ifdef __cplusplus
}
#endif
#endif /* not Expat_External_INCLUDED */

File diff suppressed because it is too large Load Diff

@ -9,7 +9,9 @@
/* Namespace external symbols to allow multiple libexpat version to
co-exist. */
#include "pyexpatns.h"
#if !defined(UEFI_C_SOURCE)
#include "pyexpatns.h"
#endif
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
#define XML_USE_MSC_EXTENSIONS 1
@ -101,7 +103,7 @@ typedef char XML_LChar;
#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
typedef __int64 XML_Index;
typedef __int64 XML_Index;
typedef unsigned __int64 XML_Size;
#else
typedef long long XML_Index;

@ -18,7 +18,11 @@
#include <string.h> /* memset(), memcpy() */
#include <assert.h>
#if defined(UEFI_C_SOURCE)
#include <expat/expat.h>
#else
#include "expat.h"
#endif
#ifdef XML_UNICODE
#define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX
@ -1493,6 +1497,10 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
ps_parsing = XML_FINISHED;
return result;
}
break;
default:
/* XML_FINISHED case required by compiler - but not tested - djv */
return XML_STATUS_OK;
}
}

@ -41,9 +41,12 @@
LibWchar
LibGen
LibNetUtil
BsdSocketLib
EfiSocketLib
DevShell
#
# Comment out the following two library classes if socket support is
# NOT being built in to Python.
#BsdSocketLib
#EfiSocketLib
[FixedPcd]
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0F
@ -72,8 +75,10 @@
#Python
PyMod-$(PYTHON_VERSION)/Python/getcopyright.c
PyMod-$(PYTHON_VERSION)/Python/marshal.c
PyMod-$(PYTHON_VERSION)/Python/import.c
Python-$(PYTHON_VERSION)/Python/_warnings.c
Python-$(PYTHON_VERSION)/Python/Python-ast.c
Python-$(PYTHON_VERSION)/Python/asdl.c
Python-$(PYTHON_VERSION)/Python/ast.c
Python-$(PYTHON_VERSION)/Python/bltinmodule.c
@ -93,7 +98,6 @@
Python-$(PYTHON_VERSION)/Python/getplatform.c
Python-$(PYTHON_VERSION)/Python/getversion.c
Python-$(PYTHON_VERSION)/Python/graminit.c
Python-$(PYTHON_VERSION)/Python/import.c
Python-$(PYTHON_VERSION)/Python/importdl.c
Python-$(PYTHON_VERSION)/Python/modsupport.c
Python-$(PYTHON_VERSION)/Python/mysnprintf.c
@ -106,7 +110,6 @@
Python-$(PYTHON_VERSION)/Python/pystate.c
Python-$(PYTHON_VERSION)/Python/pystrcmp.c
Python-$(PYTHON_VERSION)/Python/pystrtod.c
Python-$(PYTHON_VERSION)/Python/Python-ast.c
Python-$(PYTHON_VERSION)/Python/pythonrun.c
Python-$(PYTHON_VERSION)/Python/structmember.c
Python-$(PYTHON_VERSION)/Python/symtable.c
@ -114,6 +117,8 @@
Python-$(PYTHON_VERSION)/Python/traceback.c
#Objects
PyMod-$(PYTHON_VERSION)/Objects/longobject.c
Python-$(PYTHON_VERSION)/Objects/abstract.c
Python-$(PYTHON_VERSION)/Objects/boolobject.c
Python-$(PYTHON_VERSION)/Objects/bufferobject.c
@ -137,7 +142,6 @@
Python-$(PYTHON_VERSION)/Objects/intobject.c
Python-$(PYTHON_VERSION)/Objects/iterobject.c
Python-$(PYTHON_VERSION)/Objects/listobject.c
Python-$(PYTHON_VERSION)/Objects/longobject.c
Python-$(PYTHON_VERSION)/Objects/memoryobject.c
Python-$(PYTHON_VERSION)/Objects/methodobject.c
Python-$(PYTHON_VERSION)/Objects/moduleobject.c
@ -170,6 +174,7 @@
Python-$(PYTHON_VERSION)/Modules/_bisectmodule.c #
Python-$(PYTHON_VERSION)/Modules/_codecsmodule.c #
Python-$(PYTHON_VERSION)/Modules/_collectionsmodule.c #
Python-$(PYTHON_VERSION)/Modules/_csv.c #
Python-$(PYTHON_VERSION)/Modules/_heapqmodule.c #
Python-$(PYTHON_VERSION)/Modules/_json.c #
Python-$(PYTHON_VERSION)/Modules/_localemodule.c #
@ -190,20 +195,27 @@
Python-$(PYTHON_VERSION)/Modules/md5module.c #
Python-$(PYTHON_VERSION)/Modules/operator.c #
Python-$(PYTHON_VERSION)/Modules/parsermodule.c #
Python-$(PYTHON_VERSION)/Modules/shamodule.c #
Python-$(PYTHON_VERSION)/Modules/sha256module.c #
Python-$(PYTHON_VERSION)/Modules/sha512module.c #
Python-$(PYTHON_VERSION)/Modules/shamodule.c #
Python-$(PYTHON_VERSION)/Modules/signalmodule.c #
Python-$(PYTHON_VERSION)/Modules/socketmodule.c #
Python-$(PYTHON_VERSION)/Modules/stropmodule.c #
Python-$(PYTHON_VERSION)/Modules/symtablemodule.c #
Python-$(PYTHON_VERSION)/Modules/timemodule.c #
Python-$(PYTHON_VERSION)/Modules/unicodedata.c #
Python-$(PYTHON_VERSION)/Modules/xxsubtype.c #
Python-$(PYTHON_VERSION)/Modules/zipimport.c #
Python-$(PYTHON_VERSION)/Modules/zlibmodule.c #
Python-$(PYTHON_VERSION)/Modules/_csv.c #
Python-$(PYTHON_VERSION)/Modules/symtablemodule.c #
#Modules/_io
Python-$(PYTHON_VERSION)/Modules/_io/_iomodule.c #
Python-$(PYTHON_VERSION)/Modules/_io/bufferedio.c #
Python-$(PYTHON_VERSION)/Modules/_io/bytesio.c #
Python-$(PYTHON_VERSION)/Modules/_io/fileio.c #
Python-$(PYTHON_VERSION)/Modules/_io/iobase.c #
Python-$(PYTHON_VERSION)/Modules/_io/stringio.c #
Python-$(PYTHON_VERSION)/Modules/_io/textio.c #
#Modules/cjkcodecs
Python-$(PYTHON_VERSION)/Modules/cjkcodecs/multibytecodec.c #
@ -214,14 +226,11 @@
Python-$(PYTHON_VERSION)/Modules/cjkcodecs/_codecs_kr.c #
Python-$(PYTHON_VERSION)/Modules/cjkcodecs/_codecs_tw.c #
#Modules/_io
Python-$(PYTHON_VERSION)/Modules/_io/_iomodule.c #
Python-$(PYTHON_VERSION)/Modules/_io/bufferedio.c #
Python-$(PYTHON_VERSION)/Modules/_io/bytesio.c #
Python-$(PYTHON_VERSION)/Modules/_io/fileio.c #
Python-$(PYTHON_VERSION)/Modules/_io/iobase.c #
Python-$(PYTHON_VERSION)/Modules/_io/stringio.c #
Python-$(PYTHON_VERSION)/Modules/_io/textio.c #
#Modules/expat
Python-$(PYTHON_VERSION)/Modules/pyexpat.c #
PyMod-$(PYTHON_VERSION)/Modules/expat/xmlparse.c #
Python-$(PYTHON_VERSION)/Modules/expat/xmlrole.c #
Python-$(PYTHON_VERSION)/Modules/expat/xmltok.c #
#Modules/zlib
Python-$(PYTHON_VERSION)/Modules/zlib/adler32.c #
@ -238,8 +247,8 @@
Python-$(PYTHON_VERSION)/Modules/zlib/zutil.c #
[BuildOptions]
MSFT:*_*_IA32_CC_FLAGS = /Oi- /wd4018 /wd4054 /wd4055 /wd4101 /wd4131 /wd4152 /wd4204 /wd4210 /wd4244 /wd4267 /wd4305 /wd4310 /wd4389 /wd4701 /wd4702 /wd4706 /I$(WORKSPACE)\AppPkg\Applications\Python\Ia32 /I$(WORKSPACE)\AppPkg\Applications\Python\Efi /I$(WORKSPACE)\AppPkg\Applications\Python\Python-$(PYTHON_VERSION)\Include
MSFT:*_*_X64_CC_FLAGS = /Oi- /wd4018 /wd4054 /wd4055 /wd4101 /wd4131 /wd4152 /wd4204 /wd4210 /wd4244 /wd4267 /wd4305 /wd4310 /wd4389 /wd4701 /wd4702 /wd4706 /I$(WORKSPACE)\AppPkg\Applications\Python\X64 /I$(WORKSPACE)\AppPkg\Applications\Python\Efi /I$(WORKSPACE)\AppPkg\Applications\Python\Python-$(PYTHON_VERSION)\Include
GCC:*_*_IA32_CC_FLAGS = -fno-builtin -Wno-format -I$(WORKSPACE)/AppPkg/Applications/Python/Ia32 -I$(WORKSPACE)/AppPkg/Applications/Python/Python-$(PYTHON_VERSION)/Include
GCC:*_*_X64_CC_FLAGS = -Wno-format -I$(WORKSPACE)/AppPkg/Applications/Python/X64 -I$(WORKSPACE)/AppPkg/Applications/Python/Python-$(PYTHON_VERSION)/Include
MSFT:*_*_IA32_CC_FLAGS = /Oi- /wd4018 /wd4054 /wd4055 /wd4101 /wd4131 /wd4152 /wd4204 /wd4210 /wd4244 /wd4267 /wd4305 /wd4310 /wd4389 /wd4701 /wd4702 /wd4706 /I$(WORKSPACE)\AppPkg\Applications\Python\Ia32 /I$(WORKSPACE)\AppPkg\Applications\Python\Efi /I$(WORKSPACE)\AppPkg\Applications\Python\Python-$(PYTHON_VERSION)\Include /DHAVE_MEMMOVE /DUSE_PYEXPAT_CAPI /DXML_STATIC
MSFT:*_*_X64_CC_FLAGS = /Oi- /wd4018 /wd4054 /wd4055 /wd4101 /wd4131 /wd4152 /wd4204 /wd4210 /wd4244 /wd4267 /wd4305 /wd4310 /wd4389 /wd4701 /wd4702 /wd4706 /I$(WORKSPACE)\AppPkg\Applications\Python\X64 /I$(WORKSPACE)\AppPkg\Applications\Python\Efi /I$(WORKSPACE)\AppPkg\Applications\Python\Python-$(PYTHON_VERSION)\Include /DHAVE_MEMMOVE /DUSE_PYEXPAT_CAPI /DXML_STATIC
GCC:*_*_IA32_CC_FLAGS = -fno-builtin -Wno-format -I$(WORKSPACE)/AppPkg/Applications/Python/Ia32 -I$(WORKSPACE)/AppPkg/Applications/Python/Python-$(PYTHON_VERSION)/Include -DHAVE_MEMMOVE -DUSE_PYEXPAT_CAPI -DXML_STATIC
GCC:*_*_X64_CC_FLAGS = -Wno-format -I$(WORKSPACE)/AppPkg/Applications/Python/X64 -I$(WORKSPACE)/AppPkg/Applications/Python/Python-$(PYTHON_VERSION)/Include -DHAVE_MEMMOVE -DUSE_PYEXPAT_CAPI -DXML_STATIC
GCC:*_*_IPF_SYMRENAME_FLAGS = --redefine-syms=$(WORKSPACE)/StdLib/GccSymRename.txt