]> git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Python/Python-2.7.10/Py2710ReadMe.txt
AppPkg/Applications/Python/Python-2.7.10: Initial Checkin part 5/5.
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.10 / Py2710ReadMe.txt
1 EDK II Python
2 ReadMe
3 Release 1.02
4 18 Jan. 2013
5
6
7 1. OVERVIEW
8 ===========
9 This document is devoted to general information on building and setup of the
10 Python environment for UEFI 2.3, the invocation of the interpreter, and things
11 that make working with Python easier.
12
13 It is assumed that you already have either UDK2010 or a current snapshot of
14 the EDK II sources from www.tianocore.org, and that you can successfully build
15 packages within that distribution.
16
17 2. Release Notes
18 ================
19 1) All C extension modules must be statically linked (built in)
20 2) The site and os modules must exist as discrete files in ...\lib\python.27
21 3) User-specific configurations are not supported.
22 4) Environment variables are not supported.
23
24 3. Getting and Building Python
25 ======================================================
26 3.1 Getting Python
27 ==================
28 Currently only version 2.7.2 of the CPython distribution is supported. For development
29 ease, a subset of the Python 2.7.2 distribution has been included in the AppPkg source
30 tree. If a full distribution is desired, the Python-2.7.2 directory can be removed or
31 renamed and the full source code downloaded from http://www.python.org/ftp/python/2.7.2/.
32
33 A. Within your EDK II development tree, extract the Python distribution into
34 AppPkg/Applications/Python. This should create the
35 AppPkg/Applications/Python/Python-2.7.2 directory.
36
37 B. Copy the files from PyMod-2.7.2 into the corresponding directories within
38 the Python-2.7.2 tree. This will overwrite existing files with files
39 modified for UEFI usage.
40
41 3.2 Building Python
42 ===================
43 A. Edit Efi/config.c to enable the built-in modules you need.
44 Mandatory Built-in Modules:
45 edk2 errno imp marshal
46
47 Additional built-in modules which are required to use the help()
48 functionality provided by PyDoc, are:
49 _codecs _collections _functools _random
50 _sre _struct _weakref binascii
51 cStringIO gc itertools math
52 operator time
53
54 B. Edit AppPkg/AppPkg.dsc to enable (uncomment) the PythonCore.inf line
55 within the [Components] section.
56
57 C. Build AppPkg, which includes Python, using the standard "build" command:
58 For example, to build Python for an X64 CPU architecture:
59 build -a X64 -p AppPkg\AppPkg.dsc
60
61 4. Python-related paths and files
62 =================================
63 Python depends upon the existence of several directories and files on the
64 target system.
65
66 \EFI Root of the UEFI system area.
67 |- \Tools Location of the Python.efi executable.
68 |- \Boot UEFI specified Boot directory.
69 |- \StdLib Root of the Standard Libraries sub-tree.
70 |- \etc Configuration files used by libraries.
71 |- \tmp Temporary files created by tmpfile(), etc.
72 |- \lib Root of the libraries tree.
73 |- \python.27 Directory containing the Python library modules.
74 |- \lib-dynload Dynamically loadable Python extensions.
75 |- \site-packages Site-specific packages and modules.
76
77
78 5. Installing Python
79 ====================
80 These directories, on the target system, are populated from the development
81 system as follows:
82
83 * \Efi\Tools receives a copy of Build/AppPkg/DEBUG_VS2005/X64/Python.efi.
84 ^^^^^ ^^^^^^
85 Modify the host path to match the your build type and compiler.
86
87 * The \Efi\StdLib\etc directory is populated from the StdLib/Efi/StdLib/etc
88 source directory.
89
90 * Directory \Efi\StdLib\lib\python.27 is populated with packages and modules
91 from the AppPkg/Applications/Python/Python-2.7.2/Lib directory.
92 The recommended minimum set of modules (.py, .pyc, and/or .pyo):
93 os stat ntpath warnings traceback
94 site types copy_reg linecache genericpath
95
96 * Python C Extension Modules built as dynamically loadable extensions go into
97 the \Efi\StdLib\lib\python.27\lib-dynload directory. This functionality is not
98 yet implemented.
99
100
101 6. Example: Enabling socket support
102 ===================================
103 1. enable {"_socket", init_socket}, in Efi\config.c
104 2. enable Python-2.7.2/Modules/socketmodule.c in PythonCore.inf.
105 3. copy socket.py over to /Efi/StdLib/lib/python.27 on your target system.
106 4. Make sure dependent modules are present(.py) or built in(.c):
107 functools, types, os, sys, warnings, cStringIO, StringIO, errno
108
109 5. build -a X64 -p AppPkg\AppPkg.dsc
110 6. copy Build\AppPkg\DEBUG_VS2005\X64\Python.efi to \Efi\Tools on your target system.
111 ^^^^ Modify as needed
112
113
114 7. Supported C Modules
115 ======================
116 Module Name C File(s)
117 =============== =============================================
118 _ast Python/Python-ast.c
119 _bisect Modules/_bisectmodule.c
120 _codecs Modules/_codecsmodule.c
121 _codecs_cn Modules/cjkcodecs/_codecs_cn.c
122 _codecs_hk Modules/cjkcodecs/_codecs_hk.c
123 _codecs_iso2022 Modules/cjkcodecs/_codecs_iso2022.c
124 _codecs_jp Modules/cjkcodecs/_codecs_jp
125 _codecs_kr Modules/cjkcodecs/_codecs_kr
126 _codecs_tw Modules/cjkcodecs/_codecs_tw
127 _collections Modules/_collectionsmodule.c
128 _csv Modules/_csv.c
129 _functools Modules/_functoolsmodule.c
130 _heapq Modules/_heapqmodule.c
131 _io Modules/_io/_iomodule.c Modules/_io/*
132 _json Modules/_json.c
133 _md5 Modules/md5module.c Modules/md5.c
134 _multibytecodec Modules/cjkcodecs/_multibytecodec.c
135 _random Modules/_randommodule.c
136 _sha Modules/shamodule.c
137 _sha256 Modules/sha256module.c
138 _sha512 Modules/sha512module.c
139 _socket Modules/socketmodule.c
140 _sre Modules/_sre.c
141 _struct Modules/_struct.c
142 _symtable Modules/symtablemodule.c
143 _weakref Modules/_weakref.c
144 array Modules/arraymodule.c
145 binascii Modules/binascii.c
146 cmath Modules/cmathmodule.c
147 cPickle Modules/cPickle.c
148 cStringIO Modules/cStringIO.c
149 datetime Modules/datetimemodule.c
150 edk2 Modules/Efi/edk2module.c
151 errno Modules/errnomodule.c
152 future_builtins Modules/future_builtins.c
153 gc Modules/gcmodule.c
154 imp Python/import.c
155 itertools Modules/itertoolsmodule.c
156 marshal Python/marshal.c
157 math Modules/mathmodule.c Modules/_math.c
158 operator Modules/operator.c
159 parser Modules/parsermodule.c
160 select Modules/selectmodule.c
161 signal Modules/signalmodule.c
162 strop Modules/stropmodule.c
163 time Modules/timemodule.c
164 xxsubtype Modules/xxsubtype.c
165 zipimport Modules/zipimport.c
166 zlib Modules/zlibmodule.c Modules/zlib/*
167
168
169 8. Tested Python Library Modules
170 ================================
171 This is a partial list of the packages and modules of the Python Standard
172 Library that have been tested or used in some manner.
173
174 encodings genericpath.py sha.py
175 importlib getopt.py SimpleHTTPServer.py
176 json hashlib.py site.py
177 pydoc_data heapq.py socket.py
178 xml HTMLParser.py SocketServer.py
179 abc.py inspect.py sre.py
180 argparse.py io.py sre_compile.py
181 ast.py keyword.py sre_constants.py
182 atexit.py linecache.py sre_parse.py
183 BaseHTTPServer.py locale.py stat.py
184 binhex.py md5.py string.py
185 bisect.py modulefinder.py StringIO.py
186 calendar.py ntpath.py struct.py
187 cmd.py numbers.py textwrap.py
188 codecs.py optparse.py token.py
189 collections.py os.py tokenize.py
190 copy.py platform.py traceback.py
191 copy_reg.py posixpath.py types.py
192 csv.py pydoc.py warnings.py
193 dummy_thread.py random.py weakref.py
194 fileinput.py re.py xmllib.py
195 formatter.py repr.py zipfile.py
196 functools.py runpy.py expat
197
198 # # #