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

@ -126,9 +126,12 @@
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80400040
}
#### Un-comment the following line to build Python.
#### Un-comment the following line to build Python 2.7.2.
# AppPkg/Applications/Python/PythonCore.inf
#### Un-comment the following line to build Python 2.7.10.
# AppPkg/Applications/Python/Python-2.7.10/Python2710.inf
#### Un-comment the following line to build Lua.
# AppPkg/Applications/Lua/Lua.inf

View File

@ -1,6 +1,7 @@
/** @file
Manually generated Python Configuration file for EDK II.
Copyright (c) 2015, Daryl McDaniel. All rights reserved.<BR>
Copyright (c) 2011 - 2012, 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.
@ -67,6 +68,9 @@
/* Define to 1 if you have the 'alarm' function. */
#undef HAVE_ALARM
/* Define to 1 if you have the <alloca.h> header file. */
#undef HAVE_ALLOCA_H
/* Define this if your time.h defines altzone. */
#undef HAVE_ALTZONE
@ -109,6 +113,9 @@
/* define to 1 if your sem_getvalue is broken. */
#define HAVE_BROKEN_SEM_GETVALUE 1
/* Define if 'unsetenv' does not return an int. */
#undef HAVE_BROKEN_UNSETENV
/* Define this if you have the type _Bool. */
#define HAVE_C99_BOOL 1
@ -170,10 +177,10 @@
/* Define to 1 if you have the device macros. */
#undef HAVE_DEVICE_MACROS
/* Define if we have /dev/ptc. */
/* Define to 1 if you have the /dev/ptc device file. */
#undef HAVE_DEV_PTC
/* Define if we have /dev/ptmx. */
/* Define to 1 if you have the /dev/ptmx device file. */
#undef HAVE_DEV_PTMX
/* Define to 1 if you have the <direct.h> header file. */
@ -274,11 +281,11 @@
#undef HAVE_GAMMA
/* Define if we can use gcc inline assembler to get and set x87 control word
*/
*/
#if defined(__GNUC__)
#define HAVE_GCC_ASM_FOR_X87 1
#else
#undef HAVE_GCC_ASM_FOR_X87
#undef HAVE_GCC_ASM_FOR_X87
#endif
/* Define if you have the getaddrinfo function. */
@ -290,6 +297,9 @@
/* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */
#undef HAVE_GETC_UNLOCKED
/* Define to 1 if you have the 'getentropy' function. */
#undef HAVE_GETENTROPY
/* Define to 1 if you have the 'getgroups' function. */
#undef HAVE_GETGROUPS
@ -383,6 +393,12 @@
/* Define to 1 if you have the 'initgroups' function. */
#undef HAVE_INITGROUPS
/* Define if your compiler provides int32_t. */
#undef HAVE_INT32_T
/* Define if your compiler provides int64_t. */
#undef HAVE_INT64_T
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
@ -479,6 +495,9 @@
/* Define to 1 if you have the 'mktime' function. */
#define HAVE_MKTIME 1
/* Define to 1 if you have the 'mmap' function. */
#undef HAVE_MMAP
/* Define to 1 if you have the 'mremap' function. */
#undef HAVE_MREMAP
@ -524,6 +543,9 @@
/* Define if you have GNU PTH threads. */
#undef HAVE_PTH
/* Define to 1 if you have the 'pthread_atfork' function. */
#undef HAVE_PTHREAD_ATFORK
/* Defined for Solaris 2.6 bug in pthread header. */
#undef HAVE_PTHREAD_DESTRUCTOR
@ -542,6 +564,9 @@
/* Define to 1 if you have the 'putenv' function. */
#undef HAVE_PUTENV
/* Define if the libcrypto has RAND_egd */
#undef HAVE_RAND_EGD
/* Define to 1 if you have the 'readlink' function. */
#undef HAVE_READLINK
@ -717,6 +742,12 @@
/* Define to 1 if 'st_rdev' is a member of 'struct stat'. */
#undef HAVE_STRUCT_STAT_ST_RDEV
/* Define to 1 if 'st_dev' is a member of 'struct stat'. */
#undef HAVE_STRUCT_STAT_ST_DEV
/* Define to 1 if 'st_ino' is a member of 'struct stat'. */
#undef HAVE_STRUCT_STAT_ST_INO
/* Define to 1 if 'tm_zone' is a member of 'struct tm'. */
#undef HAVE_STRUCT_TM_TM_ZONE
@ -863,6 +894,12 @@
/* Define this if you have tcl and TCL_UTF_MAX==6 */
#undef HAVE_UCS4_TCL
/* Define if your compiler provides uint32_t. */
#undef HAVE_UINT32_T
/* Define if your compiler provides uint64_t. */
#undef HAVE_UINT64_T
/* Define to 1 if the system has the type 'uintptr_t'. */
#define HAVE_UINTPTR_T 1
@ -932,22 +969,22 @@
#undef MVWDELCH_IS_EXPRESSION
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "edk2-devel@lists.sourceforge.net"
#define PACKAGE_BUGREPORT "edk2-devel@lists.01.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "EDK II Python Package"
#define PACKAGE_NAME "EDK II Python 2.7.10 Package"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "EDK II Python Package V0.8"
#define PACKAGE_STRING "EDK II Python 2.7.10 Package V0.1"
/* Define to the one symbol short name of this package. */
#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/"
/* Define to the version of this package. */
#define PACKAGE_VERSION "V0.8"
#define PACKAGE_VERSION "V0.1"
/* Define if POSIX semaphores aren't enabled on your system */
#define POSIX_SEMAPHORES_NOT_ENABLED 1
@ -1156,13 +1193,14 @@
/* This must be defined on some systems to enable large file support. */
#undef _LARGEFILE_SOURCE
/* This must be defined on AIX systems to enable large file support. */
#undef _LARGE_FILES
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define on NetBSD to activate all library features */
#ifndef _NETBSD_SOURCE
#define _NETBSD_SOURCE 1
#endif
#define _NETBSD_SOURCE 1
/* Define _OSF_SOURCE to get the makedev macro. */
#undef _OSF_SOURCE
@ -1260,3 +1298,4 @@
//#undef volatile
#endif /*Py_PYCONFIG_H*/

View File

@ -1,5 +1,18 @@
# Module 'ntpath' -- common operations on WinNT/Win95 pathnames
"""Common pathname manipulations, WindowsNT/95 version.
# Module 'ntpath' -- common operations on WinNT/Win95 and UEFI pathnames.
#
# Copyright (c) 2015, Daryl McDaniel. All rights reserved.<BR>
# Copyright (c) 2011 - 2012, 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.
"""Common pathname manipulations, WindowsNT/95 and UEFI version.
Instead of importing this module directly, import os and refer to this
module as os.path.
@ -93,6 +106,9 @@ def join(path, *paths):
# Split a path in a drive specification (a drive letter followed by a
# colon) and the path specification.
# It is always true that drivespec + pathspec == p
# NOTE: for UEFI (and even Windows) you can have multiple characters to the left
# of the ':' for the device or drive spec. This is reflected in the modifications
# to splitdrive() and splitunc().
def splitdrive(p):
"""Split a pathname into drive/UNC sharepoint and relative path specifiers.
Returns a 2-tuple (drive_or_unc, path); either part may be empty.
@ -130,8 +146,10 @@ def splitdrive(p):
if index2 == -1:
index2 = len(p)
return p[:index2], p[index2:]
if normp[1] == ':':
return p[:2], p[2:]
index = p.find(':')
if index != -1:
index = index + 1
return p[:index], p[index:]
return '', p
# Parse UNC paths
@ -143,8 +161,8 @@ def splitunc(p):
using backslashes). unc+rest is always the input path.
Paths containing drive letters never have an UNC part.
"""
if p[1:2] == ':':
return '', p # Drive letter present
if ':' in p:
return '', p # Drive letter or device name present
firstTwo = p[0:2]
if firstTwo == '//' or firstTwo == '\\\\':
# is a UNC path:

View File

@ -1,9 +1,22 @@
r"""OS routines for NT or Posix depending on what system we're on.
# Module 'os' -- OS routines for NT, Posix, or UEFI depending on what system we're on.
#
# Copyright (c) 2015, Daryl McDaniel. All rights reserved.<BR>
# Copyright (c) 2011 - 2012, 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.
r"""OS routines for NT, Posix, or UEFI depending on what system we're on.
This exports:
- all functions from posix, nt, os2, or ce, e.g. unlink, stat, etc.
- os.path is one of the modules posixpath, or ntpath
- os.name is 'posix', 'nt', 'os2', 'ce' or 'riscos'
- all functions from edk2, posix, nt, os2, or ce, e.g. unlink, stat, etc.
- os.path is one of the modules uefipath, posixpath, or ntpath
- os.name is 'edk2', 'posix', 'nt', 'os2', 'ce' or 'riscos'
- os.curdir is a string representing the current directory ('.' or ':')
- os.pardir is a string representing the parent directory ('..' or '::')
- os.sep is the (or a most common) pathname separator ('/' or ':' or '\\')
@ -113,6 +126,20 @@ elif 'riscos' in _names:
__all__.extend(_get_exports_list(riscos))
del riscos
elif 'edk2' in _names:
name = 'edk2'
linesep = '\n'
from edk2 import *
try:
from edk2 import _exit
except ImportError:
pass
import ntpath as path
import edk2
__all__.extend(_get_exports_list(edk2))
del edk2
else:
raise ImportError, 'no os specific module found'

View File

@ -1,5 +1,18 @@
#!/usr/bin/env python
# -*- coding: latin-1 -*-
# Module 'pydoc' -- Generate Python documentation in HTML or text for interactive use.
#
# Copyright (c) 2015, Daryl McDaniel. All rights reserved.<BR>
# Copyright (c) 2011 - 2012, 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.
"""Generate Python documentation in HTML or text for interactive use.
In the Python interpreter, do "from pydoc import help" to provide online
@ -1385,12 +1398,16 @@ def getpager():
if 'PAGER' in os.environ:
if sys.platform == 'win32': # pipes completely broken in Windows
return lambda text: tempfilepager(plain(text), os.environ['PAGER'])
elif sys.platform == 'uefi':
return lambda text: tempfilepager(plain(text), os.environ['PAGER'])
elif os.environ.get('TERM') in ('dumb', 'emacs'):
return lambda text: pipepager(plain(text), os.environ['PAGER'])
else:
return lambda text: pipepager(text, os.environ['PAGER'])
if os.environ.get('TERM') in ('dumb', 'emacs'):
return plainpager
if sys.platform == 'uefi':
return plainpager
if sys.platform == 'win32' or sys.platform.startswith('os2'):
return lambda text: tempfilepager(plain(text), 'more <')
if hasattr(os, 'system') and os.system('(less) 2>/dev/null') == 0:

View File

@ -4,18 +4,18 @@
* This module is automatically imported during initialization. *
****************************************************************
This is a UEFI-specific version of site.py.
In earlier versions of Python (up to 1.5a3), scripts or modules that
needed to use site-specific modules would place ``import site''
somewhere near the top of their code. Because of the automatic
import, this is no longer necessary (but code that does it still
works).
This will append site-specific paths to the module search path. On
Unix (including Mac OSX), it starts with sys.prefix and
This will append site-specific paths to the module search path. It starts with sys.prefix and
sys.exec_prefix (if different) and appends
lib/python<version>/site-packages as well as lib/site-python.
On other platforms (such as Windows), it tries each of the
prefixes directly, as well as with lib/site-packages appended. The
The
resulting directories, if they exist, are appended to sys.path, and
also inspected for path configuration files.
@ -27,7 +27,7 @@ sys.path more than once. Blank lines and lines beginning with
'#' are skipped. Lines starting with 'import' are executed.
For example, suppose sys.prefix and sys.exec_prefix are set to
/usr/local and there is a directory /usr/local/lib/python2.5/site-packages
/Efi/StdLib and there is a directory /Efi/StdLib/lib/python27.10/site-packages
with three subdirectories, foo, bar and spam, and two path
configuration files, foo.pth and bar.pth. Assume foo.pth contains the
following:
@ -44,8 +44,8 @@ and bar.pth contains:
Then the following directories are added to sys.path, in this order:
/usr/local/lib/python2.5/site-packages/bar
/usr/local/lib/python2.5/site-packages/foo
/Efi/StdLib/lib/python27.10/site-packages/bar
/Efi/StdLib/lib/python27.10/site-packages/foo
Note that bletch is omitted because it doesn't exist; bar precedes foo
because bar.pth comes alphabetically before foo.pth; and spam is
@ -56,6 +56,15 @@ named sitecustomize, which can perform arbitrary additional
site-specific customizations. If this import fails with an
ImportError exception, it is silently ignored.
Copyright (c) 2015, Daryl McDaniel. All rights reserved.<BR>
Copyright (c) 2011 - 2012, 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.
"""
import sys
@ -67,7 +76,7 @@ import traceback
PREFIXES = [sys.prefix, sys.exec_prefix]
# Enable per user site-packages directory
# set it to False to disable the feature or True to force the feature
ENABLE_USER_SITE = None
ENABLE_USER_SITE = False
# for distutils.commands.install
# These values are initialized by the getuserbase() and getusersitepackages()
@ -246,12 +255,6 @@ def getusersitepackages():
from sysconfig import get_path
import os
if sys.platform == 'darwin':
from sysconfig import get_config_var
if get_config_var('PYTHONFRAMEWORK'):
USER_SITE = get_path('purelib', 'osx_framework_user')
return USER_SITE
USER_SITE = get_path('purelib', '%s_user' % os.name)
return USER_SITE
@ -261,11 +264,11 @@ def addusersitepackages(known_paths):
Each user has its own python directory with site-packages in the
home directory.
"""
if ENABLE_USER_SITE and os.path.isdir(user_site):
# get the per user site-package path
# this call will also make sure USER_BASE and USER_SITE are set
user_site = getusersitepackages()
if ENABLE_USER_SITE and os.path.isdir(user_site):
addsitedir(user_site, known_paths)
return known_paths
@ -285,25 +288,16 @@ def getsitepackages():
continue
seen.add(prefix)
if sys.platform in ('os2emx', 'riscos'):
sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
elif os.sep == '/':
ix = sys.version.find(' ')
if ix != -1:
micro = sys.version[4:ix]
else:
micro = '0'
sitepackages.append(os.path.join(prefix, "lib",
"python" + sys.version[:3],
"python" + sys.version[0] + sys.version[2] + '.' + micro,
"site-packages"))
sitepackages.append(os.path.join(prefix, "lib", "site-python"))
else:
sitepackages.append(prefix)
sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
if sys.platform == "darwin":
# for framework builds *only* we add the standard Apple
# locations.
from sysconfig import get_config_var
framework = get_config_var("PYTHONFRAMEWORK")
if framework:
sitepackages.append(
os.path.join("/Library", framework,
sys.version[:3], "site-packages"))
return sitepackages
def addsitepackages(known_paths):
@ -315,20 +309,20 @@ def addsitepackages(known_paths):
return known_paths
def setBEGINLIBPATH():
"""The OS/2 EMX port has optional extension modules that do double duty
as DLLs (and must use the .DLL file extension) for other extensions.
"""The UEFI port has optional extension modules that do double duty
as DLLs (even though they have .efi file extensions) for other extensions.
The library search path needs to be amended so these will be found
during module import. Use BEGINLIBPATH so that these are at the start
of the library search path.
"""
dllpath = os.path.join(sys.prefix, "Lib", "lib-dynload")
libpath = os.environ['BEGINLIBPATH'].split(';')
libpath = os.environ['BEGINLIBPATH'].split(os.path.pathsep)
if libpath[-1]:
libpath.append(dllpath)
else:
libpath[-1] = dllpath
os.environ['BEGINLIBPATH'] = ';'.join(libpath)
os.environ['BEGINLIBPATH'] = os.path.pathsep.join(libpath)
def setquit():
@ -338,11 +332,6 @@ def setquit():
The repr of each object contains a hint at how it works.
"""
if os.sep == ':':
eof = 'Cmd-Q'
elif os.sep == '\\':
eof = 'Ctrl-Z plus Return'
else:
eof = 'Ctrl-D (i.e. EOF)'
class Quitter(object):
@ -426,11 +415,6 @@ class _Printer(object):
def setcopyright():
"""Set 'copyright' and 'credits' in __builtin__"""
__builtin__.copyright = _Printer("copyright", sys.copyright)
if sys.platform[:4] == 'java':
__builtin__.credits = _Printer(
"credits",
"Jython is maintained by the Jython developers (www.jython.org).")
else:
__builtin__.credits = _Printer("credits", """\
Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
for supporting Python development. See www.python.org for more information.""")
@ -457,21 +441,6 @@ class _Helper(object):
def sethelper():
__builtin__.help = _Helper()
def aliasmbcs():
"""On Windows, some default encodings are not provided by Python,
while they are always available as "mbcs" in each locale. Make
them usable by aliasing to "mbcs" in such a case."""
if sys.platform == 'win32':
import locale, codecs
enc = locale.getdefaultlocale()[1]
if enc.startswith('cp'): # "cp***" ?
try:
codecs.lookup(enc)
except LookupError:
import encodings
encodings._cache[enc] = encodings._unknown
encodings.aliases.aliases[enc] = 'mbcs'
def setencoding():
"""Set the string encoding used by the Unicode implementation. The
default is 'ascii', but if you're willing to experiment, you can
@ -529,16 +498,11 @@ def main():
ENABLE_USER_SITE = check_enableusersite()
known_paths = addusersitepackages(known_paths)
known_paths = addsitepackages(known_paths)
if sys.platform == 'os2emx':
setBEGINLIBPATH()
setquit()
setcopyright()
sethelper()
aliasmbcs()
setencoding()
execsitecustomize()
if ENABLE_USER_SITE:
execusercustomize()
# Remove sys.setdefaultencoding() so that users cannot change the
# encoding after initialization. The test for presence is needed when
# this module is run as a script, because this code is executed twice.
@ -549,52 +513,19 @@ main()
def _script():
help = """\
%s [--user-base] [--user-site]
%s
Without arguments print some useful information
With arguments print the value of USER_BASE and/or USER_SITE separated
by '%s'.
Exit codes with --user-base or --user-site:
0 - user site directory is enabled
1 - user site directory is disabled by user
2 - uses site directory is disabled by super user
or for security reasons
>2 - unknown error
Path elements are normally separated by '%s'.
"""
args = sys.argv[1:]
if not args:
print "sys.path = ["
for dir in sys.path:
print " %r," % (dir,)
print "]"
print "USER_BASE: %r (%s)" % (USER_BASE,
"exists" if os.path.isdir(USER_BASE) else "doesn't exist")
print "USER_SITE: %r (%s)" % (USER_SITE,
"exists" if os.path.isdir(USER_SITE) else "doesn't exist")
print "ENABLE_USER_SITE: %r" % ENABLE_USER_SITE
sys.exit(0)
buffer = []
if '--user-base' in args:
buffer.append(USER_BASE)
if '--user-site' in args:
buffer.append(USER_SITE)
if buffer:
print os.pathsep.join(buffer)
if ENABLE_USER_SITE:
sys.exit(0)
elif ENABLE_USER_SITE is False:
sys.exit(1)
elif ENABLE_USER_SITE is None:
sys.exit(2)
else:
sys.exit(3)
else:
import textwrap
print textwrap.dedent(help % (sys.argv[0], os.pathsep))
sys.exit(10)
sys.exit(0)
if __name__ == '__main__':
_script()

View File

@ -2,6 +2,16 @@
* Secret Labs' Regular Expression Engine
*
* regular expression matching engine
Copyright (c) 2015, Daryl McDaniel. All rights reserved.<BR>
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)
@ -34,6 +44,10 @@
* other compatibility work.
*/
/* Get rid of these macros to prevent collisions between EFI and Python in this file. */
#undef RETURN_ERROR
#undef RETURN_SUCCESS
#ifndef SRE_RECURSIVE
static char copyright[] =
@ -84,7 +98,7 @@ static char copyright[] =
/* -------------------------------------------------------------------- */
#if defined(_MSC_VER)
#pragma optimize("agtw", on) /* doesn't seem to make much difference... */
#pragma optimize("gt", on) /* doesn't seem to make much difference... */
#pragma warning(disable: 4710) /* who cares if functions are not inlined ;-) */
/* fastest possible local call under MSVC */
#define LOCAL(type) static __inline type __fastcall

View File

@ -1,4 +1,13 @@
/*
/** @file
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, 1996, 1997, 1998, and 1999 WIDE Project.
* All rights reserved.
*
@ -25,7 +34,7 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
**/
#ifndef HAVE_GETADDRINFO
@ -123,8 +132,9 @@
#endif /* !HAVE_GETNAMEINFO */
#ifndef HAVE_ADDRINFO
struct addrinfo {
#ifndef _SYS_SOCKET_H_
#ifndef HAVE_ADDRINFO
struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
int ai_family; /* PF_xxx */
int ai_socktype; /* SOCK_xxx */
@ -133,39 +143,40 @@ struct addrinfo {
char *ai_canonname; /* canonical name for hostname */
struct sockaddr *ai_addr; /* binary address */
struct addrinfo *ai_next; /* next structure in linked list */
};
#endif /* !HAVE_ADDRINFO */
};
#endif /* !HAVE_ADDRINFO */
#ifndef HAVE_SOCKADDR_STORAGE
/*
#ifndef HAVE_SOCKADDR_STORAGE
/*
* RFC 2553: protocol-independent placeholder for socket addresses
*/
#define _SS_MAXSIZE 128
#ifdef HAVE_LONG_LONG
#define _SS_ALIGNSIZE (sizeof(PY_LONG_LONG))
#else
#define _SS_ALIGNSIZE (sizeof(double))
#endif /* HAVE_LONG_LONG */
#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(u_char) * 2)
#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(u_char) * 2 - \
#define _SS_MAXSIZE 128
#ifdef HAVE_LONG_LONG
#define _SS_ALIGNSIZE (sizeof(PY_LONG_LONG))
#else
#define _SS_ALIGNSIZE (sizeof(double))
#endif /* HAVE_LONG_LONG */
#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(u_char) * 2)
#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(u_char) * 2 - \
_SS_PAD1SIZE - _SS_ALIGNSIZE)
struct sockaddr_storage {
#ifdef HAVE_SOCKADDR_SA_LEN
struct sockaddr_storage {
#ifdef HAVE_SOCKADDR_SA_LEN
unsigned char ss_len; /* address length */
unsigned char ss_family; /* address family */
#else
#else
unsigned short ss_family; /* address family */
#endif /* HAVE_SOCKADDR_SA_LEN */
#endif /* HAVE_SOCKADDR_SA_LEN */
char __ss_pad1[_SS_PAD1SIZE];
#ifdef HAVE_LONG_LONG
#ifdef HAVE_LONG_LONG
PY_LONG_LONG __ss_align; /* force desired structure storage alignment */
#else
#else
double __ss_align; /* force desired structure storage alignment */
#endif /* HAVE_LONG_LONG */
#endif /* HAVE_LONG_LONG */
char __ss_pad2[_SS_PAD2SIZE];
};
#endif /* !HAVE_SOCKADDR_STORAGE */
};
#endif /* !HAVE_SOCKADDR_STORAGE */
#endif /* _SYS_SOCKET_H_ */
#ifdef __cplusplus
extern "C" {

View File

@ -1,5 +1,14 @@
/* Errno module
/* Errno module */
Copyright (c) 2011 - 2012, 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"
@ -783,9 +792,53 @@ initerrno(void)
#ifdef WSAN
inscode(d, ds, de, "WSAN", WSAN, "Error WSAN");
#endif
/* These symbols are added for EDK II support. */
#ifdef EMINERRORVAL
inscode(d, ds, de, "EMINERRORVAL", EMINERRORVAL, "Lowest valid error value");
#endif
#ifdef ENOTSUP
inscode(d, ds, de, "ENOTSUP", ENOTSUP, "Operation not supported");
#endif
#ifdef EBADRPC
inscode(d, ds, de, "EBADRPC", EBADRPC, "RPC struct is bad");
#endif
#ifdef ERPCMISMATCH
inscode(d, ds, de, "ERPCMISMATCH", ERPCMISMATCH, "RPC version wrong");
#endif
#ifdef EPROGUNAVAIL
inscode(d, ds, de, "EPROGUNAVAIL", EPROGUNAVAIL, "RPC prog. not avail");
#endif
#ifdef EPROGMISMATCH
inscode(d, ds, de, "EPROGMISMATCH", EPROGMISMATCH, "Program version wrong");
#endif
#ifdef EPROCUNAVAIL
inscode(d, ds, de, "EPROCUNAVAIL", EPROCUNAVAIL, "Bad procedure for program");
#endif
#ifdef EFTYPE
inscode(d, ds, de, "EFTYPE", EFTYPE, "Inappropriate file type or format");
#endif
#ifdef EAUTH
inscode(d, ds, de, "EAUTH", EAUTH, "Authentication error");
#endif
#ifdef ENEEDAUTH
inscode(d, ds, de, "ENEEDAUTH", ENEEDAUTH, "Need authenticator");
#endif
#ifdef ECANCELED
inscode(d, ds, de, "ECANCELED", ECANCELED, "Operation canceled");
#endif
#ifdef ENOATTR
inscode(d, ds, de, "ENOATTR", ENOATTR, "Attribute not found");
#endif
#ifdef EDOOFUS
inscode(d, ds, de, "EDOOFUS", EDOOFUS, "Programming Error");
#endif
#ifdef EBUFSIZE
inscode(d, ds, de, "EBUFSIZE", EBUFSIZE, "Buffer too small to hold result");
#endif
#ifdef EMAXERRORVAL
inscode(d, ds, de, "EMAXERRORVAL", EMAXERRORVAL, "One more than the highest defined error value");
#endif
Py_DECREF(de);
}

View File

@ -9,7 +9,9 @@
/* Namespace external symbols to allow multiple libexpat version to
co-exist. */
#include "pyexpatns.h"
#if !defined(UEFI_C_SOURCE)
#include "pyexpatns.h"
#endif
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
#define XML_USE_MSC_EXTENSIONS 1

View File

@ -1,8 +1,19 @@
/** @file
Return the initial module search path.
This file is based upon the Modules/getpath.c file from the Python distribution
but has had everything not exactly necessary for operation on EDK II stripped
out.
Search in specified locations for the associated Python libraries.
For the EDK II, UEFI, implementation of Python, PREFIX and EXEC_PREFIX
are set as follows:
PREFIX = /Efi/StdLib
EXEC_PREFIX = PREFIX
The volume is assumed to be the current volume when Python was started.
Py_GetPath returns module_search_path.
Py_GetPrefix returns PREFIX
Py_GetExec_Prefix returns PREFIX
@ -11,16 +22,13 @@
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:
The following final paths (for Python 2.7.10) 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.
/Efi/StdLib/lib/python27.10 The version dependent Python modules.
/Efi/StdLib/lib/python.27 The version independent Python modules.
/Efi/StdLib/lib/python27.10/lib-dynload Dynamically loadable Python extension modules.
Copyright (c) 2015, Daryl McDaniel. All rights reserved.<BR>
Copyright (c) 2011 - 2012, 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.
@ -34,13 +42,12 @@
#include <osdefs.h>
#include <ctype.h>
#ifdef __cplusplus
extern "C" {
#endif
#define SIFY_I( x ) #x
#define SIFY( y ) SIFY_I( y )
/* VERSION must be at least two characters long. */
#ifndef VERSION
#define VERSION "27"
#define VERSION SIFY(PY_MAJOR_VERSION) SIFY(PY_MINOR_VERSION)
#endif
#ifndef VPATH
@ -61,20 +68,19 @@
#endif
#ifndef LIBPYTHON
#define LIBPYTHON "lib/python." VERSION
#define LIBPYTHON "lib/python" VERSION "." SIFY(PY_MICRO_VERSION)
#endif
#ifndef PYTHONPATH
#ifdef HAVE_ENVIRONMENT_OPS
#define PYTHONPATH PREFIX LIBPYTHON sDELIM \
EXEC_PREFIX LIBPYTHON "/lib-dynload"
#else
#define PYTHONPATH LIBPYTHON
#endif
#endif
#ifndef LANDMARK
#define LANDMARK "os.py"
#define LANDMARK "os.py"
#endif
#ifdef __cplusplus
extern "C" {
#endif
static char prefix[MAXPATHLEN+1];
@ -94,11 +100,7 @@ static char volume_name[32] = { 0 };
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.
@ -117,77 +119,6 @@ reduce(char *dir)
dir[i] = '\0';
}
#ifndef UEFI_C_SOURCE
/** 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) {
return 0;
}
//if (!S_ISREG(buf.st_mode))
if (S_ISDIR(buf.st_mode)) {
return 0;
}
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)) {
return 1;
}
}
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;
}
#endif /* UEFI_C_SOURCE */
/** 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.
@ -466,7 +397,7 @@ calculate_path(void)
char *pythonpath = PYTHONPATH;
char *rtpypath = Py_GETENV("PYTHONPATH");
//char *home = Py_GetPythonHome();
char *path = getenv("PATH");
char *path = getenv("path");
char *prog = Py_GetProgramName();
char argv0_path[MAXPATHLEN+1];
char zip_path[MAXPATHLEN+1];
@ -551,10 +482,10 @@ calculate_path(void)
Build the FULL path to dynamically loadable libraries.
########################################################################### */
strncpy(exec_prefix, volume_name, MAXPATHLEN);
joinpath(exec_prefix, EXEC_PREFIX);
joinpath(exec_prefix, lib_python);
joinpath(exec_prefix, "lib-dynload");
strncpy(exec_prefix, volume_name, MAXPATHLEN); // "fs0:"
joinpath(exec_prefix, EXEC_PREFIX); // "fs0:/Efi/StdLib"
joinpath(exec_prefix, lib_python); // "fs0:/Efi/StdLib/lib/python.27"
joinpath(exec_prefix, "lib-dynload"); // "fs0:/Efi/StdLib/lib/python.27/lib-dynload"
/* ###########################################################################
Build the module search path.
@ -573,9 +504,9 @@ calculate_path(void)
strcpy(prefix, volume_name);
}
bufsz = strlen(prefix);
if(prefix[bufsz-1] == ':') {
prefix[bufsz] = SEP;
prefix[bufsz+1] = 0;
if(prefix[bufsz-1] == ':') { // if prefix consists solely of a volume_name
prefix[bufsz] = SEP; // then append SEP indicating the root directory
prefix[bufsz+1] = 0; // and ensure the new string is terminated
}
/* Calculate size of return buffer.

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;
@ -272,20 +268,21 @@ Py_Main(int argc, char **argv)
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++;
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;

View File

@ -1,9 +1,20 @@
/* select - Module containing unix select(2) call.
/* @file
select - Module containing unix select(2) call.
Under Unix, the file descriptors are small integers.
Under Win32, select only exists for sockets, and sockets may
have any value except INVALID_SOCKET.
Under BeOS, we suffer the same dichotomy as Win32; sockets can be anything
>= 0.
Copyright (c) 2015, Daryl McDaniel. All rights reserved.<BR>
Copyright (c) 2011 - 2012, 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"
@ -107,7 +118,7 @@ seq2set(PyObject *seq, fd_set *set, pylist fd2obj[FD_SETSIZE + 1])
v = PyObject_AsFileDescriptor( o );
if (v == -1) goto finally;
#if defined(_MSC_VER)
#if defined(_MSC_VER) && !defined(UEFI_C_SOURCE)
max = 0; /* not used for Win32 */
#else /* !_MSC_VER */
if (!_PyIsSelectable_fd(v)) {

View File

@ -1,4 +1,5 @@
/* gzguts.h -- zlib internal header definitions for gz* operations
* Copyright (c) 2015, Daryl McDaniel. All rights reserved.<BR>
* Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@ -31,7 +32,7 @@
# include <stddef.h>
#endif
#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
#if (defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)) && !defined(UEFI_C_SOURCE)
# include <io.h>
#endif
@ -42,6 +43,11 @@
# define close _close
#endif
// Needed to get the declarations for open, read, write, close
#ifdef UEFI_C_SOURCE
# include <unistd.h>
#endif
#ifdef NO_DEFLATE /* for compatibility with old definition */
# define NO_GZCOMPRESS
#endif
@ -99,7 +105,7 @@
Microsoft more than a decade later!), _snprintf does not guarantee null
termination of the result -- however this is only used in gzlib.c where
the result is assured to fit in the space provided */
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(UEFI_C_SOURCE)
# define snprintf _snprintf
#endif

View File

@ -1,7 +1,10 @@
/* zutil.h -- internal interface and configuration of the compression library
/** @file
zutil.h -- internal interface and configuration of the compression library
Copyright (C) 2015, Daryl McDaniel.<BR>
* Copyright (C) 1995-2013 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
**/
/* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is
@ -21,7 +24,7 @@
#include "zlib.h"
#if defined(STDC) && !defined(Z_SOLO)
#if defined(UEFI_C_SOURCE) || (defined(STDC) && !defined(Z_SOLO))
# if !(defined(_WIN32_WCE) && defined(_MSC_VER))
# include <stddef.h>
# endif
@ -149,7 +152,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# define fdopen(fd,mode) NULL /* No fdopen() */
#endif
#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
#if !defined(UEFI_C_SOURCE) && (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined(__INTERIX)
# if defined(_WIN32_WCE)
# define fdopen(fd,mode) NULL /* No fdopen() */
# ifndef _PTRDIFF_T_DEFINED

View File

@ -1,4 +1,15 @@
/* Long (arbitrary precision) integer object implementation */
/** @file
Long (arbitrary precision) integer object implementation.
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.
**/
/* XXX The functional organization of this file is terrible */
@ -24,6 +35,7 @@
*/
#define FIVEARY_CUTOFF 8
#undef ABS
#define ABS(x) ((x) < 0 ? -(x) : (x))
#undef MIN

View File

@ -1,10 +1,25 @@
/* 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
#include <locale.h>
// Prevent conflicts with EFI
#undef MAX
#undef MIN
#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) < (y) ? (x) : (y))

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[] =
"\
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\

View File

@ -1,8 +1,18 @@
/* Write Python objects to files and read them back.
/** @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. */
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
}
}
}

View File

@ -1,6 +1,7 @@
/** @file
Manually generated Python Configuration file for EDK II.
Copyright (c) 2015, Daryl McDaniel. All rights reserved.<BR>
Copyright (c) 2011 - 2012, 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.
@ -67,6 +68,9 @@
/* Define to 1 if you have the 'alarm' function. */
#undef HAVE_ALARM
/* Define to 1 if you have the <alloca.h> header file. */
#undef HAVE_ALLOCA_H
/* Define this if your time.h defines altzone. */
#undef HAVE_ALTZONE
@ -109,6 +113,9 @@
/* define to 1 if your sem_getvalue is broken. */
#define HAVE_BROKEN_SEM_GETVALUE 1
/* Define if 'unsetenv' does not return an int. */
#undef HAVE_BROKEN_UNSETENV
/* Define this if you have the type _Bool. */
#define HAVE_C99_BOOL 1
@ -170,10 +177,10 @@
/* Define to 1 if you have the device macros. */
#undef HAVE_DEVICE_MACROS
/* Define if we have /dev/ptc. */
/* Define to 1 if you have the /dev/ptc device file. */
#undef HAVE_DEV_PTC
/* Define if we have /dev/ptmx. */
/* Define to 1 if you have the /dev/ptmx device file. */
#undef HAVE_DEV_PTMX
/* Define to 1 if you have the <direct.h> header file. */
@ -274,11 +281,11 @@
#undef HAVE_GAMMA
/* Define if we can use gcc inline assembler to get and set x87 control word
*/
*/
#if defined(__GNUC__)
#define HAVE_GCC_ASM_FOR_X87 1
#else
#undef HAVE_GCC_ASM_FOR_X87
#undef HAVE_GCC_ASM_FOR_X87
#endif
/* Define if you have the getaddrinfo function. */
@ -290,6 +297,9 @@
/* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */
#undef HAVE_GETC_UNLOCKED
/* Define to 1 if you have the 'getentropy' function. */
#undef HAVE_GETENTROPY
/* Define to 1 if you have the 'getgroups' function. */
#undef HAVE_GETGROUPS
@ -383,6 +393,12 @@
/* Define to 1 if you have the 'initgroups' function. */
#undef HAVE_INITGROUPS
/* Define if your compiler provides int32_t. */
#undef HAVE_INT32_T
/* Define if your compiler provides int64_t. */
#undef HAVE_INT64_T
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
@ -479,6 +495,9 @@
/* Define to 1 if you have the 'mktime' function. */
#define HAVE_MKTIME 1
/* Define to 1 if you have the 'mmap' function. */
#undef HAVE_MMAP
/* Define to 1 if you have the 'mremap' function. */
#undef HAVE_MREMAP
@ -524,6 +543,9 @@
/* Define if you have GNU PTH threads. */
#undef HAVE_PTH
/* Define to 1 if you have the 'pthread_atfork' function. */
#undef HAVE_PTHREAD_ATFORK
/* Defined for Solaris 2.6 bug in pthread header. */
#undef HAVE_PTHREAD_DESTRUCTOR
@ -542,6 +564,9 @@
/* Define to 1 if you have the 'putenv' function. */
#undef HAVE_PUTENV
/* Define if the libcrypto has RAND_egd */
#undef HAVE_RAND_EGD
/* Define to 1 if you have the 'readlink' function. */
#undef HAVE_READLINK
@ -717,6 +742,12 @@
/* Define to 1 if 'st_rdev' is a member of 'struct stat'. */
#undef HAVE_STRUCT_STAT_ST_RDEV
/* Define to 1 if 'st_dev' is a member of 'struct stat'. */
#undef HAVE_STRUCT_STAT_ST_DEV
/* Define to 1 if 'st_ino' is a member of 'struct stat'. */
#undef HAVE_STRUCT_STAT_ST_INO
/* Define to 1 if 'tm_zone' is a member of 'struct tm'. */
#undef HAVE_STRUCT_TM_TM_ZONE
@ -863,6 +894,12 @@
/* Define this if you have tcl and TCL_UTF_MAX==6 */
#undef HAVE_UCS4_TCL
/* Define if your compiler provides uint32_t. */
#undef HAVE_UINT32_T
/* Define if your compiler provides uint64_t. */
#undef HAVE_UINT64_T
/* Define to 1 if the system has the type 'uintptr_t'. */
#define HAVE_UINTPTR_T 1
@ -932,22 +969,22 @@
#undef MVWDELCH_IS_EXPRESSION
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "edk2-devel@lists.sourceforge.net"
#define PACKAGE_BUGREPORT "edk2-devel@lists.01.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "EDK II Python Package"
#define PACKAGE_NAME "EDK II Python 2.7.10 Package"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "EDK II Python Package V0.8"
#define PACKAGE_STRING "EDK II Python 2.7.10 Package V0.1"
/* Define to the one symbol short name of this package. */
#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/"
/* Define to the version of this package. */
#define PACKAGE_VERSION "V0.8"
#define PACKAGE_VERSION "V0.1"
/* Define if POSIX semaphores aren't enabled on your system */
#define POSIX_SEMAPHORES_NOT_ENABLED 1
@ -1160,13 +1197,14 @@
/* This must be defined on some systems to enable large file support. */
#undef _LARGEFILE_SOURCE
/* This must be defined on AIX systems to enable large file support. */
#undef _LARGE_FILES
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define on NetBSD to activate all library features */
#ifndef _NETBSD_SOURCE
#define _NETBSD_SOURCE 1
#endif
#define _NETBSD_SOURCE 1
/* Define _OSF_SOURCE to get the makedev macro. */
#undef _OSF_SOURCE
@ -1264,3 +1302,4 @@
//#undef volatile
#endif /*Py_PYCONFIG_H*/