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,9 +1,27 @@
/* Return the copyright string. This is updated manually. */
/** @file
Return the copyright string. This is updated manually.
Copyright (c) 2015, Daryl McDaniel. All rights reserved.<BR>
Copyright (c) 2010 - 2014, 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"
static char cprt[] =
static char cprt[] =
"\
Copyright (c) 2015 Daryl McDaniel.\n\
All Rights Reserved.\n\
\n\
Copyright (c) 2010-2014 Intel Corporation.\n\
All Rights Reserved.\n\
\n\
Copyright (c) 2001-2015 Python Software Foundation.\n\
All Rights Reserved.\n\
\n\
@@ -19,5 +37,5 @@ All Rights Reserved.";
const char *
Py_GetCopyright(void)
{
return cprt;
return cprt;
}

View File

@@ -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) 2015, Daryl McDaniel. 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
@@ -11,6 +21,7 @@
#include "code.h"
#include "marshal.h"
#undef ABS
#define ABS(x) ((x) < 0 ? -(x) : (x))
/* High water mark to determine when the marshalled object is dangerously deep

View File

@@ -1,3 +1,15 @@
/** @file
Copyright (c) 2015, Daryl McDaniel. 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"
#ifdef MS_WINDOWS
#include <windows.h>
@@ -153,8 +165,12 @@ vms_urandom(unsigned char *buffer, Py_ssize_t size, int raise)
static struct {
int fd;
#ifdef HAVE_STRUCT_STAT_ST_DEV
dev_t st_dev;
#endif
#ifdef HAVE_STRUCT_STAT_ST_INO
ino_t st_ino;
#endif
} urandom_cache = { -1 };
/* Read size bytes from /dev/urandom into buffer.
@@ -167,7 +183,7 @@ dev_urandom_noraise(unsigned char *buffer, Py_ssize_t size)
assert (0 < size);
fd = open("/dev/urandom", O_RDONLY);
fd = open("/dev/urandom", O_RDONLY, 0);
if (fd < 0)
Py_FatalError("Failed to open /dev/urandom");
@@ -204,8 +220,14 @@ dev_urandom_python(char *buffer, Py_ssize_t size)
if (urandom_cache.fd >= 0) {
/* Does the fd point to the same thing as before? (issue #21207) */
if (fstat(urandom_cache.fd, &st)
#ifdef HAVE_STRUCT_STAT_ST_DEV
|| st.st_dev != urandom_cache.st_dev
|| st.st_ino != urandom_cache.st_ino) {
#endif
#ifdef HAVE_STRUCT_STAT_ST_INO
|| st.st_ino != urandom_cache.st_ino
#endif
)
{
/* Something changed: forget the cached fd (but don't close it,
since it probably points to something important for some
third-party code). */
@@ -216,7 +238,7 @@ dev_urandom_python(char *buffer, Py_ssize_t size)
fd = urandom_cache.fd;
else {
Py_BEGIN_ALLOW_THREADS
fd = open("/dev/urandom", O_RDONLY);
fd = open("/dev/urandom", O_RDONLY, 0);
Py_END_ALLOW_THREADS
if (fd < 0)
{
@@ -250,8 +272,12 @@ dev_urandom_python(char *buffer, Py_ssize_t size)
}
else {
urandom_cache.fd = fd;
#ifdef HAVE_STRUCT_STAT_ST_DEV
urandom_cache.st_dev = st.st_dev;
#endif
#ifdef HAVE_STRUCT_STAT_ST_INO
urandom_cache.st_ino = st.st_ino;
#endif
}
}
}