]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.10/Py2710ReadMe.txt
AppPkg/.../Python-2.7.10: ReadMe and .inf files
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.10 / Py2710ReadMe.txt
index 7d8b31f74b69dbe6275a52c182d49d9cfcd18023..e94db2ca489102c469443a924bc3e8b9733832ea 100644 (file)
@@ -1,23 +1,24 @@
                                 EDK II Python\r
-                                    ReadMe\r
-                                 Release 1.02\r
-                                 18 Jan. 2013\r
+                                   ReadMe\r
+                                Version 2.7.10\r
+                                 Release 1.00\r
+                                  3 Nov. 2015\r
 \r
 \r
 1. OVERVIEW\r
 ===========\r
 This document is devoted to general information on building and setup of the\r
-Python environment for UEFI 2.3, the invocation of the interpreter, and things\r
+Python environment for UEFI, the invocation of the interpreter, and things\r
 that make working with Python easier.\r
 \r
-It is assumed that you already have either UDK2010 or a current snapshot of\r
+It is assumed that you already have UDK2010 or later, or a current snapshot of\r
 the EDK II sources from www.tianocore.org, and that you can successfully build\r
 packages within that distribution.\r
 \r
 2. Release Notes\r
 ================\r
   1)  All C extension modules must be statically linked (built in)\r
-  2)  The site and os modules must exist as discrete files in ...\lib\python.27\r
+  2)  The site and os modules must exist as discrete files in ...\lib\python27.10\r
   3)  User-specific configurations are not supported.\r
   4)  Environment variables are not supported.\r
 \r
@@ -25,23 +26,39 @@ packages within that distribution.
 ======================================================\r
   3.1 Getting Python\r
   ==================\r
-  Currently only version 2.7.2 of the CPython distribution is supported.  For development\r
-  ease, a subset of the Python 2.7.2 distribution has been included in the AppPkg source\r
-  tree.  If a full distribution is desired, the Python-2.7.2 directory can be removed or\r
-  renamed and the full source code downloaded from http://www.python.org/ftp/python/2.7.2/.\r
+  This file describes the UEFI port of version 2.7.10 of the CPython distribution.\r
+  For development ease, a subset of the Python 2.7.10 distribution has been\r
+  included as part of the AppPkg/Applications/Python/Python-2.7.10 source tree.\r
+  If this is sufficient, you may skip to section 3.2, Building Python.\r
+\r
+  If a full distribution is desired, it can be merged into the Python-2.7.10\r
+  source tree.  Directory AppPkg/Applications/Python/Python-2.7.10 corresponds\r
+  to the root directory of the CPython 2.7.10 distribution.  The full\r
+  CPython 2.7.10 source code may be downloaded from\r
+  http://www.python.org/ftp/python/2.7.10/.\r
 \r
   A.  Within your EDK II development tree, extract the Python distribution into\r
-    AppPkg/Applications/Python.  This should create the\r
-    AppPkg/Applications/Python/Python-2.7.2 directory.\r
+    AppPkg/Applications/Python/Python-2.7.10.  This should merge the additional\r
+    files into the source tree.  It will also create the following directories:\r
+        Demo      Doc         Grammar     Mac       Misc\r
+        PC        PCbuild     RISCOS      Tools\r
 \r
-  B.  Copy the files from PyMod-2.7.2 into the corresponding directories within\r
-    the Python-2.7.2 tree.  This will overwrite existing files with files\r
-    modified for UEFI usage.\r
+    The greatest change will be within the Python-2.7.10/Lib directory where\r
+    many more packages and modules will be added.  These additional components\r
+    may not have been ported to EDK II yet.\r
 \r
   3.2 Building Python\r
   ===================\r
-  A.  Edit Efi/config.c to enable the built-in modules you need.\r
-        Mandatory Built-in Modules:\r
+  B.  From the AppPkg/Applications/Python/Python-2.7.10 directory, execute the\r
+    srcprep.bat (srcprep.sh) script to copy the header files from within the\r
+    PyMod-2.7.10 sub-tree into their corresponding directories within the\r
+    distribution.  This step only needs to be performed prior to the first\r
+    build of Python, or if one of the header files within the PyMod tree has been\r
+    modified.\r
+\r
+  A.  Edit PyMod-2.7.10\Modules\config.c to enable the built-in modules you need.\r
+    By default, it is configured for the minimally required set of modules.\r
+      Mandatory Built-in Modules:\r
         edk2      errno       imp         marshal\r
 \r
       Additional built-in modules which are required to use the help()\r
@@ -51,10 +68,10 @@ packages within that distribution.
         cStringIO   gc              itertools     math\r
         operator    time\r
 \r
-  B.  Edit AppPkg/AppPkg.dsc to enable (uncomment) the PythonCore.inf line\r
+  B.  Edit AppPkg/AppPkg.dsc to enable (uncomment) the Python2710.inf line\r
     within the [Components] section.\r
 \r
-  C.  Build AppPkg, which includes Python, using the standard "build" command:\r
+  C.  Build AppPkg using the standard "build" command:\r
     For example, to build Python for an X64 CPU architecture:\r
                     build -a X64 -p AppPkg\AppPkg.dsc\r
 \r
@@ -70,25 +87,28 @@ target system.
        |- \etc                      Configuration files used by libraries.\r
        |- \tmp                      Temporary files created by tmpfile(), etc.\r
        |- \lib                      Root of the libraries tree.\r
-           |- \python.27            Directory containing the Python library modules.\r
+           |- \python27.10          Directory containing the Python library modules.\r
                |- \lib-dynload      Dynamically loadable Python extensions.\r
                |- \site-packages    Site-specific packages and modules.\r
 \r
+  NOTE: The name of the directory containing the Python library modules has\r
+        changed in order to distinguish it from the library modules for\r
+        version 2.7.2.\r
 \r
 5. Installing Python\r
 ====================\r
 These directories, on the target system, are populated from the development\r
 system as follows:\r
 \r
-  * \Efi\Tools receives a copy of Build/AppPkg/DEBUG_VS2005/X64/Python.efi.\r
-                                               ^^^^^ ^^^^^^\r
-    Modify the host path to match the your build type and compiler.\r
+  * \Efi\Tools receives a copy of Build/AppPkg/DEBUG_VS2015/X64/Python.efi.\r
+                                               ^^^^^^^^^^^^\r
+    Modify the host path to match your build type and compiler.\r
 \r
   * The \Efi\StdLib\etc directory is populated from the StdLib/Efi/StdLib/etc\r
     source directory.\r
 \r
-  * Directory \Efi\StdLib\lib\python.27 is populated with packages and modules\r
-    from the AppPkg/Applications/Python/Python-2.7.2/Lib directory.\r
+  * Directory \Efi\StdLib\lib\python27.10 is populated with packages and modules\r
+    from the AppPkg/Applications/Python/Python-2.7.10/Lib directory.\r
     The recommended minimum set of modules (.py, .pyc, and/or .pyo):\r
         os      stat      ntpath      warnings      traceback\r
         site    types     copy_reg    linecache     genericpath\r
@@ -97,21 +117,53 @@ system as follows:
     the \Efi\StdLib\lib\python.27\lib-dynload directory.  This functionality is not\r
     yet implemented.\r
 \r
+  A script, libprep.bat (libprep.sh), is provided which facilitates the population\r
+  of the target Lib directory.  Execute this script from within the\r
+  AppPkg/Applications/Python/Python-2.7.10 directory, providing a single argument\r
+  which is the path to the destination directory.  The appropriate contents of the\r
+  AppPkg/Applications/Python/Python-2.7.10/Lib and\r
+  AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Lib directories will be\r
+  recursively copied into the specified destination directory.\r
 \r
 6. Example: Enabling socket support\r
 ===================================\r
   1.  enable {"_socket", init_socket}, in Efi\config.c\r
-  2.  enable Python-2.7.2/Modules/socketmodule.c in PythonCore.inf.\r
-  3.  copy socket.py over to /Efi/StdLib/lib/python.27 on your target system.\r
-  4.  Make sure dependent modules are present(.py) or built in(.c):\r
-        functools, types, os, sys, warnings, cStringIO, StringIO, errno\r
-\r
-  5.  build -a X64 -p AppPkg\AppPkg.dsc\r
-  6.  copy Build\AppPkg\DEBUG_VS2005\X64\Python.efi to \Efi\Tools on your target system.\r
-                                ^^^^ Modify as needed\r
-\r
-\r
-7. Supported C Modules\r
+  2.  enable LibraryClasses BsdSocketLib and EfiSocketLib in PythonCore.inf.\r
+  3.  Build Python2710\r
+          build -a X64 -p AppPkg\AppPkg.dsc\r
+  6.  copy Build\AppPkg\DEBUG_VS2005\X64\Python2710.efi to \Efi\Tools on your target system.\r
+                        ^^^^^^^^^^^^ Modify as needed\r
+\r
+7. Running Python\r
+=================\r
+  Python must currently be run from an EFI FAT-32 partition, or volume, under\r
+  the UEFI Shell.  At the Shell prompt enter the desired volume name, followed\r
+  by a colon ':', then press Enter.  Python can then be executed by typing its\r
+  name, followed by any desired options and arguments.\r
+\r
+  EXAMPLE:\r
+      2.0 Shell> fs0:\r
+      2.0 FS0:\> python2710\r
+      Python 2.7.10 (default, Oct 13 2015, 16:21:53) [C] on uefi\r
+      Type "help", "copyright", "credits" or "license" for more information.\r
+      >>> exit()\r
+      2.0 FS0:\>\r
+\r
+  NOTE:\r
+      Python, as distributed, sends its interactive prompts to stderr.  If\r
+      STDERR isn't enabled in UEFI Setup so that it's output goes to the console,\r
+      it may appear that Python hangs on startup.  If this happens, one may\r
+      be able to rectify the condition by typing "exit()" followed by <enter>\r
+      to exit out of Python.  Then, type "exit" at the Shell prompt which should\r
+      enter Setup.\r
+\r
+  NOTE:\r
+      Some platforms don't include the Setup utility, or don't allow STDERR to\r
+      be modified.  In these cases, Python may be started with the '-#' option\r
+      which will cause stderr to be the same as stdout and should allow\r
+      Python to be used interactively on those platforms.\r
+\r
+8. Supported C Modules\r
 ======================\r
     Module Name               C File(s)\r
   ===============       =============================================\r
@@ -166,7 +218,7 @@ system as follows:
   zlib                  Modules/zlibmodule.c          Modules/zlib/*\r
 \r
 \r
-8. Tested Python Library Modules\r
+9. Tested Python Library Modules\r
 ================================\r
 This is a partial list of the packages and modules of the Python Standard\r
 Library that have been tested or used in some manner.\r