AppPkg/.../Python-2.7.10: AppPkg.dsc, pyconfig.h, PyMod-2.7.10

Apply UEFI-specific changes to files to make them equivalent to the Python 2.7.2 versions.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Daryl McDaniel <edk2-lists@mc2research.org>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>

---
 AppPkg/AppPkg.dsc                                  |   5 +-
 .../Python/Python-2.7.10/Ia32/pyconfig.h           |  93 ++++++++----
 .../Python-2.7.10/PyMod-2.7.10/Lib/ntpath.py       |  30 +++-
 .../Python/Python-2.7.10/PyMod-2.7.10/Lib/os.py    |  35 ++++-
 .../Python/Python-2.7.10/PyMod-2.7.10/Lib/pydoc.py |  17 +++
 .../Python/Python-2.7.10/PyMod-2.7.10/Lib/site.py  | 165 ++++++---------------
 .../Python-2.7.10/PyMod-2.7.10/Modules/_sre.c      | 150 ++++++++++---------
 .../Python-2.7.10/PyMod-2.7.10/Modules/addrinfo.h  | 101 +++++++------
 .../PyMod-2.7.10/Modules/errnomodule.c             |  57 ++++++-
 .../PyMod-2.7.10/Modules/expat/expat_external.h    |   4 +-
 .../Python-2.7.10/PyMod-2.7.10/Modules/getpath.c   | 143 +++++-------------
 .../Python-2.7.10/PyMod-2.7.10/Modules/main.c      |  61 ++++----
 .../PyMod-2.7.10/Modules/selectmodule.c            |  43 ++++--
 .../PyMod-2.7.10/Modules/zlib/gzguts.h             |  10 +-
 .../PyMod-2.7.10/Modules/zlib/zutil.h              |  11 +-
 .../PyMod-2.7.10/Objects/longobject.c              |  14 +-
 .../PyMod-2.7.10/Objects/stringlib/localeutil.h    |  17 ++-
 .../PyMod-2.7.10/Python/getcopyright.c             |  24 ++-
 .../Python-2.7.10/PyMod-2.7.10/Python/marshal.c    |  21 ++-
 .../Python-2.7.10/PyMod-2.7.10/Python/random.c     |  32 +++-
 .../Python/Python-2.7.10/X64/pyconfig.h            |  63 ++++++--
 21 files changed, 640 insertions(+), 456 deletions(-)


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19462 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Daryl McDaniel
2015-12-23 00:15:45 +00:00
committed by darylm503
parent 5285ac3eba
commit d11973f1ca
21 changed files with 634 additions and 450 deletions

View File

@@ -1,4 +1,8 @@
/* Python interpreter main program */
/** @file
Python interpreter main program.
Copyright (c) 2015, Daryl McDaniel. All rights reserved.<BR>
**/
#include "Python.h"
#include "osdefs.h"
@@ -40,7 +44,7 @@ static char **orig_argv;
static int orig_argc;
/* command line options */
#define BASE_OPTS "3bBc:dEhiJm:OQ:RsStuUvVW:xX?"
#define BASE_OPTS "#3bBc:dEhiJm:OQ:sStuUvVW:xX?"
#ifndef RISCOS
#define PROGRAM_OPTS BASE_OPTS
@@ -59,6 +63,7 @@ static char *usage_line =
/* Long usage message, split into parts < 512 bytes */
static char *usage_1 = "\
Options and arguments (and corresponding environment variables):\n\
-# : alias stderr to stdout for platforms without STDERR output.\n\
-B : don't write .py[co] files on import; also PYTHONDONTWRITEBYTECODE=x\n\
-c cmd : program passed in as string (terminates option list)\n\
-d : debug output from parser; also PYTHONDEBUG=x\n\
@@ -71,9 +76,6 @@ static char *usage_2 = "\
-m mod : run library module as a script (terminates option list)\n\
-O : optimize generated bytecode slightly; also PYTHONOPTIMIZE=x\n\
-OO : remove doc-strings in addition to the -O optimizations\n\
-R : use a pseudo-random salt to make hash() values of various types be\n\
unpredictable between separate invocations of the interpreter, as\n\
a defense against denial-of-service attacks\n\
-Q arg : division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew\n\
-s : don't add user site directory to sys.path; also PYTHONNOUSERSITE\n\
-S : don't imply 'import site' on initialization\n\
@@ -102,15 +104,9 @@ PYTHONPATH : '%c'-separated list of directories prefixed to the\n\
static char *usage_5 = "\
PYTHONHOME : alternate <prefix> directory (or <prefix>%c<exec_prefix>).\n\
The default module search path uses %s.\n\
PYTHONCASEOK : ignore case in 'import' statements (Windows).\n\
PYTHONCASEOK : ignore case in 'import' statements (UEFI default).\n\
PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.\n\
";
static char *usage_6 = "\
PYTHONHASHSEED: if this variable is set to 'random', the effect is the same\n\
as specifying the -R option: a random value is used to seed the hashes of\n\
str, bytes and datetime objects. It can also be set to an integer\n\
in the range [0,4294967295] to get hash values with a predictable seed.\n\
";
static int
@@ -127,7 +123,6 @@ usage(int exitcode, char* program)
fputs(usage_3, f);
fprintf(f, usage_4, DELIM);
fprintf(f, usage_5, DELIM, PYTHONHOMEHELP);
fputs(usage_6, f);
}
#if defined(__VMS)
if (exitcode == 0) {
@@ -251,6 +246,7 @@ Py_Main(int argc, char **argv)
int help = 0;
int version = 0;
int saw_unbuffered_flag = 0;
int saw_pound_flag = 0;
PyCompilerFlags cf;
cf.cf_flags = 0;
@@ -266,26 +262,27 @@ Py_Main(int argc, char **argv)
(including -W and -X options). */
_PyOS_opterr = 0; /* prevent printing the error in 1st pass */
while ((c = _PyOS_GetOpt(argc, argv, PROGRAM_OPTS)) != EOF) {
if (c == 'm' || c == 'c') {
/* -c / -m is the last option: following arguments are
not interpreter options. */
break;
}
switch (c) {
if (c == 'm' || c == 'c') {
/* -c / -m is the last option: following arguments are
not interpreter options. */
break;
}
switch (c) {
case '#':
if (saw_pound_flag == 0) {
if(freopen("stdout:", "w", stderr) == NULL) {
puts("ERROR: Unable to reopen stderr as an alias to stdout!");
}
saw_pound_flag = 0xFF;
}
break;
case 'E':
Py_IgnoreEnvironmentFlag++;
break;
case 'R':
Py_HashRandomizationFlag++;
break;
}
Py_IgnoreEnvironmentFlag++;
break;
default:
break;
}
}
/* The variable is only tested for existence here; _PyRandom_Init will
check its value further. */
if (!Py_HashRandomizationFlag &&
(p = Py_GETENV("PYTHONHASHSEED")) && *p != '\0')
Py_HashRandomizationFlag = 1;
_PyRandom_Init();
PySys_ResetWarnOptions();
@@ -426,7 +423,7 @@ Py_Main(int argc, char **argv)
PySys_AddWarnOption(_PyOS_optarg);
break;
case 'R':
case '#':
/* Already handled above */
break;