• Home
Name Date Size #Lines LOC

..--

_asyncio.vcxprojD03-May-20243.1 KiB7877

_asyncio.vcxproj.filtersD03-May-2024535 1616

_bz2.vcxprojD03-May-20244 KiB9696

_bz2.vcxproj.filtersD03-May-20241.8 KiB4948

_ctypes.vcxprojD03-May-20244.9 KiB111111

_ctypes.vcxproj.filtersD03-May-20242.4 KiB6565

_ctypes_test.vcxprojD03-May-20243.1 KiB8080

_ctypes_test.vcxproj.filtersD03-May-2024738 2121

_decimal.vcxprojD03-May-20246 KiB125124

_decimal.vcxproj.filtersD03-May-20244.4 KiB116116

_elementtree.vcxprojD03-May-20244.5 KiB105104

_elementtree.vcxproj.filtersD03-May-20242.6 KiB7675

_freeze_importlib.vcxprojD03-May-20245.4 KiB120116

_freeze_importlib.vcxproj.filtersD03-May-20241.1 KiB2827

_hashlib.vcxprojD03-May-20243.3 KiB8483

_hashlib.vcxproj.filtersD03-May-2024448 1313

_lzma.vcxprojD03-May-20243.8 KiB9190

_lzma.vcxproj.filtersD03-May-2024447 1313

_msi.vcxprojD03-May-20243.2 KiB8282

_msi.vcxproj.filtersD03-May-2024435 1313

_multiprocessing.vcxprojD03-May-20243.4 KiB8686

_multiprocessing.vcxproj.filtersD03-May-2024884 2424

_overlapped.vcxprojD03-May-20243.2 KiB8282

_overlapped.vcxproj.filtersD03-May-2024446 1313

_queue.vcxprojD03-May-20243.1 KiB7877

_queue.vcxproj.filtersD03-May-2024533 1616

_socket.vcxprojD03-May-20243.3 KiB8585

_socket.vcxproj.filtersD03-May-2024722 2121

_sqlite3.vcxprojD03-May-20244.6 KiB106106

_sqlite3.vcxproj.filtersD03-May-20242.5 KiB6969

_ssl.vcxprojD03-May-20243.6 KiB9090

_ssl.vcxproj.filtersD03-May-2024638 1919

_testbuffer.vcxprojD03-May-20243 KiB7777

_testbuffer.vcxproj.filtersD03-May-2024447 1313

_testcapi.vcxprojD03-May-20243.1 KiB7878

_testcapi.vcxproj.filtersD03-May-2024451 1313

_testconsole.vcxprojD03-May-20243.2 KiB8383

_testconsole.vcxproj.filtersD03-May-2024973 2222

_testembed.vcxprojD03-May-20243.2 KiB8080

_testembed.vcxproj.filtersD03-May-2024969 2222

_testimportmultiple.vcxprojD03-May-20243.1 KiB7978

_testimportmultiple.vcxproj.filtersD03-May-2024457 1413

_testmultiphase.vcxprojD03-May-20243.2 KiB8383

_testmultiphase.vcxproj.filtersD03-May-2024973 2222

_tkinter.vcxprojD03-May-20244.6 KiB104104

_tkinter.vcxproj.filtersD03-May-2024549 1616

build.batD03-May-20246 KiB153139

build_env.batD03-May-202426 21

clean.batD03-May-2024133 64

env.batD03-May-2024728 1715

field3.pyD03-May-2024974 3617

find_msbuild.batD03-May-20243.3 KiB7157

find_python.batD03-May-20243.1 KiB7662

fix_encoding.pyD03-May-2024952 3722

get_external.pyD03-May-20241.8 KiB6148

get_externals.batD03-May-20244.1 KiB11394

idle.batD03-May-2024311 1611

lib.pyprojD03-May-202489.5 KiB1,8191,819

liblzma.vcxprojD03-May-202413.3 KiB218215

openssl.propsD03-May-20241.4 KiB2828

openssl.vcxprojD03-May-20245.7 KiB134123

pcbuild.projD03-May-20246 KiB127101

pcbuild.slnD03-May-202458.7 KiB776775

prepare_ssl.batD03-May-20241.9 KiB5543

prepare_ssl.pyD03-May-20246.7 KiB204148

prepare_tcltk.batD03-May-20242 KiB5644

pyexpat.vcxprojD03-May-20243.7 KiB8988

pyexpat.vcxproj.filtersD03-May-20241.2 KiB3736

pylauncher.vcxprojD03-May-20243.3 KiB8382

pylauncher.vcxproj.filtersD03-May-20241.2 KiB3232

pyproject.propsD03-May-202411.6 KiB196181

pyshellext.vcxprojD03-May-20243.5 KiB8787

pyshellext.vcxproj.filtersD03-May-20241.4 KiB4040

python.propsD03-May-202412.6 KiB200119

python.vcxprojD03-May-20245.1 KiB116115

python.vcxproj.filtersD03-May-2024850 2726

python3dll.vcxprojD03-May-20246.7 KiB149147

python3dll.vcxproj.filtersD03-May-20241.2 KiB3232

python_uwp.vcxprojD03-May-20243.4 KiB8786

pythoncore.vcxprojD03-May-202424.3 KiB478476

pythoncore.vcxproj.filtersD03-May-202435.2 KiB1,0621,061

pythonw.vcxprojD03-May-20243.1 KiB7878

pythonw.vcxproj.filtersD03-May-2024722 2121

pythonw_uwp.vcxprojD03-May-20243.4 KiB8786

pywlauncher.vcxprojD03-May-20243.3 KiB8282

pywlauncher.vcxproj.filtersD03-May-20241.2 KiB3232

readme.txtD03-May-202411.2 KiB289239

rmpyc.pyD03-May-2024409 2012

rt.batD03-May-20242 KiB6555

select.vcxprojD03-May-20243.2 KiB8181

select.vcxproj.filtersD03-May-2024448 1313

sqlite3.vcxprojD03-May-20244.2 KiB9089

sqlite3.vcxproj.filtersD03-May-2024827 2424

tcl.vcxprojD03-May-20243 KiB7366

tcltk.propsD03-May-20243.2 KiB4643

tix.vcxprojD03-May-20243.9 KiB9788

tk.vcxprojD03-May-20243.3 KiB7973

unicodedata.vcxprojD03-May-20243.2 KiB8181

unicodedata.vcxproj.filtersD03-May-2024833 2424

urlretrieve.pyD03-May-20241.2 KiB4033

venvlauncher.vcxprojD03-May-20243.4 KiB8685

venvwlauncher.vcxprojD03-May-20243.4 KiB8685

winsound.vcxprojD03-May-20243.2 KiB8282

winsound.vcxproj.filtersD03-May-2024513 1414

xxlimited.vcxprojD03-May-20243.3 KiB8282

xxlimited.vcxproj.filtersD03-May-2024445 1313

readme.txt

1Quick Start Guide
2-----------------
3
41.  Install Microsoft Visual Studio 2017 with Python workload and
5    Python native development component.
61a. Optionally install Python 3.6 or later.  If not installed,
7    get_externals.bat (via build.bat) will download and use Python via
8    NuGet.
92.  Run "build.bat" to build Python in 32-bit Release configuration.
103.  (Optional, but recommended) Run the test suite with "rt.bat -q".
11
12
13Building Python using Microsoft Visual C++
14------------------------------------------
15
16This directory is used to build CPython for Microsoft Windows NT version
176.0 or higher (Windows Vista, Windows Server 2008, or later) on 32 and 64
18bit platforms.  Using this directory requires an installation of
19Microsoft Visual Studio 2017 (MSVC 14.1) with the *Python workload* and
20its optional *Python native development* component selected. (For
21command-line builds, Visual Studio 2015 may also be used.)
22
23Building from the command line is recommended in order to obtain any
24external dependencies. To build, simply run the "build.bat" script without
25any arguments. After this succeeds, you can open the "pcbuild.sln"
26solution in Visual Studio to continue development.
27
28To build an installer package, refer to the README in the Tools/msi folder.
29
30The solution currently supports two platforms.  The Win32 platform is
31used to build standard x86-compatible 32-bit binaries, output into the
32win32 sub-directory.  The x64 platform is used for building 64-bit AMD64
33(aka x86_64 or EM64T) binaries, output into the amd64 sub-directory.
34The Itanium (IA-64) platform is no longer supported.
35
36Four configuration options are supported by the solution:
37Debug
38    Used to build Python with extra debugging capabilities, equivalent
39    to using ./configure --with-pydebug on UNIX.  All binaries built
40    using this configuration have "_d" added to their name:
41    python37_d.dll, python_d.exe, parser_d.pyd, and so on.  Both the
42    build and rt (run test) batch files in this directory accept a -d
43    option for debug builds.  If you are building Python to help with
44    development of CPython, you will most likely use this configuration.
45PGInstrument, PGUpdate
46    Used to build Python in Release configuration using PGO, which
47    requires Premium Edition of Visual Studio.  See the "Profile
48    Guided Optimization" section below for more information.  Build
49    output from each of these configurations lands in its own
50    sub-directory of this directory.  The official Python releases may
51    be built using these configurations.
52Release
53    Used to build Python as it is meant to be used in production
54    settings, though without PGO.
55
56
57Building Python using the build.bat script
58----------------------------------------------
59
60In this directory you can find build.bat, a script designed to make
61building Python on Windows simpler.  This script will use the env.bat
62script to detect either Visual Studio 2017 or 2015, either of
63which may be used to build Python. Currently Visual Studio 2017 is
64officially supported.
65
66By default, build.bat will build Python in Release configuration for
67the 32-bit Win32 platform.  It accepts several arguments to change
68this behavior, try `build.bat -h` to learn more.
69
70
71C Runtime
72---------
73
74Visual Studio 2017 uses version 14.0 of the C runtime (vcruntime140).
75The executables no longer use the "Side by Side" assemblies used in
76previous versions of the compiler.  This simplifies distribution of
77applications.
78
79The run time libraries are available under the redist folder of your
80Visual Studio distribution. For more info, see the Readme in the
81redist folder.
82
83
84Sub-Projects
85------------
86
87The CPython project is split up into several smaller sub-projects which
88are managed by the pcbuild.sln solution file.  Each sub-project is
89represented by a .vcxproj and a .vcxproj.filters file starting with the
90name of the sub-project.  These sub-projects fall into a few general
91categories:
92
93The following sub-projects represent the bare minimum required to build
94a functioning CPython interpreter.  If nothing else builds but these,
95you'll have a very limited but usable python.exe:
96pythoncore
97    .dll and .lib
98python
99    .exe
100
101These sub-projects provide extra executables that are useful for running
102CPython in different ways:
103pythonw
104    pythonw.exe, a variant of python.exe that doesn't open a Command
105    Prompt window
106pylauncher
107    py.exe, the Python Launcher for Windows, see
108        http://docs.python.org/3/using/windows.html#launcher
109pywlauncher
110    pyw.exe, a variant of py.exe that doesn't open a Command Prompt
111    window
112_testembed
113    _testembed.exe, a small program that embeds Python for testing
114    purposes, used by test_capi.py
115
116These are miscellaneous sub-projects that don't really fit the other
117categories:
118_freeze_importlib
119    _freeze_importlib.exe, used to regenerate Python\importlib.h after
120    changes have been made to Lib\importlib\_bootstrap.py
121pyshellext
122    pyshellext.dll, the shell extension deployed with the launcher
123python3dll
124    python3.dll, the PEP 384 Stable ABI dll
125xxlimited
126    builds an example module that makes use of the PEP 384 Stable ABI,
127    see Modules\xxlimited.c
128
129The following sub-projects are for individual modules of the standard
130library which are implemented in C; each one builds a DLL (renamed to
131.pyd) of the same name as the project:
132_asyncio
133_ctypes
134_ctypes_test
135_decimal
136_elementtree
137_hashlib
138_msi
139_multiprocessing
140_overlapped
141_socket
142_testbuffer
143_testcapi
144_testconsole
145_testimportmultiple
146_testmultiphase
147_tkinter
148pyexpat
149select
150unicodedata
151winsound
152
153The following Python-controlled sub-projects wrap external projects.
154Note that these external libraries are not necessary for a working
155interpreter, but they do implement several major features.  See the
156"Getting External Sources" section below for additional information
157about getting the source for building these libraries.  The sub-projects
158are:
159_bz2
160    Python wrapper for version 1.0.6 of the libbzip2 compression library
161    Homepage:
162        http://www.bzip.org/
163_lzma
164    Python wrapper for version 5.2.2 of the liblzma compression library
165    Homepage:
166        http://tukaani.org/xz/
167_ssl
168    Python wrapper for version 1.1.0h of the OpenSSL secure sockets
169    library, which is downloaded from our binaries repository at
170    https://github.com/python/cpython-bin-deps.
171
172    Homepage:
173        http://www.openssl.org/
174
175    Building OpenSSL requires Perl on your path, and can be performed by
176    running PCbuild\prepare_ssl.bat. This will retrieve the version of
177    the sources matched to the current commit from the OpenSSL branch
178    in our source repository at
179    https://github.com/python/cpython-source-deps.
180
181    To use an alternative build of OpenSSL completely, you should replace
182    the files in the externals/openssl-bin-<version> folder with your own.
183    As long as this folder exists, its contents will not be downloaded
184    again when building.
185
186_sqlite3
187    Wraps SQLite 3.21.0.0, which is itself built by sqlite3.vcxproj
188    Homepage:
189        http://www.sqlite.org/
190_tkinter
191    Wraps version 8.6.6 of the Tk windowing system, which is downloaded
192    from our binaries repository at
193    https://github.com/python/cpython-bin-deps.
194
195    Homepage:
196        http://www.tcl.tk/
197
198    Building Tcl and Tk can be performed by running
199    PCbuild\prepare_tcltk.bat. This will retrieve the version of the
200    sources matched to the current commit from the Tcl and Tk branches
201    in our source repository at
202    https://github.com/python/cpython-source-deps.
203
204    The two projects install their respective components in a
205    directory alongside the source directories called "tcltk" on
206    Win32 and "tcltk64" on x64.  They also copy the Tcl and Tk DLLs
207    into the current output directory, which should ensure that Tkinter
208    is able to load Tcl/Tk without having to change your PATH.
209
210
211Getting External Sources
212------------------------
213
214The last category of sub-projects listed above wrap external projects
215Python doesn't control, and as such a little more work is required in
216order to download the relevant source files for each project before they
217can be built.  However, a simple script is provided to make this as
218painless as possible, called "get_externals.bat" and located in this
219directory.  This script extracts all the external sub-projects from
220    https://github.com/python/cpython-source-deps
221and
222    https://github.com/python/cpython-bin-deps
223via a Python script called "get_external.py", located in this directory.
224If Python 3.6 or later is not available via the "py.exe" launcher, the
225path or command to use for Python can be provided in the PYTHON_FOR_BUILD
226environment variable, or get_externals.bat will download the latest
227version of NuGet and use it to download the latest "pythonx86" package
228for use with get_external.py.  Everything downloaded by these scripts is
229stored in ..\externals (relative to this directory).
230
231It is also possible to download sources from each project's homepage,
232though you may have to change folder names or pass the names to MSBuild
233as the values of certain properties in order for the build solution to
234find them.  This is an advanced topic and not necessarily fully
235supported.
236
237The get_externals.bat script is called automatically by build.bat
238unless you pass the '-E' option.
239
240
241Profile Guided Optimization
242---------------------------
243
244The solution has two configurations for PGO. The PGInstrument
245configuration must be built first. The PGInstrument binaries are linked
246against a profiling library and contain extra debug information. The
247PGUpdate configuration takes the profiling data and generates optimized
248binaries.
249
250The build_pgo.bat script automates the creation of optimized binaries.
251It creates the PGI files, runs the unit test suite or PyBench with the
252PGI python, and finally creates the optimized files.
253
254See
255    http://msdn.microsoft.com/en-us/library/e7k32f4k(VS.140).aspx
256for more on this topic.
257
258
259Static library
260--------------
261
262The solution has no configuration for static libraries. However it is
263easy to build a static library instead of a DLL. You simply have to set
264the "Configuration Type" to "Static Library (.lib)" and alter the
265preprocessor macro "Py_ENABLE_SHARED" to "Py_NO_ENABLE_SHARED". You may
266also have to change the "Runtime Library" from "Multi-threaded DLL
267(/MD)" to "Multi-threaded (/MT)".
268
269
270Visual Studio properties
271------------------------
272
273The PCbuild solution makes use of Visual Studio property files (*.props)
274to simplify each project. The properties can be viewed in the Property
275Manager (View -> Other Windows -> Property Manager) but should be
276carefully modified by hand.
277
278The property files used are:
279 * python (versions, directories and build names)
280 * pyproject (base settings for all projects)
281 * openssl (used by projects dependent upon OpenSSL)
282 * tcltk (used by _tkinter, tcl, tk and tix projects)
283
284The pyproject property file defines all of the build settings for each
285project, with some projects overriding certain specific values. The GUI
286doesn't always reflect the correct settings and may confuse the user
287with false information, especially for settings that automatically adapt
288for diffirent configurations.
289