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