mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-31 01:24:12 +02:00
AppPkg/.../Python: Clean up and document how to escape the -# option.
Depending upon the version of Shell you are using, it may be necessary to escape the '#' character, when using the "-#" command-line option, so that the Shell doesn't interpret it as the start of a comment. The escape character is '^'. Example: python -^# -V * General updating. * Re-format so that no line is longer than 80 char. * Add note about escaping the "-#" command-line option. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel <edk2-lists@mc2research.org> Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19594 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
b954a4fe01
commit
27c19606b0
@ -49,14 +49,14 @@ packages within that distribution.
|
|||||||
|
|
||||||
3.2 Building Python
|
3.2 Building Python
|
||||||
===================
|
===================
|
||||||
B. From the AppPkg/Applications/Python/Python-2.7.10 directory, execute the
|
A. From the AppPkg/Applications/Python/Python-2.7.10 directory, execute the
|
||||||
srcprep.bat (srcprep.sh) script to copy the header files from within the
|
srcprep.bat (srcprep.sh) script to copy the header files from within the
|
||||||
PyMod-2.7.10 sub-tree into their corresponding directories within the
|
PyMod-2.7.10 sub-tree into their corresponding directories within the
|
||||||
distribution. This step only needs to be performed prior to the first
|
distribution. This step only needs to be performed prior to the first
|
||||||
build of Python, or if one of the header files within the PyMod tree has been
|
build of Python, or if one of the header files within the PyMod tree has been
|
||||||
modified.
|
modified.
|
||||||
|
|
||||||
A. Edit PyMod-2.7.10\Modules\config.c to enable the built-in modules you need.
|
B. Edit PyMod-2.7.10\Modules\config.c to enable the built-in modules you need.
|
||||||
By default, it is configured for the minimally required set of modules.
|
By default, it is configured for the minimally required set of modules.
|
||||||
Mandatory Built-in Modules:
|
Mandatory Built-in Modules:
|
||||||
edk2 errno imp marshal
|
edk2 errno imp marshal
|
||||||
@ -68,10 +68,10 @@ packages within that distribution.
|
|||||||
cStringIO gc itertools math
|
cStringIO gc itertools math
|
||||||
operator time
|
operator time
|
||||||
|
|
||||||
B. Edit AppPkg/AppPkg.dsc to enable (uncomment) the Python2710.inf line
|
C. Edit AppPkg/AppPkg.dsc to enable (uncomment) the Python2710.inf line
|
||||||
within the [Components] section.
|
within the [Components] section.
|
||||||
|
|
||||||
C. Build AppPkg using the standard "build" command:
|
D. Build AppPkg using the standard "build" command:
|
||||||
For example, to build Python for an X64 CPU architecture:
|
For example, to build Python for an X64 CPU architecture:
|
||||||
build -a X64 -p AppPkg\AppPkg.dsc
|
build -a X64 -p AppPkg\AppPkg.dsc
|
||||||
|
|
||||||
@ -87,7 +87,8 @@ target system.
|
|||||||
|- \etc Configuration files used by libraries.
|
|- \etc Configuration files used by libraries.
|
||||||
|- \tmp Temporary files created by tmpfile(), etc.
|
|- \tmp Temporary files created by tmpfile(), etc.
|
||||||
|- \lib Root of the libraries tree.
|
|- \lib Root of the libraries tree.
|
||||||
|- \python27.10 Directory containing the Python library modules.
|
|- \python27.10 Directory containing the Python library
|
||||||
|
| modules.
|
||||||
|- \lib-dynload Dynamically loadable Python extensions.
|
|- \lib-dynload Dynamically loadable Python extensions.
|
||||||
|- \site-packages Site-specific packages and modules.
|
|- \site-packages Site-specific packages and modules.
|
||||||
|
|
||||||
@ -100,8 +101,8 @@ target system.
|
|||||||
These directories, on the target system, are populated from the development
|
These directories, on the target system, are populated from the development
|
||||||
system as follows:
|
system as follows:
|
||||||
|
|
||||||
* \Efi\Tools receives a copy of Build/AppPkg/DEBUG_VS2015/X64/Python.efi.
|
* \Efi\Tools receives a copy of Build/AppPkg/DEBUG_VS2015/X64/Python2710.efi.
|
||||||
^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^
|
||||||
Modify the host path to match your build type and compiler.
|
Modify the host path to match your build type and compiler.
|
||||||
|
|
||||||
* The \Efi\StdLib\etc directory is populated from the StdLib/Efi/StdLib/etc
|
* The \Efi\StdLib\etc directory is populated from the StdLib/Efi/StdLib/etc
|
||||||
@ -131,8 +132,9 @@ system as follows:
|
|||||||
2. enable LibraryClasses BsdSocketLib and EfiSocketLib in PythonCore.inf.
|
2. enable LibraryClasses BsdSocketLib and EfiSocketLib in PythonCore.inf.
|
||||||
3. Build Python2710
|
3. Build Python2710
|
||||||
build -a X64 -p AppPkg\AppPkg.dsc
|
build -a X64 -p AppPkg\AppPkg.dsc
|
||||||
6. copy Build\AppPkg\DEBUG_VS2005\X64\Python2710.efi to \Efi\Tools on your target system.
|
6. copy Build\AppPkg\DEBUG_VS2005\X64\Python2710.efi to \Efi\Tools on your
|
||||||
^^^^^^^^^^^^ Modify as needed
|
target system. Replace "DEBUG_VS2005\X64", in the source path, with
|
||||||
|
values appropriate for your tool chain and processor architecture.
|
||||||
|
|
||||||
7. Running Python
|
7. Running Python
|
||||||
=================
|
=================
|
||||||
@ -151,11 +153,12 @@ system as follows:
|
|||||||
|
|
||||||
NOTE:
|
NOTE:
|
||||||
Python, as distributed, sends its interactive prompts to stderr. If
|
Python, as distributed, sends its interactive prompts to stderr. If
|
||||||
STDERR isn't enabled in UEFI Setup so that it's output goes to the console,
|
STDERR isn't enabled in UEFI Setup so that it's output goes to the
|
||||||
it may appear that Python hangs on startup. If this happens, one may
|
console, it may appear that Python hangs on startup. If this happens,
|
||||||
be able to rectify the condition by typing "exit()" followed by <enter>
|
one may be able to rectify the condition by typing "exit()" followed
|
||||||
to exit out of Python. Then, type "exit" at the Shell prompt which should
|
by <enter> to exit out of Python. Then, type "exit" at the Shell prompt
|
||||||
enter Setup.
|
which should enter Setup where you can use the Boot Maintenance
|
||||||
|
Manager to modify your Console settings.
|
||||||
|
|
||||||
NOTE:
|
NOTE:
|
||||||
Some platforms don't include the Setup utility, or don't allow STDERR to
|
Some platforms don't include the Setup utility, or don't allow STDERR to
|
||||||
@ -163,6 +166,12 @@ system as follows:
|
|||||||
which will cause stderr to be the same as stdout and should allow
|
which will cause stderr to be the same as stdout and should allow
|
||||||
Python to be used interactively on those platforms.
|
Python to be used interactively on those platforms.
|
||||||
|
|
||||||
|
Depending upon the version of Shell you are using, it may be necessary
|
||||||
|
to escape the '#' character so that the Shell doesn't interpret it as
|
||||||
|
the start of a comment. The escape character is '^'.
|
||||||
|
Example:
|
||||||
|
python -^# -V
|
||||||
|
|
||||||
8. Supported C Modules
|
8. Supported C Modules
|
||||||
======================
|
======================
|
||||||
Module Name C File(s)
|
Module Name C File(s)
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
EDK II Python
|
EDK II Python
|
||||||
ReadMe
|
ReadMe
|
||||||
Release 1.02
|
Version 2.7.2
|
||||||
18 Jan. 2013
|
Release 1.02
|
||||||
|
18 Jan. 2013
|
||||||
|
|
||||||
|
|
||||||
1. OVERVIEW
|
1. OVERVIEW
|
||||||
@ -25,10 +26,10 @@ packages within that distribution.
|
|||||||
======================================================
|
======================================================
|
||||||
3.1 Getting Python
|
3.1 Getting Python
|
||||||
==================
|
==================
|
||||||
Currently only version 2.7.2 of the CPython distribution is supported. For development
|
For development ease, a subset of the Python 2.7.2 distribution has been
|
||||||
ease, a subset of the Python 2.7.2 distribution has been included in the AppPkg source
|
included in the AppPkg source tree. If a full distribution is desired, the
|
||||||
tree. If a full distribution is desired, the Python-2.7.2 directory can be removed or
|
Python-2.7.2 directory can be removed or renamed and the full source code
|
||||||
renamed and the full source code downloaded from http://www.python.org/ftp/python/2.7.2/.
|
downloaded from http://www.python.org/ftp/python/2.7.2/.
|
||||||
|
|
||||||
A. Within your EDK II development tree, extract the Python distribution into
|
A. Within your EDK II development tree, extract the Python distribution into
|
||||||
AppPkg/Applications/Python. This should create the
|
AppPkg/Applications/Python. This should create the
|
||||||
@ -70,7 +71,8 @@ target system.
|
|||||||
|- \etc Configuration files used by libraries.
|
|- \etc Configuration files used by libraries.
|
||||||
|- \tmp Temporary files created by tmpfile(), etc.
|
|- \tmp Temporary files created by tmpfile(), etc.
|
||||||
|- \lib Root of the libraries tree.
|
|- \lib Root of the libraries tree.
|
||||||
|- \python.27 Directory containing the Python library modules.
|
|- \python.27 Directory containing the Python library
|
||||||
|
| modules.
|
||||||
|- \lib-dynload Dynamically loadable Python extensions.
|
|- \lib-dynload Dynamically loadable Python extensions.
|
||||||
|- \site-packages Site-specific packages and modules.
|
|- \site-packages Site-specific packages and modules.
|
||||||
|
|
||||||
@ -81,7 +83,7 @@ These directories, on the target system, are populated from the development
|
|||||||
system as follows:
|
system as follows:
|
||||||
|
|
||||||
* \Efi\Tools receives a copy of Build/AppPkg/DEBUG_VS2005/X64/Python.efi.
|
* \Efi\Tools receives a copy of Build/AppPkg/DEBUG_VS2005/X64/Python.efi.
|
||||||
^^^^^ ^^^^^^
|
^^^^^ ^^^^^^^^^^
|
||||||
Modify the host path to match the your build type and compiler.
|
Modify the host path to match the your build type and compiler.
|
||||||
|
|
||||||
* The \Efi\StdLib\etc directory is populated from the StdLib/Efi/StdLib/etc
|
* The \Efi\StdLib\etc directory is populated from the StdLib/Efi/StdLib/etc
|
||||||
@ -94,8 +96,8 @@ system as follows:
|
|||||||
site types copy_reg linecache genericpath
|
site types copy_reg linecache genericpath
|
||||||
|
|
||||||
* Python C Extension Modules built as dynamically loadable extensions go into
|
* Python C Extension Modules built as dynamically loadable extensions go into
|
||||||
the \Efi\StdLib\lib\python.27\lib-dynload directory. This functionality is not
|
the \Efi\StdLib\lib\python.27\lib-dynload directory. This functionality is
|
||||||
yet implemented.
|
not yet implemented.
|
||||||
|
|
||||||
|
|
||||||
6. Example: Enabling socket support
|
6. Example: Enabling socket support
|
||||||
@ -107,11 +109,48 @@ system as follows:
|
|||||||
functools, types, os, sys, warnings, cStringIO, StringIO, errno
|
functools, types, os, sys, warnings, cStringIO, StringIO, errno
|
||||||
|
|
||||||
5. build -a X64 -p AppPkg\AppPkg.dsc
|
5. build -a X64 -p AppPkg\AppPkg.dsc
|
||||||
6. copy Build\AppPkg\DEBUG_VS2005\X64\Python.efi to \Efi\Tools on your target system.
|
6. copy Build\AppPkg\DEBUG_VS2005\X64\Python.efi to \Efi\Tools on your
|
||||||
^^^^ Modify as needed
|
target system. Replace "DEBUG_VS2005\X64", in the source path, with
|
||||||
|
values appropriate for your tool chain and processor architecture.
|
||||||
|
|
||||||
|
|
||||||
7. Supported C Modules
|
7. Running Python
|
||||||
|
=================
|
||||||
|
Python must currently be run from an EFI FAT-32 partition, or volume, under
|
||||||
|
the UEFI Shell. At the Shell prompt enter the desired volume name, followed
|
||||||
|
by a colon ':', then press Enter. Python can then be executed by typing its
|
||||||
|
name, followed by any desired options and arguments.
|
||||||
|
|
||||||
|
EXAMPLE:
|
||||||
|
2.0 Shell> fs0:
|
||||||
|
2.0 FS0:\> python
|
||||||
|
Python 2.7.2 (default, Oct 13 2015, 16:21:53) [C] on uefi
|
||||||
|
Type "help", "copyright", "credits" or "license" for more information.
|
||||||
|
>>> exit()
|
||||||
|
2.0 FS0:\>
|
||||||
|
|
||||||
|
NOTE:
|
||||||
|
Python, as distributed, sends its interactive prompts to stderr. If
|
||||||
|
STDERR isn't enabled in UEFI Setup so that it's output goes to the
|
||||||
|
console, it may appear that Python hangs on startup. If this happens,
|
||||||
|
one may be able to rectify the condition by typing "exit()" followed
|
||||||
|
by <enter> to exit out of Python. Then, type "exit" at the Shell prompt
|
||||||
|
which should enter Setup where you can use the Boot Maintenance
|
||||||
|
Manager to modify your Console settings.
|
||||||
|
|
||||||
|
NOTE:
|
||||||
|
Some platforms don't include the Setup utility, or don't allow STDERR to
|
||||||
|
be modified. In these cases, Python may be started with the '-#' option
|
||||||
|
which will cause stderr to be the same as stdout and should allow
|
||||||
|
Python to be used interactively on those platforms.
|
||||||
|
|
||||||
|
Depending upon the version of Shell you are using, it may be necessary
|
||||||
|
to escape the '#' character so that the Shell doesn't interpret it as
|
||||||
|
the start of a comment. The escape character is '^'.
|
||||||
|
Example:
|
||||||
|
python -^# -V
|
||||||
|
|
||||||
|
8. Supported C Modules
|
||||||
======================
|
======================
|
||||||
Module Name C File(s)
|
Module Name C File(s)
|
||||||
=============== =============================================
|
=============== =============================================
|
||||||
@ -166,7 +205,7 @@ system as follows:
|
|||||||
zlib Modules/zlibmodule.c Modules/zlib/*
|
zlib Modules/zlibmodule.c Modules/zlib/*
|
||||||
|
|
||||||
|
|
||||||
8. Tested Python Library Modules
|
9. Tested Python Library Modules
|
||||||
================================
|
================================
|
||||||
This is a partial list of the packages and modules of the Python Standard
|
This is a partial list of the packages and modules of the Python Standard
|
||||||
Library that have been tested or used in some manner.
|
Library that have been tested or used in some manner.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user