Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Deep-freeze for Windows, step 1
  • Loading branch information
gvanrossum committed Nov 17, 2021
commit 97c8fd6c46fead21fb78988c41cae53c23b27701
24 changes: 24 additions & 0 deletions PCbuild/pythoncore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,30 @@
<ClCompile Include="..\Python\thread.c" />
<ClCompile Include="..\Python\traceback.c" />
</ItemGroup>
<ItemGroup>
<!-- BEGIN deepfreeze -->
<ClCompile Include="..\Python\deepfreeze\importlib._bootstrap.c" />
<ClCompile Include="..\Python\deepfreeze\importlib._bootstrap_external.c" />
<ClCompile Include="..\Python\deepfreeze\zipimport.c" />
<ClCompile Include="..\Python\deepfreeze\abc.c" />
<!-- <ClCompile Include="..\Python\deepfreeze\codecs.c" /> -->
<ClCompile Include="..\Python\deepfreeze\io.c" />
<ClCompile Include="..\Python\deepfreeze\_collections_abc.c" />
<ClCompile Include="..\Python\deepfreeze\_sitebuiltins.c" />
<ClCompile Include="..\Python\deepfreeze\genericpath.c" />
<ClCompile Include="..\Python\deepfreeze\ntpath.c" />
<ClCompile Include="..\Python\deepfreeze\posixpath.c" />
<ClCompile Include="..\Python\deepfreeze\os.c" />
<ClCompile Include="..\Python\deepfreeze\site.c" />
<ClCompile Include="..\Python\deepfreeze\stat.c" />
<ClCompile Include="..\Python\deepfreeze\__hello__.c" />
<ClCompile Include="..\Python\deepfreeze\__phello__.c" />
<ClCompile Include="..\Python\deepfreeze\__phello__.spam.c" />
<ClCompile Include="..\Python\deepfreeze\__phello__.ham.c" />
<ClCompile Include="..\Python\deepfreeze\__phello__.ham.eggs.c" />
<ClCompile Include="..\Python\deepfreeze\frozen_only.c" />
<!-- END deepfreeze -->
</ItemGroup>
<ItemGroup Condition="$(IncludeExternals)">
<ClCompile Include="..\Modules\zlibmodule.c" />
<ClCompile Include="$(zlibDir)\adler32.c" />
Expand Down
7 changes: 1 addition & 6 deletions Python/frozen.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,7 @@
#include "frozen_modules/frozen_only.h"
/* End includes */

#ifdef MS_WINDOWS
/* Deepfreeze isn't supported on Windows yet. */
#define GET_CODE(name) NULL
#else
#define GET_CODE(name) _Py_get_##name##_toplevel
#endif

/* Start extern declarations */
extern PyObject *_Py_get_importlib__bootstrap_toplevel(void);
Expand Down Expand Up @@ -108,7 +103,7 @@ static const struct _frozen bootstrap_modules[] = {
static const struct _frozen stdlib_modules[] = {
/* stdlib - startup, without site (python -S) */
{"abc", _Py_M__abc, (int)sizeof(_Py_M__abc), GET_CODE(abc)},
{"codecs", _Py_M__codecs, (int)sizeof(_Py_M__codecs), GET_CODE(codecs)},
// {"codecs", _Py_M__codecs, (int)sizeof(_Py_M__codecs), GET_CODE(codecs)},
{"io", _Py_M__io, (int)sizeof(_Py_M__io), GET_CODE(io)},

/* stdlib - startup, with site */
Expand Down
2 changes: 1 addition & 1 deletion Tools/scripts/freeze_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def find_tool():
]),
('stdlib - startup, without site (python -S)', [
'abc',
'codecs',
# 'codecs', # TODO: Windows name conflict with Python\codecs.c
# For now we do not freeze the encodings, due # to the noise all
# those extra modules add to the text printed during the build.
# (See https://github.com/python/cpython/pull/28398#pullrequestreview-756856469.)
Expand Down
20 changes: 20 additions & 0 deletions deepfreeze.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Lib/importlib\_bootstrap.py -m importlib._bootstrap -o Python\deepfreeze\importlib._bootstrap.c
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Lib/importlib\_bootstrap_external.py -m importlib._bootstrap_external -o Python\deepfreeze\importlib._bootstrap_external.c
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Lib/zipimport.py -m zipimport -o Python\deepfreeze\zipimport.c
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Lib/abc.py -m abc -o Python\deepfreeze\abc.c
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Lib/codecs.py -m codecs -o Python\deepfreeze\codecs.c
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Lib/io.py -m io -o Python\deepfreeze\io.c
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Lib/_collections_abc.py -m _collections_abc -o Python\deepfreeze\_collections_abc.c
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Lib/_sitebuiltins.py -m _sitebuiltins -o Python\deepfreeze\_sitebuiltins.c
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Lib/genericpath.py -m genericpath -o Python\deepfreeze\genericpath.c
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Lib/ntpath.py -m ntpath -o Python\deepfreeze\ntpath.c
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Lib/posixpath.py -m posixpath -o Python\deepfreeze\posixpath.c
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Lib/os.py -m os -o Python\deepfreeze\os.c
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Lib/site.py -m site -o Python\deepfreeze\site.c
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Lib/stat.py -m stat -o Python\deepfreeze\stat.c
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Lib/__hello__.py -m __hello__ -o Python\deepfreeze\__hello__.c
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Lib/__phello__\__init__.py -m __phello__ -o Python\deepfreeze\__phello__.c
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Lib/__phello__\ham\__init__.py -m __phello__.ham -o Python\deepfreeze\__phello__.ham.c
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Lib/__phello__\ham\eggs.py -m __phello__.ham.eggs -o Python\deepfreeze\__phello__.ham.eggs.c
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Lib/__phello__\spam.py -m __phello__.spam -o Python\deepfreeze\__phello__.spam.c
pcbuild\amd64\python.exe Tools\scripts\deepfreeze.py Tools/freeze/flag.py -m frozen_only -o Python\deepfreeze\frozen_only.c