]> git.proxmox.com Git - mirror_edk2.git/commitdiff
StdLib: Improve robustness of stat() and make basename() a public function.
authordarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 3 Oct 2011 18:54:12 +0000 (18:54 +0000)
committerdarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 3 Oct 2011 18:54:12 +0000 (18:54 +0000)
AppPkg: Refinements to pyconfig.h and port of getpath.c to EDK II.

Signed-off-by: darylm503
Reviewed-by: geekboy15a
Reviewed-by: jljusten
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12508 6f19259b-4bc3-4df7-8a09-765794883524

20 files changed:
AppPkg/Applications/Python/Efi/config.c
AppPkg/Applications/Python/Efi/getpath.c [new file with mode: 0644]
AppPkg/Applications/Python/Efi/getpathp.c [deleted file]
AppPkg/Applications/Python/Ia32/pyconfig.h
AppPkg/Applications/Python/PyMod-2.7.2/Include/fileobject.h
AppPkg/Applications/Python/PyMod-2.7.2/Include/osdefs.h [new file with mode: 0644]
AppPkg/Applications/Python/PyMod-2.7.2/Include/pyport.h
AppPkg/Applications/Python/PyMod-2.7.2/Modules/_sre.c
AppPkg/Applications/Python/PyMod-2.7.2/Modules/zlib/zutil.h
AppPkg/Applications/Python/PyMod-2.7.2/Objects/longobject.c
AppPkg/Applications/Python/PyMod-2.7.2/Objects/stringlib/localeutil.h
AppPkg/Applications/Python/PyMod-2.7.2/Python/marshal.c
AppPkg/Applications/Python/PythonCore.inf
AppPkg/Applications/Python/X64/pyconfig.h
StdLib/Include/sys/EfiSysCall.h
StdLib/Include/unistd.h
StdLib/LibC/Uefi/Devices/UefiShell/daShell.c
StdLib/LibC/Uefi/SysCalls.c
StdLib/LibC/Uefi/compat.c
StdLib/StdLib.inc

index 52c7795446aa2a5d8426fedc716896629b15a916..98e7e2a31efc0a16552124f1e0690db34c3dfd94 100644 (file)
@@ -1,4 +1,15 @@
-/* Module configuration */\r
+/** @file\r
+    Python Module configuration.\r
+\r
+    Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+    This program and the accompanying materials are licensed and made available under\r
+    the terms and conditions of the BSD License that accompanies this distribution.\r
+    The full text of the license may be found at\r
+    http://opensource.org/licenses/bsd-license.\r
+\r
+    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
 \r
 /* This file contains the table of built-in modules.\r
    See init_builtin() in import.c. */\r
@@ -6,9 +17,9 @@
 #include "Python.h"\r
 \r
 extern void initarray(void);\r
-//#ifndef MS_WINI64\r
-//extern void initaudioop(void);\r
-//#endif\r
+#ifndef MS_WINI64\r
+extern void initaudioop(void);\r
+#endif\r
 extern void initbinascii(void);\r
 extern void initcmath(void);\r
 extern void initerrno(void);\r
@@ -27,7 +38,7 @@ extern void init_sha256(void);
 extern void init_sha512(void);\r
 extern void initstrop(void);\r
 extern void inittime(void);\r
-//extern void initthread(void);\r
+extern void initthread(void);\r
 extern void initcStringIO(void);\r
 extern void initcPickle(void);\r
 #ifdef WIN32\r
@@ -38,23 +49,23 @@ extern void init_codecs(void);
 extern void init_weakref(void);\r
 extern void init_hotshot(void);\r
 extern void initxxsubtype(void);\r
-//extern void initzipimport(void);\r
+extern void initzipimport(void);\r
 extern void init_random(void);\r
 extern void inititertools(void);\r
 extern void init_collections(void);\r
 extern void init_heapq(void);\r
 extern void init_bisect(void);\r
 extern void init_symtable(void);\r
-//extern void initmmap(void);\r
+extern void initmmap(void);\r
 extern void init_csv(void);\r
 extern void init_sre(void);\r
 extern void initparser(void);\r
-//extern void init_winreg(void);\r
+extern void init_winreg(void);\r
 extern void init_struct(void);\r
 extern void initdatetime(void);\r
 extern void init_functools(void);\r
 extern void init_json(void);\r
-//extern void initzlib(void);\r
+extern void initzlib(void);\r
 \r
 extern void init_multibytecodec(void);\r
 extern void init_codecs_cn(void);\r
@@ -63,8 +74,8 @@ extern void init_codecs_iso2022(void);
 extern void init_codecs_jp(void);\r
 extern void init_codecs_kr(void);\r
 extern void init_codecs_tw(void);\r
-//extern void init_subprocess(void);\r
-//extern void init_lsprof(void);\r
+extern void init_subprocess(void);\r
+extern void init_lsprof(void);\r
 extern void init_ast(void);\r
 extern void init_io(void);\r
 extern void _PyWarnings_Init(void);\r
@@ -79,16 +90,20 @@ struct _inittab _PyImport_Inittab[] = {
 \r
     {"array", initarray},\r
     {"_ast", init_ast},\r
-//#ifdef MS_WINDOWS\r
-//#ifndef MS_WINI64\r
-//    {"audioop", initaudioop},\r
-//#endif\r
-//#endif\r
+#ifdef MS_WINDOWS\r
+#ifndef MS_WINI64\r
+    {"audioop", initaudioop},\r
+#endif\r
+#endif\r
     {"binascii", initbinascii},\r
     //{"cmath", initcmath},\r
     {"errno", initerrno},\r
-    {"future_builtins", initfuture_builtins},\r
+\r
     {"gc", initgc},\r
+    {"signal", initsignal},\r
+\r
+#if 0\r
+    {"future_builtins", initfuture_builtins},\r
 #ifndef MS_WINI64\r
     {"imageop", initimageop},\r
 #endif\r
@@ -96,7 +111,6 @@ struct _inittab _PyImport_Inittab[] = {
     {"_md5", init_md5},\r
     //{"nt", initnt}, /* Use the NT os functions, not posix */\r
     {"operator", initoperator},\r
-    {"signal", initsignal},\r
     {"_sha", init_sha},\r
     {"_sha256", init_sha256},\r
     {"_sha512", init_sha512},\r
@@ -127,10 +141,14 @@ struct _inittab _PyImport_Inittab[] = {
     //{"mmap", initmmap},\r
     {"_csv", init_csv},\r
     {"_sre", init_sre},\r
+#endif\r
+\r
     {"parser", initparser},\r
+\r
+#if 0\r
     //{"_winreg", init_winreg},\r
     {"_struct", init_struct},\r
-    //{"datetime", initdatetime},\r
+    {"datetime", initdatetime},\r
     {"_functools", init_functools},\r
     {"_json", init_json},\r
 \r
@@ -146,6 +164,7 @@ struct _inittab _PyImport_Inittab[] = {
     {"_codecs_jp", init_codecs_jp},\r
     {"_codecs_kr", init_codecs_kr},\r
     {"_codecs_tw", init_codecs_tw},\r
+#endif\r
 \r
 /* tools/freeze/makeconfig.py marker for additional "_inittab" entries */\r
 /* -- ADDMODULE MARKER 2 -- */\r
@@ -153,7 +172,7 @@ struct _inittab _PyImport_Inittab[] = {
     /* This module "lives in" with marshal.c */\r
     {"marshal", PyMarshal_Init},\r
 \r
-    /* This lives it with import.c */\r
+    /* This lives in with import.c */\r
     {"imp", initimp},\r
 \r
     /* These entries are here for sys.builtin_module_names */\r
diff --git a/AppPkg/Applications/Python/Efi/getpath.c b/AppPkg/Applications/Python/Efi/getpath.c
new file mode 100644 (file)
index 0000000..ba837bf
--- /dev/null
@@ -0,0 +1,788 @@
+/** @file\r
+    Return the initial module search path.\r
+\r
+    Search in specified locations for the associated Python libraries.\r
+\r
+    Py_GetPath returns module_search_path.\r
+    Py_GetPrefix returns PREFIX\r
+    Py_GetExec_Prefix returns PREFIX\r
+    Py_GetProgramFullPath returns the full path to the python executable.\r
+\r
+    These are built dynamically so that the proper volume name can be prefixed\r
+    to the paths.\r
+\r
+    For the EDK II, UEFI, implementation of Python, PREFIX and EXEC_PREFIX\r
+    are set as follows:\r
+      PREFIX      = /Efi/StdLib\r
+      EXEC_PREFIX = PREFIX\r
+\r
+    The following final paths are assumed:\r
+      /Efi/Tools/Python.efi                     The Python executable.\r
+      /Efi/StdLib/lib/python.VERSION            The platform independent Python modules.\r
+      /Efi/StdLib/lib/python.VERSION/dynalib    Dynamically loadable Python extension modules.\r
+\r
+    Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+    This program and the accompanying materials are licensed and made available under\r
+    the terms and conditions of the BSD License that accompanies this distribution.\r
+    The full text of the license may be found at\r
+    http://opensource.org/licenses/bsd-license.\r
+\r
+    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
+#include <Python.h>\r
+#include <osdefs.h>\r
+\r
+#ifdef __cplusplus\r
+ extern "C" {\r
+#endif\r
+\r
+/* VERSION must be at least two characters long. */\r
+#ifndef VERSION\r
+  #define VERSION     "27"\r
+#endif\r
+\r
+#ifndef VPATH\r
+  #define VPATH       "."\r
+#endif\r
+\r
+/* Search path entry delimiter */\r
+#ifdef DELIM\r
+  #define sDELIM        ";"\r
+#endif\r
+\r
+#ifndef PREFIX\r
+  #define PREFIX      "/Efi/StdLib"\r
+#endif\r
+\r
+#ifndef EXEC_PREFIX\r
+  #define EXEC_PREFIX PREFIX\r
+#endif\r
+\r
+#ifndef   LIBPYTHON\r
+  #define   LIBPYTHON     "lib/python." VERSION\r
+#endif\r
+\r
+#ifndef PYTHONPATH\r
+//#define PYTHONPATH       PREFIX LIBPYTHON sDELIM \\r
+//                    EXEC_PREFIX LIBPYTHON "/lib-dynload"\r
+  #define PYTHONPATH  LIBPYTHON // sDELIM\r
+//                      LIBPYTHON "/lib-dynload"\r
+#endif\r
+\r
+#ifndef LANDMARK\r
+#define LANDMARK    "os.py"\r
+#endif\r
+\r
+static char   prefix[MAXPATHLEN+1];\r
+static char   exec_prefix[MAXPATHLEN+1];\r
+static char   progpath[MAXPATHLEN+1];\r
+static char  *module_search_path          = NULL;\r
+static char   lib_python[]                = LIBPYTHON;\r
+static char   volume_name[32]             = { 0 };\r
+\r
+/** Determine if "ch" is a separator character.\r
+\r
+    @param[in]  ch      The character to test.\r
+\r
+    @retval     TRUE    ch is a separator character.\r
+    @retval     FALSE   ch is NOT a separator character.\r
+**/\r
+static int\r
+is_sep(char ch)\r
+{\r
+#ifdef ALTSEP\r
+  return ch == SEP || ch == ALTSEP;\r
+#else\r
+  return ch == SEP;\r
+#endif\r
+}\r
+\r
+/** Reduce a path by its last element.\r
+\r
+    The last element (everything to the right of the last separator character)\r
+    in the path, dir, is removed from the path.  Parameter dir is modified in place.\r
+\r
+    @param[in,out]    dir   Pointer to the path to modify.\r
+**/\r
+static void\r
+reduce(char *dir)\r
+{\r
+    size_t i = strlen(dir);\r
+    while (i > 0 && !is_sep(dir[i]))\r
+        --i;\r
+    dir[i] = '\0';\r
+}\r
+\r
+/** Does filename point to a file and not directory?\r
+\r
+    @param[in]    filename    The fully qualified path to the object to test.\r
+\r
+    @retval       0     Filename was not found, or is a directory.\r
+    @retval       1     Filename refers to a regular file.\r
+**/\r
+static int\r
+isfile(char *filename)\r
+{\r
+    struct stat buf;\r
+    if (stat(filename, &buf) != 0) {\r
+      //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d] Not Found: file = \"%s\"\n", __func__, __LINE__, filename);\r
+      return 0;\r
+    }\r
+    //if (!S_ISREG(buf.st_mode))\r
+    if (S_ISDIR(buf.st_mode)) {\r
+      //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d] Is DIR: file = \"%s\"\n", __func__, __LINE__, filename);\r
+      return 0;\r
+    }\r
+    //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d] SUCCESS: file = \"%s\"\n", __func__, __LINE__, filename);\r
+    return 1;\r
+}\r
+\r
+/** Determine if filename refers to a Python module.\r
+\r
+    A Python module is indicated if the file exists, or if the file with\r
+    'o' or 'c' appended exists.\r
+\r
+    @param[in]    filename    The fully qualified path to the object to test.\r
+\r
+    @retval       0\r
+**/\r
+static int\r
+ismodule(char *filename)\r
+{\r
+  if (isfile(filename)) {\r
+    //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: file = \"%s\"\n", __func__, __LINE__, filename);\r
+    return 1;\r
+  }\r
+\r
+    /* Check for the compiled version of prefix. */\r
+    if (strlen(filename) < MAXPATHLEN) {\r
+        strcat(filename, Py_OptimizeFlag ? "o" : "c");\r
+        if (isfile(filename)) {\r
+          //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: file = \"%s\"\n", __func__, __LINE__, filename);\r
+          return 1;\r
+        }\r
+    }\r
+    //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d] FAIL: file = \"%s\"\n", __func__, __LINE__, filename);\r
+    return 0;\r
+}\r
+\r
+/** Does filename point to a directory?\r
+\r
+    @param[in]    filename    The fully qualified path to the object to test.\r
+\r
+    @retval       0     Filename was not found, or is not a regular file.\r
+    @retval       1     Filename refers to a directory.\r
+**/\r
+static int\r
+isdir(char *filename)\r
+{\r
+    struct stat buf;\r
+\r
+    if (stat(filename, &buf) != 0)\r
+        return 0;\r
+\r
+    if (!S_ISDIR(buf.st_mode))\r
+        return 0;\r
+\r
+    return 1;\r
+}\r
+\r
+/** Determine if a path is absolute, or not.\r
+    An absolute path consists of a volume name, "VOL:", followed by a rooted path,\r
+    "/path/elements".  If both of these components are present, the path is absolute.\r
+\r
+    Let P be a pointer to the path to test.\r
+    Let A be a pointer to the first ':' in P.\r
+    Let B be a pointer to the first '/' or '\\' in P.\r
+\r
+    If A and B are not NULL\r
+      If (A-P+1) == (B-P) then the path is absolute.\r
+    Otherwise, the path is NOT absolute.\r
+\r
+    @param[in]  path    The path to test.\r
+\r
+    @retval     -1      Path is absolute but lacking volume name.\r
+    @retval      0      Path is NOT absolute.\r
+    @retval      1      Path is absolute.\r
+*/\r
+static int\r
+is_absolute(char *path)\r
+{\r
+  char  *A;\r
+  char  *B;\r
+\r
+  A = strchr(path, ':');\r
+  B = strpbrk(path, "/\\");\r
+\r
+  if(B != NULL) {\r
+    if(A == NULL) {\r
+      if(B == path) {\r
+        return -1;\r
+      }\r
+    }\r
+    else {\r
+      if(((A - path) + 1) == (B - path)) {\r
+        return 1;\r
+      }\r
+    }\r
+  }\r
+  return 0;\r
+}\r
+\r
+\r
+/** Add a path component, by appending stuff to buffer.\r
+    buffer must have at least MAXPATHLEN + 1 bytes allocated, and contain a\r
+    NUL-terminated string with no more than MAXPATHLEN characters (not counting\r
+    the trailing NUL).  It's a fatal error if it contains a string longer than\r
+    that (callers must be careful!).  If these requirements are met, it's\r
+    guaranteed that buffer will still be a NUL-terminated string with no more\r
+    than MAXPATHLEN characters at exit.  If stuff is too long, only as much of\r
+    stuff as fits will be appended.\r
+\r
+    @param[in,out]    buffer    The path to be extended.\r
+    @param[in]        stuff     The stuff to join onto the path.\r
+*/\r
+static void\r
+joinpath(char *buffer, char *stuff)\r
+{\r
+  size_t n, k;\r
+\r
+  k = 0;\r
+  if (is_absolute(stuff) == 1) {\r
+    n = 0;\r
+  }\r
+  else {\r
+    n = strlen(buffer);\r
+    if(n == 0) {\r
+      strncpy(buffer, volume_name, MAXPATHLEN);\r
+      n = strlen(buffer);\r
+    }\r
+    /* We must not use an else clause here because we want to test n again.\r
+        volume_name may have been empty.\r
+    */\r
+    if (n > 0 && n < MAXPATHLEN) {\r
+      if(!is_sep(buffer[n-1])) {\r
+        buffer[n++] = SEP;\r
+      }\r
+      if(is_sep(stuff[0]))   ++stuff;\r
+    }\r
+  }\r
+  if (n > MAXPATHLEN)\r
+    Py_FatalError("buffer overflow in getpath.c's joinpath()");\r
+  k = strlen(stuff);\r
+  if (n + k > MAXPATHLEN)\r
+    k = MAXPATHLEN - n;\r
+  strncpy(buffer+n, stuff, k);\r
+  buffer[n+k] = '\0';\r
+}\r
+\r
+/** Is filename an executable file?\r
+\r
+    An executable file:\r
+      1) exists\r
+      2) is a file, not a directory\r
+      3) has a name ending with ".efi"\r
+      4) Only has a single '.' in the name.\r
+\r
+    If basename(filename) does not contain a '.', append ".efi" to filename\r
+    If filename ends in ".efi", it is executable, else it isn't.\r
+\r
+    This routine is used to when searching for the file named by argv[0].\r
+    As such, there is no need to search for extensions other than ".efi".\r
+\r
+    @param[in]    filename      The name of the file to test.  It may, or may not, have an extension.\r
+\r
+    @retval       0     filename already has a path other than ".efi", or it doesn't exist, or is a directory.\r
+    @retval       1     filename refers to an executable file.\r
+**/\r
+static int\r
+isxfile(char *filename)\r
+{\r
+    struct stat  buf;\r
+    char        *bn;\r
+    char        *newbn;\r
+    int          bnlen;\r
+\r
+    //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d] ENTER: file = \"%s\"\n", __func__, __LINE__, filename);\r
+    bn = basename(filename);            // Separate off the file name component\r
+    reduce(filename);                   // and isolate the path component\r
+    bnlen = strlen(bn);\r
+    newbn = strrchr(bn, '.');           // Does basename contain a period?\r
+    if(newbn == NULL) {                   // Does NOT contain a period.\r
+      newbn = &bn[bnlen];\r
+      strncpyX(newbn, ".efi", MAXPATHLEN - bnlen);    // append ".efi" to basename\r
+      bnlen += 4;\r
+    }\r
+    else if(strcmp(newbn, ".efi") != 0) {\r
+      //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: Bad extension\n", __func__, __LINE__);\r
+      return 0;                         // File can not be executable.\r
+    }\r
+    joinpath(filename, bn);             // Stitch path and file name back together\r
+    //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: file = \"%s\"\n", __func__, __LINE__, filename);\r
+\r
+    if (stat(filename, &buf) != 0) {    // Now, verify that file exists\r
+      //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: Does not exist\n", __func__, __LINE__);\r
+      return 0;\r
+    }\r
+    if(S_ISDIR(buf.st_mode)) {          // And it is not a directory.\r
+      //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: Is a directory\n", __func__, __LINE__);\r
+      return 0;\r
+    }\r
+\r
+    //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d] EXIT: file = \"%s\"\n", __func__, __LINE__, filename);\r
+    return 1;\r
+}\r
+\r
+/** Copy p into path, ensuring that the result is an absolute path.\r
+\r
+    copy_absolute requires that path be allocated at least\r
+    MAXPATHLEN + 1 bytes and that p be no more than MAXPATHLEN bytes.\r
+\r
+    @param[out]     path    Destination to receive the absolute path.\r
+    @param[in]      p       Path to be tested and possibly converted.\r
+**/\r
+static void\r
+copy_absolute(char *path, char *p)\r
+{\r
+  if (is_absolute(p) == 1)\r
+        strcpy(path, p);\r
+  else {\r
+    if (!getcwd(path, MAXPATHLEN)) {\r
+      /* unable to get the current directory */\r
+      if(volume_name[0] != 0) {\r
+        strcpy(path, volume_name);\r
+        joinpath(path, p);\r
+      }\r
+      else\r
+        strcpy(path, p);\r
+      return;\r
+    }\r
+    if (p[0] == '.' && is_sep(p[1]))\r
+        p += 2;\r
+    joinpath(path, p);\r
+  }\r
+}\r
+\r
+/** Modify path so that the result is an absolute path.\r
+    absolutize() requires that path be allocated at least MAXPATHLEN+1 bytes.\r
+\r
+    @param[in,out]    path    The path to be made absolute.\r
+*/\r
+static void\r
+absolutize(char *path)\r
+{\r
+    char buffer[MAXPATHLEN + 1];\r
+\r
+    if (is_absolute(path) == 1)\r
+        return;\r
+    copy_absolute(buffer, path);\r
+    strcpy(path, buffer);\r
+}\r
+\r
+/** Extract the volume name from a path.\r
+\r
+    @param[out]   Dest    Pointer to location in which to store the extracted volume name.\r
+    @param[in]    path    Pointer to the path to extract the volume name from.\r
+**/\r
+static void\r
+set_volume(char *Dest, char *path)\r
+{\r
+  size_t    VolLen;\r
+\r
+  //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d] ENTER: path = \"%s\"\n", __func__, __LINE__, path);\r
+  if(is_absolute(path)) {\r
+    VolLen = strcspn(path, "/\\:");\r
+    //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: VolLen = %d\n", __func__, __LINE__, VolLen);\r
+    if((VolLen != 0) && (path[VolLen] == ':')) {\r
+      (void) strncpyX(Dest, path, VolLen + 1);\r
+      //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: VolLen = %d, Dest = \"%s\" path = \"%s\"\n",\r
+      //                                      __func__, __LINE__, VolLen, Dest, path);\r
+    }\r
+  }\r
+  //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d] EXIT: Dest = \"%s\"\n", __func__, __LINE__, Dest);\r
+}\r
+\r
+\r
+/** Determine paths.\r
+\r
+    Two directories must be found, the platform independent directory\r
+    (prefix), containing the common .py and .pyc files, and the platform\r
+    dependent directory (exec_prefix), containing the shared library\r
+    modules.  Note that prefix and exec_prefix are the same directory\r
+    for UEFI installations.\r
+\r
+    Separate searches are carried out for prefix and exec_prefix.\r
+    Each search tries a number of different locations until a ``landmark''\r
+    file or directory is found.  If no prefix or exec_prefix is found, a\r
+    warning message is issued and the preprocessor defined PREFIX and\r
+    EXEC_PREFIX are used (even though they may not work); python carries on\r
+    as best as is possible, but some imports may fail.\r
+\r
+    Before any searches are done, the location of the executable is\r
+    determined.  If argv[0] has one or more slashes in it, it is used\r
+    unchanged.  Otherwise, it must have been invoked from the shell's path,\r
+    so we search %PATH% for the named executable and use that.  If the\r
+    executable was not found on %PATH% (or there was no %PATH% environment\r
+    variable), the original argv[0] string is used.\r
+\r
+    Finally, argv0_path is set to the directory containing the executable\r
+    (i.e. the last component is stripped).\r
+\r
+    With argv0_path in hand, we perform a number of steps.  The same steps\r
+    are performed for prefix and for exec_prefix, but with a different\r
+    landmark.\r
+\r
+    The prefix landmark will always be lib/python.VERSION/os.py and the\r
+    exec_prefix will always be lib/python.VERSION/dynaload, where VERSION\r
+    is Python's version number as defined at the beginning of this file.\r
+\r
+    First. See if the %PYTHONHOME% environment variable points to the\r
+    installed location of the Python libraries.  If %PYTHONHOME% is set, then\r
+    it points to prefix and exec_prefix.  %PYTHONHOME% can be a single\r
+    directory, which is used for both, or the prefix and exec_prefix\r
+    directories separated by the DELIM character.\r
+\r
+    Next. Search the directories pointed to by the preprocessor variables\r
+    PREFIX and EXEC_PREFIX.  These paths are prefixed with the volume name\r
+    extracted from argv0_path.  The volume names correspond to the UEFI\r
+    shell "map" names.\r
+\r
+    That's it!\r
+\r
+    Well, almost.  Once we have determined prefix and exec_prefix, the\r
+    preprocessor variable PYTHONPATH is used to construct a path.  Each\r
+    relative path on PYTHONPATH is prefixed with prefix.  Then the directory\r
+    containing the shared library modules is appended.  The environment\r
+    variable $PYTHONPATH is inserted in front of it all.  Finally, the\r
+    prefix and exec_prefix globals are tweaked so they reflect the values\r
+    expected by other code, by stripping the "lib/python$VERSION/..." stuff\r
+    off.  This seems to make more sense given that currently the only\r
+    known use of sys.prefix and sys.exec_prefix is for the ILU installation\r
+    process to find the installed Python tree.\r
+\r
+    The final, fully resolved, paths should look something like:\r
+      fs0:/Efi/Tools/python.efi\r
+      fs0:/Efi/StdLib/lib/python27\r
+      fs0:/Efi/StdLib/lib/python27/dynaload\r
+\r
+**/\r
+static void\r
+calculate_path(void)\r
+{\r
+    extern char *Py_GetProgramName(void);\r
+\r
+    static char delimiter[2] = {DELIM, '\0'};\r
+    static char separator[2] = {SEP, '\0'};\r
+    char *pythonpath = PYTHONPATH;\r
+    char *rtpypath = Py_GETENV("PYTHONPATH");\r
+    //char *home = Py_GetPythonHome();\r
+    char *path = getenv("PATH");\r
+    char *prog = Py_GetProgramName();\r
+    char argv0_path[MAXPATHLEN+1];\r
+    char zip_path[MAXPATHLEN+1];\r
+    //int pfound, efound; /* 1 if found; -1 if found build directory */\r
+    char *buf;\r
+    size_t bufsz;\r
+    size_t prefixsz;\r
+    char *defpath;\r
+    //uint32_t nsexeclength = MAXPATHLEN;\r
+\r
+    //unixify(path);\r
+    //unixify(rtpypath);\r
+    //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]:\nENTER prog=\"%s\"\n      path=\"%s\"\n", __func__, __LINE__, prog, path);\r
+\r
+\r
+/* ###########################################################################\r
+      Determine path to the Python.efi binary.\r
+      Produces progpath, argv0_path, and volume_name.\r
+########################################################################### */\r
+\r
+    /* If there is no slash in the argv0 path, then we have to\r
+     * assume python is on the user's $PATH, since there's no\r
+     * other way to find a directory to start the search from.  If\r
+     * $PATH isn't exported, you lose.\r
+     */\r
+    if (strchr(prog, SEP))\r
+            strncpy(progpath, prog, MAXPATHLEN);\r
+    else if (path) {\r
+      while (1) {\r
+        char *delim = strchr(path, DELIM);\r
+\r
+        if (delim) {\r
+                size_t len = delim - path;\r
+                if (len > MAXPATHLEN)\r
+                        len = MAXPATHLEN;\r
+                strncpy(progpath, path, len);\r
+                *(progpath + len) = '\0';\r
+        }\r
+        else\r
+                strncpy(progpath, path, MAXPATHLEN);\r
+\r
+        joinpath(progpath, prog);\r
+        //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: progpath = \"%s\"\n", __func__, __LINE__, progpath);\r
+        if (isxfile(progpath))\r
+                break;\r
+\r
+        if (!delim) {\r
+                progpath[0] = '\0';\r
+                break;\r
+        }\r
+        path = delim + 1;\r
+      }\r
+    }\r
+    else\r
+            progpath[0] = '\0';\r
+    if ( (!is_absolute(progpath)) && (progpath[0] != '\0') )\r
+            absolutize(progpath);\r
+    strncpy(argv0_path, progpath, MAXPATHLEN);\r
+    argv0_path[MAXPATHLEN] = '\0';\r
+    set_volume(volume_name, argv0_path);\r
+\r
+    //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: volume_name = \"%s\"\n", __func__, __LINE__, volume_name);\r
+    reduce(argv0_path);\r
+    //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: progpath = \"%s\"\n", __func__, __LINE__, progpath);\r
+    //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: argv0_path = \"%s\"\n", __func__, __LINE__, argv0_path);\r
+    /* At this point, argv0_path is guaranteed to be less than\r
+       MAXPATHLEN bytes long.\r
+    */\r
+\r
+/* ###########################################################################\r
+      Build the FULL prefix string, including volume name.\r
+      This is the full path to the platform independent libraries.\r
+########################################################################### */\r
+\r
+    //if (!(pfound = search_for_prefix(argv0_path, home))) {\r
+    //    if (!Py_FrozenFlag)\r
+    //        fprintf(stderr,\r
+    //            "Could not find platform independent libraries <prefix>\n");\r
+        strncpy(prefix, volume_name, MAXPATHLEN);\r
+        joinpath(prefix, PREFIX);\r
+        joinpath(prefix, lib_python);\r
+    //}\r
+    //else\r
+    //    reduce(prefix);\r
+    //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: V = \"%s\", Prefix = \"%s\"\n", __func__, __LINE__, volume_name, prefix);\r
+\r
+/* ###########################################################################\r
+      Build the FULL path to the zipped-up Python library.\r
+########################################################################### */\r
+\r
+    strncpy(zip_path, prefix, MAXPATHLEN);\r
+    zip_path[MAXPATHLEN] = '\0';\r
+    //if (pfound > 0) { /* Use the reduced prefix returned by Py_GetPrefix() */\r
+        reduce(zip_path);\r
+        //reduce(zip_path);\r
+    //}\r
+    //else\r
+    //    strncpy(zip_path, PREFIX, MAXPATHLEN);\r
+    joinpath(zip_path, "python00.zip");\r
+    bufsz = strlen(zip_path);   /* Replace "00" with version */\r
+    zip_path[bufsz - 6] = VERSION[0];\r
+    zip_path[bufsz - 5] = VERSION[1];\r
+    //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: Zip_path = \"%s\"\n", __func__, __LINE__, zip_path);\r
+\r
+/* ###########################################################################\r
+      Build the FULL path to dynamically loadable libraries.\r
+########################################################################### */\r
+\r
+    //if (!(efound = search_for_exec_prefix(argv0_path, home))) {\r
+    //    if (!Py_FrozenFlag)\r
+    //        fprintf(stderr,\r
+    //            "Could not find platform dependent libraries <exec_prefix>\n");\r
+        strncpy(exec_prefix, volume_name, MAXPATHLEN);\r
+        joinpath(exec_prefix, EXEC_PREFIX);\r
+        joinpath(exec_prefix, lib_python);\r
+        joinpath(exec_prefix, "dynaload");\r
+    //}\r
+    /* If we found EXEC_PREFIX do *not* reduce it!  (Yet.) */\r
+    //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: Exec_prefix = \"%s\"\n", __func__, __LINE__, exec_prefix);\r
+\r
+    //if ((!pfound || !efound) && !Py_FrozenFlag)\r
+    //    fprintf(stderr,\r
+    //            "Consider setting $PYTHONHOME to <prefix>[%c<exec_prefix>]\n", DELIM);\r
+\r
+/* ###########################################################################\r
+      Build the module search path.\r
+########################################################################### */\r
+\r
+    /* Reduce prefix and exec_prefix to their essence,\r
+     * e.g. /usr/local/lib/python1.5 is reduced to /usr/local.\r
+     * If we're loading relative to the build directory,\r
+     * return the compiled-in defaults instead.\r
+     */\r
+    //if (pfound > 0) {\r
+    reduce(prefix);\r
+    reduce(prefix);\r
+    /* The prefix is the root directory, but reduce() chopped\r
+     * off the "/". */\r
+    if (!prefix[0]) {\r
+      strcpy(prefix, volume_name);\r
+    }\r
+    bufsz = strlen(prefix);\r
+    if(prefix[bufsz-1] == ':') {\r
+      prefix[bufsz] = SEP;\r
+      prefix[bufsz+1] = 0;\r
+    }\r
+    //}\r
+    //else\r
+    //    strncpy(prefix, PREFIX, MAXPATHLEN);\r
+\r
+//if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: prefix = \"%s\"\n", __func__, __LINE__, prefix);\r
+\r
+    /* Calculate size of return buffer.\r
+     */\r
+    defpath = pythonpath;\r
+    bufsz = 0;\r
+\r
+    if (rtpypath)\r
+        bufsz += strlen(rtpypath) + 1;\r
+\r
+    prefixsz = strlen(prefix) + 1;\r
+\r
+    while (1) {\r
+        char *delim = strchr(defpath, DELIM);\r
+\r
+        if (is_absolute(defpath) == 0)\r
+            /* Paths are relative to prefix */\r
+            bufsz += prefixsz;\r
+\r
+        if (delim)\r
+            bufsz += delim - defpath + 1;\r
+        else {\r
+            bufsz += strlen(defpath) + 1;\r
+            break;\r
+        }\r
+        defpath = delim + 1;\r
+    }\r
+//if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: defpath = \"%s\"\n", __func__, __LINE__, defpath);\r
+\r
+    bufsz += strlen(zip_path) + 1;\r
+    bufsz += strlen(exec_prefix) + 1;\r
+\r
+    /* This is the only malloc call in this file */\r
+    buf = (char *)PyMem_Malloc(bufsz);\r
+\r
+    if (buf == NULL) {\r
+        /* We can't exit, so print a warning and limp along */\r
+        fprintf(stderr, "Not enough memory for dynamic PYTHONPATH.\n");\r
+        fprintf(stderr, "Using default static PYTHONPATH.\n");\r
+        module_search_path = PYTHONPATH;\r
+    }\r
+    else {\r
+      //if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]:\n", __func__, __LINE__);\r
+        /* Run-time value of $PYTHONPATH goes first */\r
+        if (rtpypath) {\r
+            strcpy(buf, rtpypath);\r
+            strcat(buf, delimiter);\r
+        }\r
+        else\r
+            buf[0] = '\0';\r
+//if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: RTpath = \"%s\"\n", __func__, __LINE__, buf);\r
+\r
+        /* Next is the default zip path */\r
+        strcat(buf, zip_path);\r
+        strcat(buf, delimiter);\r
+//if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: +Zip = \"%s\"\n", __func__, __LINE__, buf);\r
+\r
+        /* Next goes merge of compile-time $PYTHONPATH with\r
+         * dynamically located prefix.\r
+         */\r
+        defpath = pythonpath;\r
+        while (1) {\r
+            char *delim = strchr(defpath, DELIM);\r
+\r
+            if (is_absolute(defpath) != 1) {\r
+                strcat(buf, prefix);\r
+                strcat(buf, separator);\r
+            }\r
+\r
+            if (delim) {\r
+                size_t len = delim - defpath + 1;\r
+                size_t end = strlen(buf) + len;\r
+                strncat(buf, defpath, len);\r
+                *(buf + end) = '\0';\r
+            }\r
+            else {\r
+                strcat(buf, defpath);\r
+                break;\r
+            }\r
+            defpath = delim + 1;\r
+        }\r
+        strcat(buf, delimiter);\r
+//if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: +Merge = \"%s\"\n", __func__, __LINE__, buf);\r
+\r
+        /* Finally, on goes the directory for dynamic-load modules */\r
+        strcat(buf, exec_prefix);\r
+\r
+        /* And publish the results */\r
+        module_search_path = buf;\r
+//if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: module_search_path = \"%s\"\n", __func__, __LINE__, module_search_path);\r
+    }\r
+\r
+    //if (efound > 0) {\r
+        /*  At this point, exec_prefix is set to VOL:/Efi/StdLib/lib/python.27/dynalib.\r
+            We want to get back to the root value, so we have to remove the final three\r
+            segments to get VOL:/Efi/StdLib.  Because we don't know what VOL is, and\r
+            EXEC_PREFIX is also indeterminate, we just remove the three final segments.\r
+        */\r
+        reduce(exec_prefix);\r
+        reduce(exec_prefix);\r
+        reduce(exec_prefix);\r
+        if (!exec_prefix[0]) {\r
+          strcpy(exec_prefix, volume_name);\r
+        }\r
+        bufsz = strlen(exec_prefix);\r
+        if(exec_prefix[bufsz-1] == ':') {\r
+          exec_prefix[bufsz] = SEP;\r
+          exec_prefix[bufsz+1] = 0;\r
+        }\r
+    //}\r
+    //else\r
+    //    strncpy(exec_prefix, EXEC_PREFIX, MAXPATHLEN);\r
+    if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: module_search_path = \"%s\"\n", __func__, __LINE__, module_search_path);\r
+    if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: prefix             = \"%s\"\n", __func__, __LINE__, prefix);\r
+    if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: exec_prefix        = \"%s\"\n", __func__, __LINE__, exec_prefix);\r
+    if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: progpath           = \"%s\"\n", __func__, __LINE__, progpath);\r
+}\r
+\r
+\r
+/* External interface */\r
+\r
+char *\r
+Py_GetPath(void)\r
+{\r
+    if (!module_search_path)\r
+        calculate_path();\r
+    return module_search_path;\r
+}\r
+\r
+char *\r
+Py_GetPrefix(void)\r
+{\r
+    if (!module_search_path)\r
+        calculate_path();\r
+    return prefix;\r
+}\r
+\r
+char *\r
+Py_GetExecPrefix(void)\r
+{\r
+    if (!module_search_path)\r
+        calculate_path();\r
+    return exec_prefix;\r
+}\r
+\r
+char *\r
+Py_GetProgramFullPath(void)\r
+{\r
+    if (!module_search_path)\r
+        calculate_path();\r
+    return progpath;\r
+}\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
diff --git a/AppPkg/Applications/Python/Efi/getpathp.c b/AppPkg/Applications/Python/Efi/getpathp.c
deleted file mode 100644 (file)
index 9f78806..0000000
+++ /dev/null
@@ -1,714 +0,0 @@
-\r
-/* Return the initial module search path. */\r
-/* Used by DOS, OS/2, Windows 3.1, Windows 95/98, Windows NT. */\r
-\r
-/* ----------------------------------------------------------------\r
-   PATH RULES FOR WINDOWS:\r
-   This describes how sys.path is formed on Windows.  It describes the\r
-   functionality, not the implementation (ie, the order in which these\r
-   are actually fetched is different)\r
-\r
-   * Python always adds an empty entry at the start, which corresponds\r
-     to the current directory.\r
-\r
-   * If the PYTHONPATH env. var. exists, its entries are added next.\r
-\r
-   * We look in the registry for "application paths" - that is, sub-keys\r
-     under the main PythonPath registry key.  These are added next (the\r
-     order of sub-key processing is undefined).\r
-     HKEY_CURRENT_USER is searched and added first.\r
-     HKEY_LOCAL_MACHINE is searched and added next.\r
-     (Note that all known installers only use HKLM, so HKCU is typically\r
-     empty)\r
-\r
-   * We attempt to locate the "Python Home" - if the PYTHONHOME env var\r
-     is set, we believe it.  Otherwise, we use the path of our host .EXE's\r
-     to try and locate our "landmark" (lib\\os.py) and deduce our home.\r
-     - If we DO have a Python Home: The relevant sub-directories (Lib,\r
-       plat-win, lib-tk, etc) are based on the Python Home\r
-     - If we DO NOT have a Python Home, the core Python Path is\r
-       loaded from the registry.  This is the main PythonPath key,\r
-       and both HKLM and HKCU are combined to form the path)\r
-\r
-   * Iff - we can not locate the Python Home, have not had a PYTHONPATH\r
-     specified, and can't locate any Registry entries (ie, we have _nothing_\r
-     we can assume is a good path), a default path with relative entries is\r
-     used (eg. .\Lib;.\plat-win, etc)\r
-\r
-\r
-  The end result of all this is:\r
-  * When running python.exe, or any other .exe in the main Python directory\r
-    (either an installed version, or directly from the PCbuild directory),\r
-    the core path is deduced, and the core paths in the registry are\r
-    ignored.  Other "application paths" in the registry are always read.\r
-\r
-  * When Python is hosted in another exe (different directory, embedded via\r
-    COM, etc), the Python Home will not be deduced, so the core path from\r
-    the registry is used.  Other "application paths" in the registry are\r
-    always read.\r
-\r
-  * If Python can't find its home and there is no registry (eg, frozen\r
-    exe, some very strange installation setup) you get a path with\r
-    some default, but relative, paths.\r
-\r
-   ---------------------------------------------------------------- */\r
-\r
-\r
-#include "Python.h"\r
-#include "osdefs.h"\r
-\r
-#ifdef MS_WINDOWS\r
-#include <windows.h>\r
-#include <tchar.h>\r
-#endif\r
-\r
-#ifdef HAVE_SYS_TYPES_H\r
-#include <sys/types.h>\r
-#endif /* HAVE_SYS_TYPES_H */\r
-\r
-#ifdef HAVE_SYS_STAT_H\r
-#include <sys/stat.h>\r
-#endif /* HAVE_SYS_STAT_H */\r
-\r
-#include <string.h>\r
-\r
-/* Search in some common locations for the associated Python libraries.\r
- *\r
- * Py_GetPath() tries to return a sensible Python module search path.\r
- *\r
- * The approach is an adaptation for Windows of the strategy used in\r
- * ../Modules/getpath.c; it uses the Windows Registry as one of its\r
- * information sources.\r
- */\r
-\r
-#ifndef LANDMARK\r
-#define LANDMARK "lib\\os.py"\r
-#endif\r
-\r
-static char prefix[MAXPATHLEN+1];\r
-static char progpath[MAXPATHLEN+1];\r
-static char dllpath[MAXPATHLEN+1];\r
-static char *module_search_path = NULL;\r
-\r
-\r
-static int\r
-is_sep(char ch) /* determine if "ch" is a separator character */\r
-{\r
-#ifdef ALTSEP\r
-    return ch == SEP || ch == ALTSEP;\r
-#else\r
-    return ch == SEP;\r
-#endif\r
-}\r
-\r
-/* assumes 'dir' null terminated in bounds.  Never writes\r
-   beyond existing terminator.\r
-*/\r
-static void\r
-reduce(char *dir)\r
-{\r
-    size_t i = strlen(dir);\r
-    while (i > 0 && !is_sep(dir[i]))\r
-        --i;\r
-    dir[i] = '\0';\r
-}\r
-\r
-\r
-static int\r
-exists(char *filename)\r
-{\r
-    struct stat buf;\r
-    return stat(filename, &buf) == 0;\r
-}\r
-\r
-/* Assumes 'filename' MAXPATHLEN+1 bytes long -\r
-   may extend 'filename' by one character.\r
-*/\r
-static int\r
-ismodule(char *filename)        /* Is module -- check for .pyc/.pyo too */\r
-{\r
-    if (exists(filename))\r
-        return 1;\r
-\r
-    /* Check for the compiled version of prefix. */\r
-    if (strlen(filename) < MAXPATHLEN) {\r
-        strcat(filename, Py_OptimizeFlag ? "o" : "c");\r
-        if (exists(filename))\r
-            return 1;\r
-    }\r
-    return 0;\r
-}\r
-\r
-/* Add a path component, by appending stuff to buffer.\r
-   buffer must have at least MAXPATHLEN + 1 bytes allocated, and contain a\r
-   NUL-terminated string with no more than MAXPATHLEN characters (not counting\r
-   the trailing NUL).  It's a fatal error if it contains a string longer than\r
-   that (callers must be careful!).  If these requirements are met, it's\r
-   guaranteed that buffer will still be a NUL-terminated string with no more\r
-   than MAXPATHLEN characters at exit.  If stuff is too long, only as much of\r
-   stuff as fits will be appended.\r
-*/\r
-static void\r
-join(char *buffer, char *stuff)\r
-{\r
-    size_t n, k;\r
-    if (is_sep(stuff[0]))\r
-        n = 0;\r
-    else {\r
-        n = strlen(buffer);\r
-        if (n > 0 && !is_sep(buffer[n-1]) && n < MAXPATHLEN)\r
-            buffer[n++] = SEP;\r
-    }\r
-    if (n > MAXPATHLEN)\r
-        Py_FatalError("buffer overflow in getpathp.c's joinpath()");\r
-    k = strlen(stuff);\r
-    if (n + k > MAXPATHLEN)\r
-        k = MAXPATHLEN - n;\r
-    strncpy(buffer+n, stuff, k);\r
-    buffer[n+k] = '\0';\r
-}\r
-\r
-/* gotlandmark only called by search_for_prefix, which ensures\r
-   'prefix' is null terminated in bounds.  join() ensures\r
-   'landmark' can not overflow prefix if too long.\r
-*/\r
-static int\r
-gotlandmark(char *landmark)\r
-{\r
-    int ok;\r
-    Py_ssize_t n;\r
-\r
-    n = strlen(prefix);\r
-    join(prefix, landmark);\r
-    ok = ismodule(prefix);\r
-    prefix[n] = '\0';\r
-    return ok;\r
-}\r
-\r
-/* assumes argv0_path is MAXPATHLEN+1 bytes long, already \0 term'd.\r
-   assumption provided by only caller, calculate_path() */\r
-static int\r
-search_for_prefix(char *argv0_path, char *landmark)\r
-{\r
-    /* Search from argv0_path, until landmark is found */\r
-    strcpy(prefix, argv0_path);\r
-    do {\r
-        if (gotlandmark(landmark))\r
-            return 1;\r
-        reduce(prefix);\r
-    } while (prefix[0]);\r
-    return 0;\r
-}\r
-\r
-#ifdef MS_WINDOWS\r
-#ifdef Py_ENABLE_SHARED\r
-\r
-/* a string loaded from the DLL at startup.*/\r
-extern const char *PyWin_DLLVersionString;\r
-\r
-\r
-/* Load a PYTHONPATH value from the registry.\r
-   Load from either HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER.\r
-\r
-   Works in both Unicode and 8bit environments.  Only uses the\r
-   Ex family of functions so it also works with Windows CE.\r
-\r
-   Returns NULL, or a pointer that should be freed.\r
-\r
-   XXX - this code is pretty strange, as it used to also\r
-   work on Win16, where the buffer sizes werent available\r
-   in advance.  It could be simplied now Win16/Win32s is dead!\r
-*/\r
-\r
-static char *\r
-getpythonregpath(HKEY keyBase, int skipcore)\r
-{\r
-    HKEY newKey = 0;\r
-    DWORD dataSize = 0;\r
-    DWORD numKeys = 0;\r
-    LONG rc;\r
-    char *retval = NULL;\r
-    TCHAR *dataBuf = NULL;\r
-    static const TCHAR keyPrefix[] = _T("Software\\Python\\PythonCore\\");\r
-    static const TCHAR keySuffix[] = _T("\\PythonPath");\r
-    size_t versionLen;\r
-    DWORD index;\r
-    TCHAR *keyBuf = NULL;\r
-    TCHAR *keyBufPtr;\r
-    TCHAR **ppPaths = NULL;\r
-\r
-    /* Tried to use sysget("winver") but here is too early :-( */\r
-    versionLen = _tcslen(PyWin_DLLVersionString);\r
-    /* Space for all the chars, plus one \0 */\r
-    keyBuf = keyBufPtr = malloc(sizeof(keyPrefix) +\r
-                                sizeof(TCHAR)*(versionLen-1) +\r
-                                sizeof(keySuffix));\r
-    if (keyBuf==NULL) goto done;\r
-\r
-    memcpy(keyBufPtr, keyPrefix, sizeof(keyPrefix)-sizeof(TCHAR));\r
-    keyBufPtr += sizeof(keyPrefix)/sizeof(TCHAR) - 1;\r
-    memcpy(keyBufPtr, PyWin_DLLVersionString, versionLen * sizeof(TCHAR));\r
-    keyBufPtr += versionLen;\r
-    /* NULL comes with this one! */\r
-    memcpy(keyBufPtr, keySuffix, sizeof(keySuffix));\r
-    /* Open the root Python key */\r
-    rc=RegOpenKeyEx(keyBase,\r
-                    keyBuf, /* subkey */\r
-            0, /* reserved */\r
-            KEY_READ,\r
-            &newKey);\r
-    if (rc!=ERROR_SUCCESS) goto done;\r
-    /* Find out how big our core buffer is, and how many subkeys we have */\r
-    rc = RegQueryInfoKey(newKey, NULL, NULL, NULL, &numKeys, NULL, NULL,\r
-                    NULL, NULL, &dataSize, NULL, NULL);\r
-    if (rc!=ERROR_SUCCESS) goto done;\r
-    if (skipcore) dataSize = 0; /* Only count core ones if we want them! */\r
-    /* Allocate a temp array of char buffers, so we only need to loop\r
-       reading the registry once\r
-    */\r
-    ppPaths = malloc( sizeof(TCHAR *) * numKeys );\r
-    if (ppPaths==NULL) goto done;\r
-    memset(ppPaths, 0, sizeof(TCHAR *) * numKeys);\r
-    /* Loop over all subkeys, allocating a temp sub-buffer. */\r
-    for(index=0;index<numKeys;index++) {\r
-        TCHAR keyBuf[MAX_PATH+1];\r
-        HKEY subKey = 0;\r
-        DWORD reqdSize = MAX_PATH+1;\r
-        /* Get the sub-key name */\r
-        DWORD rc = RegEnumKeyEx(newKey, index, keyBuf, &reqdSize,\r
-                                NULL, NULL, NULL, NULL );\r
-        if (rc!=ERROR_SUCCESS) goto done;\r
-        /* Open the sub-key */\r
-        rc=RegOpenKeyEx(newKey,\r
-                                        keyBuf, /* subkey */\r
-                        0, /* reserved */\r
-                        KEY_READ,\r
-                        &subKey);\r
-        if (rc!=ERROR_SUCCESS) goto done;\r
-        /* Find the value of the buffer size, malloc, then read it */\r
-        RegQueryValueEx(subKey, NULL, 0, NULL, NULL, &reqdSize);\r
-        if (reqdSize) {\r
-            ppPaths[index] = malloc(reqdSize);\r
-            if (ppPaths[index]) {\r
-                RegQueryValueEx(subKey, NULL, 0, NULL,\r
-                                (LPBYTE)ppPaths[index],\r
-                                &reqdSize);\r
-                dataSize += reqdSize + 1; /* 1 for the ";" */\r
-            }\r
-        }\r
-        RegCloseKey(subKey);\r
-    }\r
-\r
-    /* return null if no path to return */\r
-    if (dataSize == 0) goto done;\r
-\r
-    /* original datasize from RegQueryInfo doesn't include the \0 */\r
-    dataBuf = malloc((dataSize+1) * sizeof(TCHAR));\r
-    if (dataBuf) {\r
-        TCHAR *szCur = dataBuf;\r
-        DWORD reqdSize = dataSize;\r
-        /* Copy our collected strings */\r
-        for (index=0;index<numKeys;index++) {\r
-            if (index > 0) {\r
-                *(szCur++) = _T(';');\r
-                dataSize--;\r
-            }\r
-            if (ppPaths[index]) {\r
-                Py_ssize_t len = _tcslen(ppPaths[index]);\r
-                _tcsncpy(szCur, ppPaths[index], len);\r
-                szCur += len;\r
-                assert(dataSize > (DWORD)len);\r
-                dataSize -= (DWORD)len;\r
-            }\r
-        }\r
-        if (skipcore)\r
-            *szCur = '\0';\r
-        else {\r
-            /* If we have no values, we dont need a ';' */\r
-            if (numKeys) {\r
-                *(szCur++) = _T(';');\r
-                dataSize--;\r
-            }\r
-            /* Now append the core path entries -\r
-               this will include the NULL\r
-            */\r
-            rc = RegQueryValueEx(newKey, NULL, 0, NULL,\r
-                                 (LPBYTE)szCur, &dataSize);\r
-        }\r
-        /* And set the result - caller must free\r
-           If MBCS, it is fine as is.  If Unicode, allocate new\r
-           buffer and convert.\r
-        */\r
-#ifdef UNICODE\r
-        retval = (char *)malloc(reqdSize+1);\r
-        if (retval)\r
-            WideCharToMultiByte(CP_ACP, 0,\r
-                            dataBuf, -1, /* source */\r
-                    retval, reqdSize+1, /* dest */\r
-                    NULL, NULL);\r
-        free(dataBuf);\r
-#else\r
-        retval = dataBuf;\r
-#endif\r
-    }\r
-done:\r
-    /* Loop freeing my temp buffers */\r
-    if (ppPaths) {\r
-        for(index=0;index<numKeys;index++)\r
-            if (ppPaths[index]) free(ppPaths[index]);\r
-        free(ppPaths);\r
-    }\r
-    if (newKey)\r
-        RegCloseKey(newKey);\r
-    if (keyBuf)\r
-        free(keyBuf);\r
-    return retval;\r
-}\r
-#endif /* Py_ENABLE_SHARED */\r
-#endif /* MS_WINDOWS */\r
-\r
-static void\r
-get_progpath(void)\r
-{\r
-    extern char *Py_GetProgramName(void);\r
-    char *path = getenv("PATH");\r
-    char *prog = Py_GetProgramName();\r
-\r
-#ifdef MS_WINDOWS\r
-    extern HANDLE PyWin_DLLhModule;\r
-#ifdef UNICODE\r
-    WCHAR wprogpath[MAXPATHLEN+1];\r
-    /* Windows documents that GetModuleFileName() will "truncate",\r
-       but makes no mention of the null terminator.  Play it safe.\r
-       PLUS Windows itself defines MAX_PATH as the same, but anyway...\r
-    */\r
-#ifdef Py_ENABLE_SHARED\r
-    wprogpath[MAXPATHLEN]=_T('\0');\r
-    if (PyWin_DLLhModule &&\r
-        GetModuleFileName(PyWin_DLLhModule, wprogpath, MAXPATHLEN)) {\r
-        WideCharToMultiByte(CP_ACP, 0,\r
-                            wprogpath, -1,\r
-                            dllpath, MAXPATHLEN+1,\r
-                            NULL, NULL);\r
-    }\r
-#else\r
-    dllpath[0] = 0;\r
-#endif\r
-    wprogpath[MAXPATHLEN]=_T('\0');\r
-    if (GetModuleFileName(NULL, wprogpath, MAXPATHLEN)) {\r
-        WideCharToMultiByte(CP_ACP, 0,\r
-                            wprogpath, -1,\r
-                            progpath, MAXPATHLEN+1,\r
-                            NULL, NULL);\r
-        return;\r
-    }\r
-#else\r
-    /* static init of progpath ensures final char remains \0 */\r
-#ifdef Py_ENABLE_SHARED\r
-    if (PyWin_DLLhModule)\r
-        if (!GetModuleFileName(PyWin_DLLhModule, dllpath, MAXPATHLEN))\r
-            dllpath[0] = 0;\r
-#else\r
-    dllpath[0] = 0;\r
-#endif\r
-    if (GetModuleFileName(NULL, progpath, MAXPATHLEN))\r
-        return;\r
-#endif\r
-#endif\r
-    if (prog == NULL || *prog == '\0')\r
-        prog = "python";\r
-\r
-    /* If there is no slash in the argv0 path, then we have to\r
-     * assume python is on the user's $PATH, since there's no\r
-     * other way to find a directory to start the search from.  If\r
-     * $PATH isn't exported, you lose.\r
-     */\r
-#ifdef ALTSEP\r
-    if (strchr(prog, SEP) || strchr(prog, ALTSEP))\r
-#else\r
-    if (strchr(prog, SEP))\r
-#endif\r
-        strncpy(progpath, prog, MAXPATHLEN);\r
-    else if (path) {\r
-        while (1) {\r
-            char *delim = strchr(path, DELIM);\r
-\r
-            if (delim) {\r
-                size_t len = delim - path;\r
-                /* ensure we can't overwrite buffer */\r
-                len = MIN(MAXPATHLEN,len);\r
-                strncpy(progpath, path, len);\r
-                *(progpath + len) = '\0';\r
-            }\r
-            else\r
-                strncpy(progpath, path, MAXPATHLEN);\r
-\r
-            /* join() is safe for MAXPATHLEN+1 size buffer */\r
-            join(progpath, prog);\r
-            if (exists(progpath))\r
-                break;\r
-\r
-            if (!delim) {\r
-                progpath[0] = '\0';\r
-                break;\r
-            }\r
-            path = delim + 1;\r
-        }\r
-    }\r
-    else\r
-        progpath[0] = '\0';\r
-}\r
-\r
-static void\r
-calculate_path(void)\r
-{\r
-    char argv0_path[MAXPATHLEN+1];\r
-    char *buf;\r
-    size_t bufsz;\r
-    char *pythonhome = Py_GetPythonHome();\r
-    char *envpath = Py_GETENV("PYTHONPATH");\r
-\r
-#ifdef MS_WINDOWS\r
-    int skiphome, skipdefault;\r
-    char *machinepath = NULL;\r
-    char *userpath = NULL;\r
-    char zip_path[MAXPATHLEN+1];\r
-    size_t len;\r
-#endif\r
-\r
-    get_progpath();\r
-    /* progpath guaranteed \0 terminated in MAXPATH+1 bytes. */\r
-    strcpy(argv0_path, progpath);\r
-    reduce(argv0_path);\r
-    if (pythonhome == NULL || *pythonhome == '\0') {\r
-        if (search_for_prefix(argv0_path, LANDMARK))\r
-            pythonhome = prefix;\r
-        else\r
-            pythonhome = NULL;\r
-    }\r
-    else\r
-        strncpy(prefix, pythonhome, MAXPATHLEN);\r
-\r
-    if (envpath && *envpath == '\0')\r
-        envpath = NULL;\r
-\r
-\r
-#ifdef MS_WINDOWS\r
-    /* Calculate zip archive path */\r
-    if (dllpath[0])             /* use name of python DLL */\r
-        strncpy(zip_path, dllpath, MAXPATHLEN);\r
-    else                        /* use name of executable program */\r
-        strncpy(zip_path, progpath, MAXPATHLEN);\r
-    zip_path[MAXPATHLEN] = '\0';\r
-    len = strlen(zip_path);\r
-    if (len > 4) {\r
-        zip_path[len-3] = 'z';          /* change ending to "zip" */\r
-        zip_path[len-2] = 'i';\r
-        zip_path[len-1] = 'p';\r
-    }\r
-    else {\r
-        zip_path[0] = 0;\r
-    }\r
-\r
-    skiphome = pythonhome==NULL ? 0 : 1;\r
-#ifdef Py_ENABLE_SHARED\r
-    machinepath = getpythonregpath(HKEY_LOCAL_MACHINE, skiphome);\r
-    userpath = getpythonregpath(HKEY_CURRENT_USER, skiphome);\r
-#endif\r
-    /* We only use the default relative PYTHONPATH if we havent\r
-       anything better to use! */\r
-    skipdefault = envpath!=NULL || pythonhome!=NULL || \\r
-                  machinepath!=NULL || userpath!=NULL;\r
-#endif\r
-\r
-    /* We need to construct a path from the following parts.\r
-       (1) the PYTHONPATH environment variable, if set;\r
-       (2) for Win32, the zip archive file path;\r
-       (3) for Win32, the machinepath and userpath, if set;\r
-       (4) the PYTHONPATH config macro, with the leading "."\r
-           of each component replaced with pythonhome, if set;\r
-       (5) the directory containing the executable (argv0_path).\r
-       The length calculation calculates #4 first.\r
-       Extra rules:\r
-       - If PYTHONHOME is set (in any way) item (3) is ignored.\r
-       - If registry values are used, (4) and (5) are ignored.\r
-    */\r
-\r
-    /* Calculate size of return buffer */\r
-    if (pythonhome != NULL) {\r
-        char *p;\r
-        bufsz = 1;\r
-        for (p = PYTHONPATH; *p; p++) {\r
-            if (*p == DELIM)\r
-                bufsz++; /* number of DELIM plus one */\r
-        }\r
-        bufsz *= strlen(pythonhome);\r
-    }\r
-    else\r
-        bufsz = 0;\r
-    bufsz += strlen(PYTHONPATH) + 1;\r
-    bufsz += strlen(argv0_path) + 1;\r
-#ifdef MS_WINDOWS\r
-    if (userpath)\r
-        bufsz += strlen(userpath) + 1;\r
-    if (machinepath)\r
-        bufsz += strlen(machinepath) + 1;\r
-    bufsz += strlen(zip_path) + 1;\r
-#endif\r
-    if (envpath != NULL)\r
-        bufsz += strlen(envpath) + 1;\r
-\r
-    module_search_path = buf = malloc(bufsz);\r
-    if (buf == NULL) {\r
-        /* We can't exit, so print a warning and limp along */\r
-        fprintf(stderr, "Can't malloc dynamic PYTHONPATH.\n");\r
-        if (envpath) {\r
-            fprintf(stderr, "Using environment $PYTHONPATH.\n");\r
-            module_search_path = envpath;\r
-        }\r
-        else {\r
-            fprintf(stderr, "Using default static path.\n");\r
-            module_search_path = PYTHONPATH;\r
-        }\r
-#ifdef MS_WINDOWS\r
-        if (machinepath)\r
-            free(machinepath);\r
-        if (userpath)\r
-            free(userpath);\r
-#endif /* MS_WINDOWS */\r
-        return;\r
-    }\r
-\r
-    if (envpath) {\r
-        strcpy(buf, envpath);\r
-        buf = strchr(buf, '\0');\r
-        *buf++ = DELIM;\r
-    }\r
-#ifdef MS_WINDOWS\r
-    if (zip_path[0]) {\r
-        strcpy(buf, zip_path);\r
-        buf = strchr(buf, '\0');\r
-        *buf++ = DELIM;\r
-    }\r
-    if (userpath) {\r
-        strcpy(buf, userpath);\r
-        buf = strchr(buf, '\0');\r
-        *buf++ = DELIM;\r
-        free(userpath);\r
-    }\r
-    if (machinepath) {\r
-        strcpy(buf, machinepath);\r
-        buf = strchr(buf, '\0');\r
-        *buf++ = DELIM;\r
-        free(machinepath);\r
-    }\r
-    if (pythonhome == NULL) {\r
-        if (!skipdefault) {\r
-            strcpy(buf, PYTHONPATH);\r
-            buf = strchr(buf, '\0');\r
-        }\r
-    }\r
-#else\r
-    if (pythonhome == NULL) {\r
-        strcpy(buf, PYTHONPATH);\r
-        buf = strchr(buf, '\0');\r
-    }\r
-#endif /* MS_WINDOWS */\r
-    else {\r
-        char *p = PYTHONPATH;\r
-        char *q;\r
-        size_t n;\r
-        for (;;) {\r
-            q = strchr(p, DELIM);\r
-            if (q == NULL)\r
-                n = strlen(p);\r
-            else\r
-                n = q-p;\r
-            if (p[0] == '.' && is_sep(p[1])) {\r
-                strcpy(buf, pythonhome);\r
-                buf = strchr(buf, '\0');\r
-                p++;\r
-                n--;\r
-            }\r
-            strncpy(buf, p, n);\r
-            buf += n;\r
-            if (q == NULL)\r
-                break;\r
-            *buf++ = DELIM;\r
-            p = q+1;\r
-        }\r
-    }\r
-    if (argv0_path) {\r
-        *buf++ = DELIM;\r
-        strcpy(buf, argv0_path);\r
-        buf = strchr(buf, '\0');\r
-    }\r
-    *buf = '\0';\r
-    /* Now to pull one last hack/trick.  If sys.prefix is\r
-       empty, then try and find it somewhere on the paths\r
-       we calculated.  We scan backwards, as our general policy\r
-       is that Python core directories are at the *end* of\r
-       sys.path.  We assume that our "lib" directory is\r
-       on the path, and that our 'prefix' directory is\r
-       the parent of that.\r
-    */\r
-    if (*prefix=='\0') {\r
-        char lookBuf[MAXPATHLEN+1];\r
-        char *look = buf - 1; /* 'buf' is at the end of the buffer */\r
-        while (1) {\r
-            Py_ssize_t nchars;\r
-            char *lookEnd = look;\r
-            /* 'look' will end up one character before the\r
-               start of the path in question - even if this\r
-               is one character before the start of the buffer\r
-            */\r
-            while (look >= module_search_path && *look != DELIM)\r
-                look--;\r
-            nchars = lookEnd-look;\r
-            strncpy(lookBuf, look+1, nchars);\r
-            lookBuf[nchars] = '\0';\r
-            /* Up one level to the parent */\r
-            reduce(lookBuf);\r
-            if (search_for_prefix(lookBuf, LANDMARK)) {\r
-                break;\r
-            }\r
-            /* If we are out of paths to search - give up */\r
-            if (look < module_search_path)\r
-                break;\r
-            look--;\r
-        }\r
-    }\r
-}\r
-\r
-\r
-/* External interface */\r
-\r
-char *\r
-Py_GetPath(void)\r
-{\r
-    if (!module_search_path)\r
-        calculate_path();\r
-    return module_search_path;\r
-}\r
-\r
-char *\r
-Py_GetPrefix(void)\r
-{\r
-    if (!module_search_path)\r
-        calculate_path();\r
-    return prefix;\r
-}\r
-\r
-char *\r
-Py_GetExecPrefix(void)\r
-{\r
-    return Py_GetPrefix();\r
-}\r
-\r
-char *\r
-Py_GetProgramFullPath(void)\r
-{\r
-    if (!module_search_path)\r
-        calculate_path();\r
-    return progpath;\r
-}\r
index 25152ec0329a21d8b5afb0641e2472c54c6321e7..866c0f0b13d05a7033a6c62bec248e88e6860bc7 100644 (file)
@@ -1,14 +1,25 @@
-/*  @file\r
+/** @file\r
     Manually generated Python Configuration file for EDK II.\r
-*/\r
+\r
+    Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+    This program and the accompanying materials are licensed and made available under\r
+    the terms and conditions of the BSD License that accompanies this distribution.\r
+    The full text of the license may be found at\r
+    http://opensource.org/licenses/bsd-license.\r
+\r
+    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
 \r
 \r
 #ifndef Py_PYCONFIG_H\r
 #define Py_PYCONFIG_H\r
 \r
-#ifndef PYTHONPATH\r
-# define PYTHONPATH "/Efi/Python;/Efi/Python/Lib"\r
-#endif\r
+#define PLATFORM    "UEFI 2.3 Ia32"\r
+\r
+//#ifndef PYTHONPATH\r
+//# define PYTHONPATH "/Efi/StdLib/lib/python.27;/Efi/StdLib/lib/python.27/lib-dynload"\r
+//#endif\r
 \r
 /* Define if building universal (internal helper macro) */\r
 #undef AC_APPLE_UNIVERSAL_BUILD\r
 #undef HAVE_GETADDRINFO\r
 \r
 /* Define to 1 if you have the `getcwd' function. */\r
-#undef HAVE_GETCWD\r
+#define HAVE_GETCWD   1\r
 \r
 /* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */\r
 #undef HAVE_GETC_UNLOCKED\r
 #undef HAVE_KQUEUE\r
 \r
 /* Define to 1 if you have the <langinfo.h> header file. */\r
-#define HAVE_LANGINFO_H   1\r
+#undef HAVE_LANGINFO_H   /* non-functional in EFI. */\r
 \r
 /* Defined to enable large file support when an off_t is bigger than a long\r
    and long long is available and at least as big as an off_t. You may need to\r
 #undef HAVE_SETUID\r
 \r
 /* Define to 1 if you have the `setvbuf' function. */\r
-#undef HAVE_SETVBUF\r
+#define HAVE_SETVBUF    1\r
 \r
 /* Define to 1 if you have the <shadow.h> header file. */\r
 #undef HAVE_SHADOW_H\r
 #undef HAVE_SPAWN_H\r
 \r
 /* Define if your compiler provides ssize_t */\r
-#undef HAVE_SSIZE_T\r
+#define HAVE_SSIZE_T    1\r
 \r
 /* Define to 1 if you have the `statvfs' function. */\r
 #undef HAVE_STATVFS\r
 \r
 /* Define if your compiler supports variable length function prototypes (e.g.\r
    void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */\r
-#define HAVE_STDARG_PROTOTYPES    1\r
+#define HAVE_STDARG_PROTOTYPES          1\r
 \r
 /* Define to 1 if you have the <stdint.h> header file. */\r
-#define HAVE_STDINT_H   1\r
+#define HAVE_STDINT_H                   1\r
 \r
 /* Define to 1 if you have the <stdlib.h> header file. */\r
-#define HAVE_STDLIB_H   1\r
+#define HAVE_STDLIB_H                   1\r
 \r
 /* Define to 1 if you have the `strdup' function. */\r
-#define HAVE_STRDUP     1\r
+#define HAVE_STRDUP                     1\r
 \r
 /* Define to 1 if you have the `strftime' function. */\r
-#define HAVE_STRFTIME   1\r
+#define HAVE_STRFTIME                   1\r
 \r
 /* Define to 1 if you have the <strings.h> header file. */\r
 #undef HAVE_STRINGS_H\r
 \r
 /* Define to 1 if you have the <string.h> header file. */\r
-#define HAVE_STRING_H   1\r
+#define HAVE_STRING_H                   1\r
 \r
 /* Define to 1 if you have the <stropts.h> header file. */\r
 #undef HAVE_STROPTS_H\r
 #undef HAVE_SYS_NDIR_H\r
 \r
 /* Define to 1 if you have the <sys/param.h> header file. */\r
-#define HAVE_SYS_PARAM_H    1\r
+#define HAVE_SYS_PARAM_H                1\r
 \r
 /* Define to 1 if you have the <sys/poll.h> header file. */\r
-#define HAVE_SYS_POLL_H     1\r
+#define HAVE_SYS_POLL_H                 1\r
 \r
 /* Define to 1 if you have the <sys/resource.h> header file. */\r
-#define HAVE_SYS_RESOURCE_H   1\r
+#define HAVE_SYS_RESOURCE_H             1\r
 \r
 /* Define to 1 if you have the <sys/select.h> header file. */\r
-#define HAVE_SYS_SELECT_H     1\r
+#define HAVE_SYS_SELECT_H               1\r
 \r
 /* Define to 1 if you have the <sys/socket.h> header file. */\r
-#define HAVE_SYS_SOCKET_H     1\r
+#define HAVE_SYS_SOCKET_H               1\r
 \r
 /* Define to 1 if you have the <sys/statvfs.h> header file. */\r
 #undef HAVE_SYS_STATVFS_H\r
 \r
 /* Define to 1 if you have the <sys/stat.h> header file. */\r
-#define HAVE_SYS_STAT_H   1\r
+#define HAVE_SYS_STAT_H                 1\r
 \r
 /* Define to 1 if you have the <sys/termio.h> header file. */\r
 #undef HAVE_SYS_TERMIO_H\r
 #undef HAVE_SYS_TIMES_H\r
 \r
 /* Define to 1 if you have the <sys/time.h> header file. */\r
-#define HAVE_SYS_TIME_H     1\r
+#define HAVE_SYS_TIME_H                 1\r
 \r
 /* Define to 1 if you have the <sys/types.h> header file. */\r
-#define HAVE_SYS_TYPES_H    1\r
+#define HAVE_SYS_TYPES_H                1\r
 \r
 /* Define to 1 if you have the <sys/un.h> header file. */\r
 #undef HAVE_SYS_UN_H\r
 #undef HAVE_TCSETPGRP\r
 \r
 /* Define to 1 if you have the `tempnam' function. */\r
-#define HAVE_TEMPNAM      1\r
+#define HAVE_TEMPNAM                    1\r
 \r
 /* Define to 1 if you have the <termios.h> header file. */\r
-#define HAVE_TERMIOS_H    1\r
+#define HAVE_TERMIOS_H                  1\r
 \r
 /* Define to 1 if you have the <term.h> header file. */\r
 #undef HAVE_TERM_H\r
 #undef HAVE_TIMES\r
 \r
 /* Define to 1 if you have the `tmpfile' function. */\r
-#define HAVE_TMPFILE    1\r
+#define HAVE_TMPFILE                    1\r
 \r
 /* Define to 1 if you have the `tmpnam' function. */\r
-#define HAVE_TMPNAM     1\r
+#define HAVE_TMPNAM                     1\r
 \r
 /* Define to 1 if you have the `tmpnam_r' function. */\r
 #undef HAVE_TMPNAM_R\r
 #undef HAVE_UCS4_TCL\r
 \r
 /* Define to 1 if the system has the type `uintptr_t'. */\r
-#define HAVE_UINTPTR_T    1\r
+#define HAVE_UINTPTR_T                  1\r
 \r
 /* Define to 1 if you have the `uname' function. */\r
 #undef HAVE_UNAME\r
 \r
 /* Define to 1 if you have the <unistd.h> header file. */\r
-#define HAVE_UNISTD_H     1\r
+#define HAVE_UNISTD_H                   1\r
 \r
 /* Define to 1 if you have the `unsetenv' function. */\r
 #undef HAVE_UNSETENV\r
 /* Define if you have a useable wchar_t type defined in wchar.h; useable means\r
    wchar_t must be an unsigned type with at least 16 bits. (see\r
    Include/unicodeobject.h). */\r
-#define HAVE_USABLE_WCHAR_T   1\r
+#define HAVE_USABLE_WCHAR_T             1\r
 \r
 /* Define to 1 if you have the <util.h> header file. */\r
 #undef HAVE_UTIL_H\r
 #undef MVWDELCH_IS_EXPRESSION\r
 \r
 /* Define to the address where bug reports for this package should be sent. */\r
-#undef PACKAGE_BUGREPORT\r
+#define PACKAGE_BUGREPORT   "edk2-devel@lists.sourceforge.net"\r
 \r
 /* Define to the full name of this package. */\r
-#define PACKAGE_NAME    EDK II Python Package\r
+#define PACKAGE_NAME    "EDK II Python Package"\r
 \r
 /* Define to the full name and version of this package. */\r
-#define PACKAGE_STRING  EDK II Python Package V0.1\r
+#define PACKAGE_STRING  "EDK II Python Package V0.2"\r
 \r
 /* Define to the one symbol short name of this package. */\r
-#define PACKAGE_TARNAME   UDK_Python\r
+#define PACKAGE_TARNAME   "EADK_Python"\r
 \r
 /* Define to the home page for this package. */\r
-#define PACKAGE_URL   http://edk2.tianocore.org/toolkit/python\r
+#define PACKAGE_URL   "http://edk2.tianocore.org/toolkit/python"\r
 \r
 /* Define to the version of this package. */\r
-#define PACKAGE_VERSION  V0.1\r
+#define PACKAGE_VERSION  "V0.2"\r
 \r
 /* Define if POSIX semaphores aren't enabled on your system */\r
 #define POSIX_SEMAPHORES_NOT_ENABLED    1\r
 #define SIZEOF_FLOAT      4\r
 \r
 /* The size of `fpos_t', as computed by sizeof. */\r
-#undef SIZEOF_FPOS_T\r
+#define SIZEOF_FPOS_T     8\r
 \r
 /* The size of `int', as computed by sizeof. */\r
 #define SIZEOF_INT        4\r
 #define SIZEOF_OFF_T      4\r
 \r
 /* The size of `pid_t', as computed by sizeof. */\r
-#undef SIZEOF_PID_T\r
+#define SIZEOF_PID_T      4\r
 \r
 /* The size of `pthread_t', as computed by sizeof. */\r
 #undef SIZEOF_PTHREAD_T\r
 #define SIZEOF__BOOL      1\r
 \r
 /* Define to 1 if you have the ANSI C header files. */\r
-#define STDC_HEADERS    1\r
+#define STDC_HEADERS      1\r
 \r
 /* Define if you can safely include both <sys/select.h> and <sys/time.h>\r
    (which you can't on SCO ODT 3.0). */\r
 /* Define to empty if the keyword does not work. */\r
 //#undef volatile\r
 \r
-\r
-/* Define the macros needed if on a UnixWare 7.x system. */\r
-#if defined(__USLC__) && defined(__SCO_VERSION__)\r
-#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */\r
-#endif\r
-\r
 #endif /*Py_PYCONFIG_H*/\r
-\r
index c5d15b13524dbcfb1f2a3a05919dd31a489b0cf6..f1fdde244922e8d5e622ed78641e11b0d0d4aefe 100644 (file)
@@ -1,3 +1,15 @@
+/** @file\r
+    File object interface.\r
+\r
+    Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+    This program and the accompanying materials are licensed and made available under\r
+    the terms and conditions of the BSD License that accompanies this distribution.\r
+    The full text of the license may be found at\r
+    http://opensource.org/licenses/bsd-license.\r
+\r
+    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
 \r
 /* File object interface */\r
 \r
diff --git a/AppPkg/Applications/Python/PyMod-2.7.2/Include/osdefs.h b/AppPkg/Applications/Python/PyMod-2.7.2/Include/osdefs.h
new file mode 100644 (file)
index 0000000..4d25a8f
--- /dev/null
@@ -0,0 +1,70 @@
+/** @file\r
+    Operating system dependencies.\r
+\r
+    Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+    This program and the accompanying materials are licensed and made available under\r
+    the terms and conditions of the BSD License that accompanies this distribution.\r
+    The full text of the license may be found at\r
+    http://opensource.org/licenses/bsd-license.\r
+\r
+    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
+#ifndef Py_OSDEFS_H\r
+#define Py_OSDEFS_H\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+\r
+/* Mod by chrish: QNX has WATCOM, but isn't DOS */\r
+#if !defined(__QNX__) && !defined(EFIAPI)\r
+#if defined(MS_WINDOWS) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__) || defined(PYOS_OS2)\r
+#if defined(PYOS_OS2) && defined(PYCC_GCC)\r
+#define MAXPATHLEN 260\r
+#define SEP '/'\r
+#define ALTSEP '\\'\r
+#else\r
+#define SEP '\\'\r
+#define ALTSEP '/'\r
+#define MAXPATHLEN 256\r
+#endif\r
+#define DELIM ';'\r
+#endif\r
+#endif\r
+\r
+#ifdef RISCOS\r
+#define SEP '.'\r
+#define MAXPATHLEN 256\r
+#define DELIM ','\r
+#endif\r
+\r
+\r
+/* Filename separator */\r
+#ifndef SEP\r
+#define SEP     '/'\r
+#define ALTSEP  '\\'\r
+#endif\r
+\r
+/* Max pathname length */\r
+#ifndef MAXPATHLEN\r
+#if defined(PATH_MAX) && PATH_MAX > 1024\r
+#define MAXPATHLEN PATH_MAX\r
+#else\r
+#define MAXPATHLEN 1024\r
+#endif\r
+#endif\r
+\r
+/* Search path entry delimiter */\r
+#ifndef DELIM\r
+  #ifdef  EFIAPI\r
+    #define DELIM   ';'\r
+  #else\r
+    #define DELIM   ':'\r
+  #endif\r
+#endif\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+#endif /* !Py_OSDEFS_H */\r
index 4c6eef0aef6f13ec40ad0baa7a9ff89945bdda27..d1494d397156a626a1689db48a4264bf3748242b 100644 (file)
@@ -1,3 +1,16 @@
+/** @file\r
+    Symbols and macros to supply platform-independent interfaces to basic\r
+    C language & library operations whose spellings vary across platforms.\r
+\r
+    Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+    This program and the accompanying materials are licensed and made available under\r
+    the terms and conditions of the BSD License that accompanies this distribution.\r
+    The full text of the license may be found at\r
+    http://opensource.org/licenses/bsd-license.\r
+\r
+    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
 #ifndef Py_PYPORT_H\r
 #define Py_PYPORT_H\r
 \r
index ec723cc675c5074dea7cff16e5b4455442866fe2..3bad9910d2ea7fa26e081d0f97eafcb4829ee7d0 100644 (file)
@@ -2,6 +2,15 @@
  * Secret Labs' Regular Expression Engine\r
  *\r
  * regular expression matching engine\r
+\r
+    Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+    This program and the accompanying materials are licensed and made available under\r
+    the terms and conditions of the BSD License that accompanies this distribution.\r
+    The full text of the license may be found at\r
+    http://opensource.org/licenses/bsd-license.\r
+\r
+    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
  *\r
  * partial history:\r
  * 1999-10-24 fl  created (based on existing template matcher code)\r
index 4cee6218b8fde86b6917d2c38a622e5aef15080b..46f89878d6f15c6cf1482090e28f05483d533da9 100644 (file)
@@ -1,4 +1,14 @@
 /* zutil.h -- internal interface and configuration of the compression library\r
+\r
+    Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+    This program and the accompanying materials are licensed and made available under\r
+    the terms and conditions of the BSD License that accompanies this distribution.\r
+    The full text of the license may be found at\r
+    http://opensource.org/licenses/bsd-license.\r
+\r
+    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
  * Copyright (C) 1995-2005 Jean-loup Gailly.\r
  * For conditions of distribution and use, see copyright notice in zlib.h\r
  */\r
index 1fbc675f13b78e4c4f804619d7245563804e5d14..2552e99ddbd78bbceefc0a978fed6ce26edff002 100644 (file)
@@ -1,4 +1,15 @@
-/* Long (arbitrary precision) integer object implementation */\r
+/** @file\r
+    Long (arbitrary precision) integer object implementation.\r
+\r
+    Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+    This program and the accompanying materials are licensed and made available under\r
+    the terms and conditions of the BSD License that accompanies this distribution.\r
+    The full text of the license may be found at\r
+    http://opensource.org/licenses/bsd-license.\r
+\r
+    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
 \r
 /* XXX The functional organization of this file is terrible */\r
 \r
index 25b7f6fbd7e4cfdba415a8fdd453eb977a330ab1..45c980c6a89a859b2430960be98b0b62899075ca 100644 (file)
@@ -1,4 +1,15 @@
-/* stringlib: locale related helpers implementation */\r
+/** @file\r
+    stringlib: locale related helpers implementation.\r
+\r
+    Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+    This program and the accompanying materials are licensed and made available under\r
+    the terms and conditions of the BSD License that accompanies this distribution.\r
+    The full text of the license may be found at\r
+    http://opensource.org/licenses/bsd-license.\r
+\r
+    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
 \r
 #ifndef STRINGLIB_LOCALEUTIL_H\r
 #define STRINGLIB_LOCALEUTIL_H\r
index 785f4389ba938a2c9ba1d139ea65afe69f0d985c..153bc13a11f3846152d015afcc9826068d4a3b10 100644 (file)
@@ -1,8 +1,18 @@
-\r
-/* Write Python objects to files and read them back.\r
-   This is intended for writing and reading compiled Python code only;\r
-   a true persistent storage facility would be much harder, since\r
-   it would have to take circular links and sharing into account. */\r
+/** @file\r
+    Write Python objects to files and read them back.\r
+    This is intended for writing and reading compiled Python code only;\r
+    a true persistent storage facility would be much harder, since\r
+    it would have to take circular links and sharing into account.\r
+\r
+    Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+    This program and the accompanying materials are licensed and made available under\r
+    the terms and conditions of the BSD License that accompanies this distribution.\r
+    The full text of the license may be found at\r
+    http://opensource.org/licenses/bsd-license.\r
+\r
+    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
 \r
 #define PY_SSIZE_T_CLEAN\r
 \r
index 31e5442445f0e5afcfbdae911d7d57e30b6c30ce..d3834ccbfe455158f4cd039adf4d8119b10f6595 100644 (file)
@@ -1,8 +1,6 @@
 ## @file\r
 # PythonCore.inf\r
 #\r
-# Uses include files from Python-2.7.1/Include\r
-#\r
 #  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 ##\r
 \r
 [Defines]\r
-  INF_VERSION                    = 0x00010006\r
-  BASE_NAME                      = Python\r
-  FILE_GUID                      = ca5627c4-51ba-4dcb-ac62-c076ebd37ddb\r
-  MODULE_TYPE                    = UEFI_APPLICATION\r
-  VERSION_STRING                 = 0.1\r
-  ENTRY_POINT                    = ShellCEntryLib\r
+  INF_VERSION                 = 0x00010006\r
+  BASE_NAME                   = Python\r
+  FILE_GUID                   = ca5627c4-51ba-4dcb-ac62-c076ebd37ddb\r
+  MODULE_TYPE                 = UEFI_APPLICATION\r
+  VERSION_STRING              = 0.1\r
+  ENTRY_POINT                 = ShellCEntryLib\r
+  PYTHON_VERSION              = 2.7.2\r
 \r
 #\r
-#  VALID_ARCHITECTURES           = IA32 X64 IPF\r
+#  VALID_ARCHITECTURES        = IA32 X64 IPF\r
 #\r
 \r
 [Packages]\r
   DevShell\r
 \r
 [Sources]\r
-  Python-2.7.1/Modules/python.c\r
-  Python-2.7.1/Modules/getbuildinfo.c\r
+#EFI -- EFI specific code\r
+  Efi/config.c\r
+  Efi/getpath.c\r
 \r
 #Parser\r
-  Python-2.7.1/Parser/acceler.c\r
-  Python-2.7.1/Parser/bitset.c\r
-  Python-2.7.1/Parser/firstsets.c\r
-  Python-2.7.1/Parser/grammar.c\r
-  Python-2.7.1/Parser/grammar1.c\r
-  Python-2.7.1/Parser/listnode.c\r
-  Python-2.7.1/Parser/metagrammar.c\r
-  Python-2.7.1/Parser/myreadline.c\r
-  Python-2.7.1/Parser/node.c\r
-  Python-2.7.1/Parser/parser.c\r
-  Python-2.7.1/Parser/parsetok.c\r
-  Python-2.7.1/Parser/tokenizer.c\r
+  Python-$(PYTHON_VERSION)/Parser/acceler.c\r
+  Python-$(PYTHON_VERSION)/Parser/bitset.c\r
+  Python-$(PYTHON_VERSION)/Parser/firstsets.c\r
+  Python-$(PYTHON_VERSION)/Parser/grammar.c\r
+  Python-$(PYTHON_VERSION)/Parser/grammar1.c\r
+  Python-$(PYTHON_VERSION)/Parser/listnode.c\r
+  Python-$(PYTHON_VERSION)/Parser/metagrammar.c\r
+  Python-$(PYTHON_VERSION)/Parser/myreadline.c\r
+  Python-$(PYTHON_VERSION)/Parser/node.c\r
+  Python-$(PYTHON_VERSION)/Parser/parser.c\r
+  Python-$(PYTHON_VERSION)/Parser/parsetok.c\r
+  Python-$(PYTHON_VERSION)/Parser/tokenizer.c\r
 \r
 #Python\r
-  Python-2.7.1/Python/_warnings.c\r
-  Python-2.7.1/Python/asdl.c\r
-  Python-2.7.1/Python/ast.c\r
-  Python-2.7.1/Python/bltinmodule.c\r
-  Python-2.7.1/Python/ceval.c\r
-  Python-2.7.1/Python/codecs.c\r
-  Python-2.7.1/Python/compile.c\r
-  Python-2.7.1/Python/dtoa.c\r
-  Python-2.7.1/Python/dynload_stub.c            # Change from dynload_win.c\r
-  Python-2.7.1/Python/errors.c\r
-  Python-2.7.1/Python/formatter_string.c\r
-  Python-2.7.1/Python/formatter_unicode.c\r
-  Python-2.7.1/Python/frozen.c\r
-  Python-2.7.1/Python/future.c\r
-  Python-2.7.1/Python/getargs.c\r
-  Python-2.7.1/Python/getcompiler.c\r
-  Python-2.7.1/Python/getcopyright.c\r
-  Python-2.7.1/Python/getopt.c\r
-  Python-2.7.1/Python/getplatform.c\r
-  Python-2.7.1/Python/getversion.c\r
-  Python-2.7.1/Python/graminit.c\r
-  Python-2.7.1/Python/import.c\r
-  Python-2.7.1/Python/importdl.c\r
-  Python-2.7.1/Python/marshal.c\r
-  Python-2.7.1/Python/modsupport.c\r
-  Python-2.7.1/Python/mysnprintf.c\r
-  Python-2.7.1/Python/mystrtoul.c\r
-  Python-2.7.1/Python/peephole.c\r
-  Python-2.7.1/Python/pyarena.c\r
-  Python-2.7.1/Python/pyctype.c\r
-  Python-2.7.1/Python/pyfpe.c\r
-  Python-2.7.1/Python/pymath.c\r
-  Python-2.7.1/Python/pystate.c\r
-  Python-2.7.1/Python/pystrcmp.c\r
-  Python-2.7.1/Python/pystrtod.c\r
-  Python-2.7.1/Python/Python-ast.c\r
-  Python-2.7.1/Python/pythonrun.c\r
-  Python-2.7.1/Python/structmember.c\r
-  Python-2.7.1/Python/symtable.c\r
-  Python-2.7.1/Python/sysmodule.c\r
-  Python-2.7.1/Python/traceback.c\r
-#  Python-2.7.1/Python/thread.c\r
+  Python-$(PYTHON_VERSION)/Python/_warnings.c\r
+  Python-$(PYTHON_VERSION)/Python/asdl.c\r
+  Python-$(PYTHON_VERSION)/Python/ast.c\r
+  Python-$(PYTHON_VERSION)/Python/bltinmodule.c\r
+  Python-$(PYTHON_VERSION)/Python/ceval.c\r
+  Python-$(PYTHON_VERSION)/Python/codecs.c\r
+  Python-$(PYTHON_VERSION)/Python/compile.c\r
+  Python-$(PYTHON_VERSION)/Python/dtoa.c\r
+  Python-$(PYTHON_VERSION)/Python/dynload_stub.c\r
+  Python-$(PYTHON_VERSION)/Python/errors.c\r
+  Python-$(PYTHON_VERSION)/Python/formatter_string.c\r
+  Python-$(PYTHON_VERSION)/Python/formatter_unicode.c\r
+  Python-$(PYTHON_VERSION)/Python/frozen.c\r
+  Python-$(PYTHON_VERSION)/Python/future.c\r
+  Python-$(PYTHON_VERSION)/Python/getargs.c\r
+  Python-$(PYTHON_VERSION)/Python/getcompiler.c\r
+  Python-$(PYTHON_VERSION)/Python/getcopyright.c\r
+  Python-$(PYTHON_VERSION)/Python/getopt.c\r
+  Python-$(PYTHON_VERSION)/Python/getplatform.c\r
+  Python-$(PYTHON_VERSION)/Python/getversion.c\r
+  Python-$(PYTHON_VERSION)/Python/graminit.c\r
+  Python-$(PYTHON_VERSION)/Python/import.c\r
+  Python-$(PYTHON_VERSION)/Python/importdl.c\r
+  Python-$(PYTHON_VERSION)/Python/marshal.c\r
+  Python-$(PYTHON_VERSION)/Python/modsupport.c\r
+  Python-$(PYTHON_VERSION)/Python/mysnprintf.c\r
+  Python-$(PYTHON_VERSION)/Python/mystrtoul.c\r
+  Python-$(PYTHON_VERSION)/Python/peephole.c\r
+  Python-$(PYTHON_VERSION)/Python/pyarena.c\r
+  Python-$(PYTHON_VERSION)/Python/pyctype.c\r
+  Python-$(PYTHON_VERSION)/Python/pyfpe.c\r
+  Python-$(PYTHON_VERSION)/Python/pymath.c\r
+  Python-$(PYTHON_VERSION)/Python/pystate.c\r
+  Python-$(PYTHON_VERSION)/Python/pystrcmp.c\r
+  Python-$(PYTHON_VERSION)/Python/pystrtod.c\r
+  Python-$(PYTHON_VERSION)/Python/Python-ast.c\r
+  Python-$(PYTHON_VERSION)/Python/pythonrun.c\r
+  Python-$(PYTHON_VERSION)/Python/structmember.c\r
+  Python-$(PYTHON_VERSION)/Python/symtable.c\r
+  Python-$(PYTHON_VERSION)/Python/sysmodule.c\r
+  Python-$(PYTHON_VERSION)/Python/traceback.c\r
+#  Python-$(PYTHON_VERSION)/Python/thread.c\r
 \r
 #Modules -- See Efi/config.c\r
-  Python-2.7.1/Modules/_bisectmodule.c\r
-  Python-2.7.1/Modules/_codecsmodule.c\r
-  Python-2.7.1/Modules/_collectionsmodule.c\r
-  Python-2.7.1/Modules/_csv.c\r
-  Python-2.7.1/Modules/_functoolsmodule.c\r
-  Python-2.7.1/Modules/_heapqmodule.c\r
-#  Python-2.7.1/Modules/_hotshot.c\r
-  Python-2.7.1/Modules/_json.c\r
-#  Python-2.7.1/Modules/_localemodule.c\r
-#  Python-2.7.1/Modules/_lsprof.c\r
-  Python-2.7.1/Modules/_math.c\r
-  Python-2.7.1/Modules/_randommodule.c\r
-  Python-2.7.1/Modules/_sre.c\r
-  Python-2.7.1/Modules/_struct.c\r
-#  Python-2.7.1/Modules/_weakref.c\r
-  Python-2.7.1/Modules/arraymodule.c\r
-#  Python-2.7.1/Modules/audioop.c\r
-  Python-2.7.1/Modules/binascii.c\r
-  Python-2.7.1/Modules/cPickle.c\r
-  Python-2.7.1/Modules/cStringIO.c\r
-#  Python-2.7.1/Modules/cmathmodule.c\r
-#  Python-2.7.1/Modules/datetimemodule.c\r
-  Python-2.7.1/Modules/errnomodule.c\r
-  Python-2.7.1/Modules/future_builtins.c\r
-  Python-2.7.1/Modules/gcmodule.c\r
-  Python-2.7.1/Modules/imageop.c\r
-  Python-2.7.1/Modules/itertoolsmodule.c\r
-  Python-2.7.1/Modules/mathmodule.c\r
-  Python-2.7.1/Modules/md5.c\r
-  Python-2.7.1/Modules/md5module.c\r
-#  Python-2.7.1/Modules/mmapmodule.c\r
-  Python-2.7.1/Modules/operator.c\r
-  Python-2.7.1/Modules/parsermodule.c\r
-#  Python-2.7.1/Modules/posixmodule.c\r
-  Python-2.7.1/Modules/signalmodule.c\r
-  Python-2.7.1/Modules/shamodule.c\r
-  Python-2.7.1/Modules/sha256module.c\r
-  Python-2.7.1/Modules/sha512module.c\r
-  Python-2.7.1/Modules/stropmodule.c\r
-  Python-2.7.1/Modules/symtablemodule.c\r
-#  Python-2.7.1/Modules/threadmodule.c\r
-  Python-2.7.1/Modules/timemodule.c\r
-  Python-2.7.1/Modules/xxsubtype.c\r
-#  Python-2.7.1/Modules/zipimport.c\r
-#  Python-2.7.1/Modules/zlibmodule.c\r
+  Python-$(PYTHON_VERSION)/Modules/main.c\r
+  Python-$(PYTHON_VERSION)/Modules/python.c\r
+  Python-$(PYTHON_VERSION)/Modules/getbuildinfo.c\r
+\r
+#  Python-$(PYTHON_VERSION)/Modules/_bisectmodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/_codecsmodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/_collectionsmodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/_csv.c\r
+#  Python-$(PYTHON_VERSION)/Modules/_functoolsmodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/_heapqmodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/_json.c\r
+#  Python-$(PYTHON_VERSION)/Modules/_math.c\r
+#  Python-$(PYTHON_VERSION)/Modules/_randommodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/_sre.c\r
+#  Python-$(PYTHON_VERSION)/Modules/_struct.c\r
+  Python-$(PYTHON_VERSION)/Modules/arraymodule.c\r
+  Python-$(PYTHON_VERSION)/Modules/binascii.c\r
+#  Python-$(PYTHON_VERSION)/Modules/cPickle.c\r
+#  Python-$(PYTHON_VERSION)/Modules/cStringIO.c\r
+  Python-$(PYTHON_VERSION)/Modules/errnomodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/future_builtins.c\r
+  Python-$(PYTHON_VERSION)/Modules/gcmodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/imageop.c\r
+#  Python-$(PYTHON_VERSION)/Modules/itertoolsmodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/mathmodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/md5.c\r
+#  Python-$(PYTHON_VERSION)/Modules/md5module.c\r
+#  Python-$(PYTHON_VERSION)/Modules/operator.c\r
+  Python-$(PYTHON_VERSION)/Modules/parsermodule.c\r
+  Python-$(PYTHON_VERSION)/Modules/signalmodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/shamodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/sha256module.c\r
+#  Python-$(PYTHON_VERSION)/Modules/sha512module.c\r
+#  Python-$(PYTHON_VERSION)/Modules/stropmodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/symtablemodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/timemodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/xxsubtype.c\r
+\r
+#  Python-$(PYTHON_VERSION)/Modules/_hotshot.c\r
+#  Python-$(PYTHON_VERSION)/Modules/_localemodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/_lsprof.c\r
+#  Python-$(PYTHON_VERSION)/Modules/_weakref.c\r
+#  Python-$(PYTHON_VERSION)/Modules/audioop.c\r
+#  Python-$(PYTHON_VERSION)/Modules/cmathmodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/datetimemodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/mmapmodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/posixmodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/rotatingtree.c\r
+#  Python-$(PYTHON_VERSION)/Modules/threadmodule.c\r
+#  Python-$(PYTHON_VERSION)/Modules/zipimport.c\r
+#  Python-$(PYTHON_VERSION)/Modules/zlibmodule.c\r
 \r
 #Modules/cjkcodecs\r
-  Python-2.7.1/Modules/cjkcodecs/multibytecodec.c\r
-  Python-2.7.1/Modules/cjkcodecs/_codecs_cn.c\r
-  Python-2.7.1/Modules/cjkcodecs/_codecs_hk.c\r
-  Python-2.7.1/Modules/cjkcodecs/_codecs_iso2022.c\r
-  Python-2.7.1/Modules/cjkcodecs/_codecs_jp.c\r
-  Python-2.7.1/Modules/cjkcodecs/_codecs_kr.c\r
-  Python-2.7.1/Modules/cjkcodecs/_codecs_tw.c\r
+#  Python-$(PYTHON_VERSION)/Modules/cjkcodecs/multibytecodec.c\r
+#  Python-$(PYTHON_VERSION)/Modules/cjkcodecs/_codecs_cn.c\r
+#  Python-$(PYTHON_VERSION)/Modules/cjkcodecs/_codecs_hk.c\r
+#  Python-$(PYTHON_VERSION)/Modules/cjkcodecs/_codecs_iso2022.c\r
+#  Python-$(PYTHON_VERSION)/Modules/cjkcodecs/_codecs_jp.c\r
+#  Python-$(PYTHON_VERSION)/Modules/cjkcodecs/_codecs_kr.c\r
+#  Python-$(PYTHON_VERSION)/Modules/cjkcodecs/_codecs_tw.c\r
 \r
-  Python-2.7.1/Modules/main.c\r
-#  Python-2.7.1/Modules/rotatingtree.c\r
 \r
 #Modules/_io\r
-  Python-2.7.1/Modules/_io/_iomodule.c\r
-  Python-2.7.1/Modules/_io/bufferedio.c\r
-  Python-2.7.1/Modules/_io/bytesio.c\r
-  Python-2.7.1/Modules/_io/fileio.c\r
-  Python-2.7.1/Modules/_io/iobase.c\r
-  Python-2.7.1/Modules/_io/stringio.c\r
-  Python-2.7.1/Modules/_io/textio.c\r
+  Python-$(PYTHON_VERSION)/Modules/_io/_iomodule.c\r
+  Python-$(PYTHON_VERSION)/Modules/_io/bufferedio.c\r
+  Python-$(PYTHON_VERSION)/Modules/_io/bytesio.c\r
+  Python-$(PYTHON_VERSION)/Modules/_io/fileio.c\r
+  Python-$(PYTHON_VERSION)/Modules/_io/iobase.c\r
+  Python-$(PYTHON_VERSION)/Modules/_io/stringio.c\r
+  Python-$(PYTHON_VERSION)/Modules/_io/textio.c\r
 \r
 #Modules/zlib\r
-#  Python-2.7.1/Modules/zlib/adler32.c\r
-#  Python-2.7.1/Modules/zlib/compress.c\r
-#  Python-2.7.1/Modules/zlib/crc32.c\r
-#  Python-2.7.1/Modules/zlib/deflate.c\r
-#  Python-2.7.1/Modules/zlib/gzio.c\r
-#  Python-2.7.1/Modules/zlib/infback.c\r
-#  Python-2.7.1/Modules/zlib/inffast.c\r
-#  Python-2.7.1/Modules/zlib/inflate.c\r
-#  Python-2.7.1/Modules/zlib/inftrees.c\r
-#  Python-2.7.1/Modules/zlib/trees.c\r
-#  Python-2.7.1/Modules/zlib/uncompr.c\r
-#  Python-2.7.1/Modules/zlib/zutil.c\r
+#  Python-$(PYTHON_VERSION)/Modules/zlib/adler32.c\r
+#  Python-$(PYTHON_VERSION)/Modules/zlib/compress.c\r
+#  Python-$(PYTHON_VERSION)/Modules/zlib/crc32.c\r
+#  Python-$(PYTHON_VERSION)/Modules/zlib/deflate.c\r
+#  Python-$(PYTHON_VERSION)/Modules/zlib/gzio.c\r
+#  Python-$(PYTHON_VERSION)/Modules/zlib/infback.c\r
+#  Python-$(PYTHON_VERSION)/Modules/zlib/inffast.c\r
+#  Python-$(PYTHON_VERSION)/Modules/zlib/inflate.c\r
+#  Python-$(PYTHON_VERSION)/Modules/zlib/inftrees.c\r
+#  Python-$(PYTHON_VERSION)/Modules/zlib/trees.c\r
+#  Python-$(PYTHON_VERSION)/Modules/zlib/uncompr.c\r
+#  Python-$(PYTHON_VERSION)/Modules/zlib/zutil.c\r
 \r
 #Objects\r
-  Python-2.7.1/Objects/abstract.c\r
-  Python-2.7.1/Objects/boolobject.c\r
-  Python-2.7.1/Objects/bufferobject.c\r
-  Python-2.7.1/Objects/bytearrayobject.c\r
-  Python-2.7.1/Objects/bytes_methods.c\r
-  Python-2.7.1/Objects/capsule.c\r
-  Python-2.7.1/Objects/cellobject.c\r
-  Python-2.7.1/Objects/classobject.c\r
-  Python-2.7.1/Objects/cobject.c\r
-  Python-2.7.1/Objects/codeobject.c\r
-  Python-2.7.1/Objects/complexobject.c\r
-  Python-2.7.1/Objects/descrobject.c\r
-  Python-2.7.1/Objects/dictobject.c\r
-  Python-2.7.1/Objects/enumobject.c\r
-  Python-2.7.1/Objects/exceptions.c\r
-  Python-2.7.1/Objects/fileobject.c\r
-  Python-2.7.1/Objects/floatobject.c\r
-  Python-2.7.1/Objects/frameobject.c\r
-  Python-2.7.1/Objects/funcobject.c\r
-  Python-2.7.1/Objects/genobject.c\r
-  Python-2.7.1/Objects/intobject.c\r
-  Python-2.7.1/Objects/iterobject.c\r
-  Python-2.7.1/Objects/listobject.c\r
-  Python-2.7.1/Objects/longobject.c\r
-  Python-2.7.1/Objects/memoryobject.c\r
-  Python-2.7.1/Objects/methodobject.c\r
-  Python-2.7.1/Objects/moduleobject.c\r
-  Python-2.7.1/Objects/object.c\r
-  Python-2.7.1/Objects/obmalloc.c\r
-  Python-2.7.1/Objects/rangeobject.c\r
-  Python-2.7.1/Objects/setobject.c\r
-  Python-2.7.1/Objects/sliceobject.c\r
-  Python-2.7.1/Objects/stringobject.c\r
-  Python-2.7.1/Objects/structseq.c\r
-  Python-2.7.1/Objects/tupleobject.c\r
-  Python-2.7.1/Objects/typeobject.c\r
-  Python-2.7.1/Objects/unicodectype.c\r
-  Python-2.7.1/Objects/unicodeobject.c\r
-  Python-2.7.1/Objects/weakrefobject.c\r
-\r
-#EFI -- EFI specific code\r
-  Efi/config.c\r
-  Efi/getpathp.c\r
+  Python-$(PYTHON_VERSION)/Objects/abstract.c\r
+  Python-$(PYTHON_VERSION)/Objects/boolobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/bufferobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/bytearrayobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/bytes_methods.c\r
+  Python-$(PYTHON_VERSION)/Objects/capsule.c\r
+  Python-$(PYTHON_VERSION)/Objects/cellobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/classobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/cobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/codeobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/complexobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/descrobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/dictobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/enumobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/exceptions.c\r
+  Python-$(PYTHON_VERSION)/Objects/fileobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/floatobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/frameobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/funcobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/genobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/intobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/iterobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/listobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/longobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/memoryobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/methodobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/moduleobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/object.c\r
+  Python-$(PYTHON_VERSION)/Objects/obmalloc.c\r
+  Python-$(PYTHON_VERSION)/Objects/rangeobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/setobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/sliceobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/stringobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/structseq.c\r
+  Python-$(PYTHON_VERSION)/Objects/tupleobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/typeobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/unicodectype.c\r
+  Python-$(PYTHON_VERSION)/Objects/unicodeobject.c\r
+  Python-$(PYTHON_VERSION)/Objects/weakrefobject.c\r
 \r
 [BuildOptions]\r
-   MSFT:*_*_*_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\Python-2.7.1\Include\r
+   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\r
+   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\r
     GCC:*_*_IPF_SYMRENAME_FLAGS   = --redefine-syms=$WORKSPACE/StdLib/GccSymRename.txt\r
index cad7132c8c2a1a5813b4d65116e8fdd0a6b25a07..41b06827f577bd5f680d7a75e6c43767b832d2d2 100644 (file)
@@ -1,9 +1,25 @@
-/* pyconfig.h.in.  Generated from configure.in by autoheader.  */\r
+/** @file\r
+    Manually generated Python Configuration file for EDK II.\r
+\r
+    Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+    This program and the accompanying materials are licensed and made available under\r
+    the terms and conditions of the BSD License that accompanies this distribution.\r
+    The full text of the license may be found at\r
+    http://opensource.org/licenses/bsd-license.\r
+\r
+    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
 \r
 \r
 #ifndef Py_PYCONFIG_H\r
 #define Py_PYCONFIG_H\r
 \r
+#define PLATFORM    "UEFI 2.3 X64"\r
+\r
+//#ifndef PYTHONPATH\r
+//# define PYTHONPATH "/Efi/StdLib/lib/python.27;/Efi/StdLib/lib/python.27/lib-dynload"\r
+//#endif\r
 \r
 /* Define if building universal (internal helper macro) */\r
 #undef AC_APPLE_UNIVERSAL_BUILD\r
 #undef HAVE_BROKEN_POLL\r
 \r
 /* Define if the Posix semaphores do not work on your system */\r
-#define HAVE_BROKEN_POSIX_SEMAPHORES\r
+#define HAVE_BROKEN_POSIX_SEMAPHORES  1\r
 \r
 /* Define if pthread_sigmask() does not work on your system. */\r
-#define HAVE_BROKEN_PTHREAD_SIGMASK\r
+#define HAVE_BROKEN_PTHREAD_SIGMASK   1\r
 \r
 /* define to 1 if your sem_getvalue is broken. */\r
-#undef HAVE_BROKEN_SEM_GETVALUE\r
+#define HAVE_BROKEN_SEM_GETVALUE      1\r
 \r
 /* Define this if you have the type _Bool. */\r
-#define HAVE_C99_BOOL\r
+#define HAVE_C99_BOOL                 1\r
 \r
 /* Define to 1 if you have the `chflags' function. */\r
 #undef HAVE_CHFLAGS\r
 #undef HAVE_CHROOT\r
 \r
 /* Define to 1 if you have the `clock' function. */\r
-#define HAVE_CLOCK\r
+#define HAVE_CLOCK                    1\r
 \r
 /* Define to 1 if you have the `confstr' function. */\r
 #undef HAVE_CONFSTR\r
 #undef HAVE_CONIO_H\r
 \r
 /* Define to 1 if you have the `copysign' function. */\r
-#define HAVE_COPYSIGN   1\r
+#undef HAVE_COPYSIGN\r
 \r
 /* Define to 1 if you have the `ctermid' function. */\r
 #undef HAVE_CTERMID\r
 #undef HAVE_GAMMA\r
 \r
 /* Define if we can use gcc inline assembler to get and set x87 control word\r
-   */\r
-#undef HAVE_GCC_ASM_FOR_X87\r
+*/\r
+#if defined(__GNUC__)\r
+  #define HAVE_GCC_ASM_FOR_X87  1\r
+#else\r
+  #undef HAVE_GCC_ASM_FOR_X87\r
+#endif\r
 \r
 /* Define if you have the getaddrinfo function. */\r
 #undef HAVE_GETADDRINFO\r
 \r
 /* Define to 1 if you have the `getcwd' function. */\r
-#undef HAVE_GETCWD\r
+#define HAVE_GETCWD   1\r
 \r
 /* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */\r
-#define HAVE_GETC_UNLOCKED\r
+#undef HAVE_GETC_UNLOCKED\r
 \r
 /* Define to 1 if you have the `getgroups' function. */\r
 #undef HAVE_GETGROUPS\r
 #undef HAVE_IEEEFP_H\r
 \r
 /* Define if you have the 'inet_aton' function. */\r
-#undef HAVE_INET_ATON\r
+#define HAVE_INET_ATON    1\r
 \r
 /* Define if you have the 'inet_pton' function. */\r
-#undef HAVE_INET_PTON\r
+#define HAVE_INET_PTON    1\r
 \r
 /* Define to 1 if you have the `initgroups' function. */\r
 #undef HAVE_INITGROUPS\r
 #undef HAVE_KQUEUE\r
 \r
 /* Define to 1 if you have the <langinfo.h> header file. */\r
-#define HAVE_LANGINFO_H   1\r
+#undef HAVE_LANGINFO_H   /* non-functional in EFI. */\r
 \r
 /* Defined to enable large file support when an off_t is bigger than a long\r
    and long long is available and at least as big as an off_t. You may need to\r
 #undef HAVE_LOG1P\r
 \r
 /* Define this if you have the type long double. */\r
-#define HAVE_LONG_DOUBLE\r
+#undef HAVE_LONG_DOUBLE\r
 \r
 /* Define this if you have the type long long. */\r
-#define HAVE_LONG_LONG\r
+#define HAVE_LONG_LONG  1\r
 \r
 /* Define to 1 if you have the `lstat' function. */\r
 #define HAVE_LSTAT      1\r
 #undef HAVE_POLL\r
 \r
 /* Define to 1 if you have the <poll.h> header file. */\r
-#undef HAVE_POLL_H\r
+#define HAVE_POLL_H     1\r
 \r
 /* Define to 1 if you have the <process.h> header file. */\r
 #undef HAVE_PROCESS_H\r
 \r
 /* Define if your compiler supports function prototype */\r
-#define HAVE_PROTOTYPES\r
+#define HAVE_PROTOTYPES   1\r
 \r
 /* Define if you have GNU PTH threads. */\r
 #undef HAVE_PTH\r
 #undef HAVE_SETUID\r
 \r
 /* Define to 1 if you have the `setvbuf' function. */\r
-#undef HAVE_SETVBUF\r
+#define HAVE_SETVBUF    1\r
 \r
 /* Define to 1 if you have the <shadow.h> header file. */\r
 #undef HAVE_SHADOW_H\r
 #undef HAVE_SPAWN_H\r
 \r
 /* Define if your compiler provides ssize_t */\r
-#undef HAVE_SSIZE_T\r
+#define HAVE_SSIZE_T    1\r
 \r
 /* Define to 1 if you have the `statvfs' function. */\r
 #undef HAVE_STATVFS\r
 \r
 /* Define if your compiler supports variable length function prototypes (e.g.\r
    void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */\r
-#define HAVE_STDARG_PROTOTYPES\r
+#define HAVE_STDARG_PROTOTYPES          1\r
 \r
 /* Define to 1 if you have the <stdint.h> header file. */\r
 #define HAVE_STDINT_H   1\r
 #define HAVE_SYS_PARAM_H    1\r
 \r
 /* Define to 1 if you have the <sys/poll.h> header file. */\r
-#undef HAVE_SYS_POLL_H\r
+#define HAVE_SYS_POLL_H                 1\r
 \r
 /* Define to 1 if you have the <sys/resource.h> header file. */\r
 #define HAVE_SYS_RESOURCE_H   1\r
 \r
 /* Define to 1 if you have the <sys/select.h> header file. */\r
-#undef HAVE_SYS_SELECT_H\r
+#define HAVE_SYS_SELECT_H               1\r
 \r
 /* Define to 1 if you have the <sys/socket.h> header file. */\r
-#undef HAVE_SYS_SOCKET_H\r
+#define HAVE_SYS_SOCKET_H               1\r
 \r
 /* Define to 1 if you have the <sys/statvfs.h> header file. */\r
 #undef HAVE_SYS_STATVFS_H\r
 #undef HAVE_UNAME\r
 \r
 /* Define to 1 if you have the <unistd.h> header file. */\r
-#undef HAVE_UNISTD_H\r
+#define HAVE_UNISTD_H                   1\r
 \r
 /* Define to 1 if you have the `unsetenv' function. */\r
 #undef HAVE_UNSETENV\r
 /* Define if you have a useable wchar_t type defined in wchar.h; useable means\r
    wchar_t must be an unsigned type with at least 16 bits. (see\r
    Include/unicodeobject.h). */\r
-#define HAVE_USABLE_WCHAR_T\r
+#define HAVE_USABLE_WCHAR_T             1\r
 \r
 /* Define to 1 if you have the <util.h> header file. */\r
 #undef HAVE_UTIL_H\r
 #undef HAVE_WAITPID\r
 \r
 /* Define if the compiler provides a wchar.h header file. */\r
-#define HAVE_WCHAR_H\r
+#define HAVE_WCHAR_H    1\r
 \r
 /* Define to 1 if you have the `wcscoll' function. */\r
-#undef HAVE_WCSCOLL\r
+#define HAVE_WCSCOLL    1\r
 \r
 /* Define if tzset() actually switches the local timezone in a meaningful way.\r
    */\r
-#define HAVE_WORKING_TZSET\r
+#undef HAVE_WORKING_TZSET\r
 \r
 /* Define if the zlib library has inflateCopy */\r
 #undef HAVE_ZLIB_COPY\r
 #undef MVWDELCH_IS_EXPRESSION\r
 \r
 /* Define to the address where bug reports for this package should be sent. */\r
-#undef PACKAGE_BUGREPORT\r
+#define PACKAGE_BUGREPORT   "edk2-devel@lists.sourceforge.net"\r
 \r
 /* Define to the full name of this package. */\r
-#define PACKAGE_NAME    EDK II Python Package\r
+#define PACKAGE_NAME    "EDK II Python Package"\r
 \r
 /* Define to the full name and version of this package. */\r
-#define PACKAGE_STRING  EDK II Python Package V0.1\r
+#define PACKAGE_STRING  "EDK II Python Package V0.2"\r
 \r
 /* Define to the one symbol short name of this package. */\r
-#define PACKAGE_TARNAME   UDK_Python\r
+#define PACKAGE_TARNAME   "EADK_Python"\r
 \r
 /* Define to the home page for this package. */\r
-#define PACKAGE_URL   http://edk2.tianocore.org/toolkit/python\r
+#define PACKAGE_URL   "http://edk2.tianocore.org/toolkit/python"\r
 \r
 /* Define to the version of this package. */\r
-#undef PACKAGE_VERSION  V0.1\r
+#define PACKAGE_VERSION  "V0.2"\r
 \r
 /* Define if POSIX semaphores aren't enabled on your system */\r
-#define POSIX_SEMAPHORES_NOT_ENABLED\r
+#define POSIX_SEMAPHORES_NOT_ENABLED    1\r
 \r
 /* Defined if PTHREAD_SCOPE_SYSTEM supported. */\r
 #undef PTHREAD_SYSTEM_SCHED_SUPPORTED\r
 #undef PYLONG_BITS_IN_DIGIT\r
 \r
 /* Define to printf format modifier for long long type */\r
-#undef PY_FORMAT_LONG_LONG\r
+#define PY_FORMAT_LONG_LONG   "ll"\r
 \r
 /* Define to printf format modifier for Py_ssize_t */\r
-#undef PY_FORMAT_SIZE_T\r
+#define PY_FORMAT_SIZE_T    "z"\r
 \r
 /* Define as the integral type used for Unicode representation. */\r
-#undef PY_UNICODE_TYPE\r
+#define PY_UNICODE_TYPE     wchar_t\r
 \r
 /* Define if you want to build an interpreter with many run-time checks. */\r
 #undef Py_DEBUG\r
 #undef SIGNED_RIGHT_SHIFT_ZERO_FILLS\r
 \r
 /* The size of `double', as computed by sizeof. */\r
-#undef SIZEOF_DOUBLE\r
+#define SIZEOF_DOUBLE     8\r
 \r
 /* The size of `float', as computed by sizeof. */\r
-#undef SIZEOF_FLOAT\r
+#define SIZEOF_FLOAT      4\r
 \r
 /* The size of `fpos_t', as computed by sizeof. */\r
-#undef SIZEOF_FPOS_T\r
+#define SIZEOF_FPOS_T     8\r
 \r
 /* The size of `int', as computed by sizeof. */\r
-#undef SIZEOF_INT\r
+#define SIZEOF_INT        4\r
 \r
 /* The size of `long', as computed by sizeof. */\r
-#undef SIZEOF_LONG\r
+#if defined(_MSC_VER)           /* Handle Microsoft VC++ compiler specifics. */\r
+#define SIZEOF_LONG       4\r
+#else\r
+#define SIZEOF_LONG       8\r
+#endif\r
 \r
 /* The size of `long double', as computed by sizeof. */\r
 #undef SIZEOF_LONG_DOUBLE\r
 \r
 /* The size of `long long', as computed by sizeof. */\r
-#undef SIZEOF_LONG_LONG\r
+#define SIZEOF_LONG_LONG  8\r
 \r
 /* The size of `off_t', as computed by sizeof. */\r
-#undef SIZEOF_OFF_T\r
+#define SIZEOF_OFF_T      8\r
 \r
 /* The size of `pid_t', as computed by sizeof. */\r
-#undef SIZEOF_PID_T\r
+#define SIZEOF_PID_T      4\r
 \r
 /* The size of `pthread_t', as computed by sizeof. */\r
 #undef SIZEOF_PTHREAD_T\r
 \r
 /* The size of `short', as computed by sizeof. */\r
-#undef SIZEOF_SHORT\r
+#define SIZEOF_SHORT      2\r
 \r
 /* The size of `size_t', as computed by sizeof. */\r
-#undef SIZEOF_SIZE_T\r
+#define SIZEOF_SIZE_T     8\r
 \r
 /* The size of `time_t', as computed by sizeof. */\r
-#undef SIZEOF_TIME_T\r
+#define SIZEOF_TIME_T     4\r
 \r
 /* The size of `uintptr_t', as computed by sizeof. */\r
-#undef SIZEOF_UINTPTR_T\r
+#define SIZEOF_UINTPTR_T  8\r
 \r
 /* The size of `void *', as computed by sizeof. */\r
-#undef SIZEOF_VOID_P\r
+#define SIZEOF_VOID_P     8\r
 \r
 /* The size of `wchar_t', as computed by sizeof. */\r
-#undef SIZEOF_WCHAR_T\r
+#define SIZEOF_WCHAR_T    2\r
 \r
 /* The size of `_Bool', as computed by sizeof. */\r
-#undef SIZEOF__BOOL\r
+#define SIZEOF__BOOL      1\r
 \r
 /* Define to 1 if you have the ANSI C header files. */\r
 #define STDC_HEADERS    1\r
 #undef __EXTENSIONS__\r
 \r
 /* Define to 'long' if <time.h> doesn't define. */\r
-#undef clock_t\r
+//#undef clock_t\r
 \r
 /* Define to empty if `const' does not conform to ANSI C. */\r
-#undef const\r
+//#undef const\r
 \r
 /* Define to `int' if <sys/types.h> doesn't define. */\r
-#undef gid_t\r
+//#undef gid_t\r
 \r
 /* Define to the type of a signed integer type of width exactly 32 bits if\r
    such a type exists and the standard includes do not define it. */\r
-#undef int32_t\r
+//#undef int32_t\r
 \r
 /* Define to the type of a signed integer type of width exactly 64 bits if\r
    such a type exists and the standard includes do not define it. */\r
-#undef int64_t\r
+//#undef int64_t\r
 \r
 /* Define to `int' if <sys/types.h> does not define. */\r
-#undef mode_t\r
+//#undef mode_t\r
 \r
 /* Define to `long int' if <sys/types.h> does not define. */\r
-#undef off_t\r
+//#undef off_t\r
 \r
 /* Define to `int' if <sys/types.h> does not define. */\r
-#undef pid_t\r
+//#undef pid_t\r
 \r
 /* Define to empty if the keyword does not work. */\r
-#undef signed\r
+//#undef signed\r
 \r
 /* Define to `unsigned int' if <sys/types.h> does not define. */\r
-#undef size_t\r
+//#undef size_t\r
 \r
 /* Define to `int' if <sys/socket.h> does not define. */\r
-#undef socklen_t\r
+//#undef socklen_t\r
 \r
 /* Define to `int' if <sys/types.h> doesn't define. */\r
-#undef uid_t\r
+//#undef uid_t\r
 \r
 /* Define to the type of an unsigned integer type of width exactly 32 bits if\r
    such a type exists and the standard includes do not define it. */\r
-#undef uint32_t\r
+//#undef uint32_t\r
 \r
 /* Define to the type of an unsigned integer type of width exactly 64 bits if\r
    such a type exists and the standard includes do not define it. */\r
-#undef uint64_t\r
+//#undef uint64_t\r
 \r
 /* Define to empty if the keyword does not work. */\r
-#undef volatile\r
-\r
-\r
-/* Define the macros needed if on a UnixWare 7.x system. */\r
-#if defined(__USLC__) && defined(__SCO_VERSION__)\r
-#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */\r
-#endif\r
+//#undef volatile\r
 \r
 #endif /*Py_PYCONFIG_H*/\r
-\r
index bfbd14e1c5ddfb3fa9f9d903464ff9f2c1ac464c..1d013286091c6d580b5d3a29f8d8fd4824d7edf2 100644 (file)
@@ -291,7 +291,7 @@ __BEGIN_DECLS
 \r
     @return\r
   **/\r
-  int     stat      (const char *, void *);\r
+  int     stat      (const char *, struct stat *);\r
 \r
   /**\r
     @param[in]\r
index 2134f157657c1380e5664ea7f9ef88acce485ca2..4d738c64b61656df9e4e1995ed2df1a1f7db3e30 100644 (file)
@@ -39,6 +39,7 @@ pid_t           tcgetpgrp(int);
 char           *getpass(const char *);\r
 int             usleep(useconds_t);\r
 unsigned int    sleep(unsigned int);\r
+char           *basename(char *path);\r
 \r
 // Networking\r
 long            gethostid(void);\r
index d0abb8dd5b2975cb6f52510cdea0e098dfecb266..de14ef31c57fe3a39c8c178ccd52d9f35eb75acf 100644 (file)
@@ -304,14 +304,14 @@ da_ShellStat(
   }\r
   else {\r
     Status = RETURN_DEVICE_ERROR;\r
+    errno  = EIO;\r
   }\r
-  errno     = EFI2errno(Status);\r
   EFIerrno  = Status;\r
 \r
   if(FileInfo != NULL) {\r
     FreePool(FileInfo);     // Release the buffer allocated by the GetInfo function\r
   }\r
-  return errno? -1 : 0;\r
+  return (Status == RETURN_SUCCESS)? 0 : -1;\r
 }\r
 \r
 static\r
index d52249b58b7785d47ce7e70bdf98f20d75445062..b5079e2c3a0d2e4dcd76314b6d47383bcc077fc6 100644 (file)
@@ -923,7 +923,7 @@ fstat (int fd, struct stat *statbuf)
                   identify the error.\r
 **/\r
 int\r
-stat   (const char *path, void *statbuf)\r
+stat   (const char *path, struct stat *statbuf)\r
 {\r
   int                 fd;\r
   int                 retval  = -1;\r
index 7f250d15ff98fe8a325e25e3da481520f55aeb68..8ce4783a6a518ab17ed2fd5844fa0e70f3ac9d1e 100644 (file)
@@ -94,6 +94,7 @@
 #include  <LibConfig.h>\r
 #include  <string.h>\r
 #include  <fcntl.h>\r
+#include  <sys/syslimits.h>\r
 \r
 #ifndef HAVE_GETOPT\r
 char *optarg;\r
@@ -138,11 +139,7 @@ getopt(int argc, char **argv, char *args)
 }\r
 #endif\r
 \r
-#ifdef WIN32\r
 #define ISPATHSEPARATOR(x) ((x == '/') || (x == '\\'))\r
-#else\r
-#define ISPATHSEPARATOR(x) (x == '/')\r
-#endif\r
 \r
 #ifndef HAVE_BASENAME\r
 #ifndef PATH_MAX\r
index 5446ecd35f45d67583c73c50655308d9c8e5a08b..c2cf12856b752513defe051dc2bf092f36f0247e 100644 (file)
@@ -4,6 +4,15 @@
 #\r
 # The including DSC file must DEFINE the EMULATE macro if\r
 # the application is to be run in an emulation environment.\r
+#\r
+#  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+#  This program and the accompanying materials\r
+#  are licensed and made available under the terms and conditions of the BSD License\r
+#  which accompanies this distribution. The full text of the license may be found at\r
+#  http://opensource.org/licenses/bsd-license.\r
+#\r
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 ################################################################\r
 \r
 ##########\r
 !ifndef $(EMULATE)\r
   # Not running in an Emulation Environment\r
 [LibraryClasses.IA32.UEFI_APPLICATION]\r
-  TimerLib|PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.inf\r
+  TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf\r
+#  TimerLib|PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.inf\r
 \r
 [LibraryClasses.X64.UEFI_APPLICATION]\r
-  TimerLib|PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.inf\r
+  TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf\r
+#  TimerLib|PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.inf\r
 \r
 [LibraryClasses.IPF.UEFI_APPLICATION]\r
   PalLib|MdePkg/Library/UefiPalLib/UefiPalLib.inf\r
 !ifndef $(EMULATE)\r
   # These Build Options are used when building the Standard Libraries to be run\r
   # on real hardware.\r
-   INTEL:*_*_*_CC_FLAGS      = /Qfreestanding\r
-    MSFT:*_*_*_CC_FLAGS      = /X /Zc:wchar_t\r
-     GCC:*_*_*_CC_FLAGS      = -nostdinc -nostdlib\r
+  INTEL:*_*_*_CC_FLAGS      = /Qfreestanding\r
+   MSFT:*_*_*_CC_FLAGS      = /X /Zc:wchar_t /D NT32dvm\r
+    GCC:*_*_*_CC_FLAGS      = -nostdinc -nostdlib\r
     RVCT:*_*_*_CC_FLAGS      = --library_interface=none -J$(WORKSPACE)/StdLib/Include -J$(WORKSPACE)/StdLib/Include/Arm -DNT32dvm\r
   ARMGCC:*_*_*_CC_FLAGS      = -nostdinc -nostdlib -Wno-unknown-pragmas -Wno-unused -Wno-format-zero-length -DNT32dvm\r
 \r
    MSFT:*_*_IA32_CC_FLAGS     = /Od /D NT32dvm\r
     GCC:*_*_IA32_CC_FLAGS     = -O0 -DNT32dvm\r
 !endif\r
-\r
-\r