mirror of
https://github.com/python/cpython
synced 2024-09-05 00:05:39 +00:00
bpo-46429: Merge all deepfrozen files into one (GH-30572)
This commit is contained in:
parent
650720a0cf
commit
ef3ef6fa43
145
Makefile.pre.in
145
Makefile.pre.in
|
@ -484,32 +484,7 @@ OBJECT_OBJS= \
|
||||||
Objects/unionobject.o \
|
Objects/unionobject.o \
|
||||||
Objects/weakrefobject.o
|
Objects/weakrefobject.o
|
||||||
|
|
||||||
# DEEPFREEZE_OBJS is auto-generated by Tools/scripts/freeze_modules.py.
|
DEEPFREEZE_OBJS = Python/deepfreeze/deepfreeze.o
|
||||||
DEEPFREEZE_OBJS = \
|
|
||||||
Python/deepfreeze/importlib._bootstrap.o \
|
|
||||||
Python/deepfreeze/importlib._bootstrap_external.o \
|
|
||||||
Python/deepfreeze/zipimport.o \
|
|
||||||
Python/deepfreeze/abc.o \
|
|
||||||
Python/deepfreeze/codecs.o \
|
|
||||||
Python/deepfreeze/io.o \
|
|
||||||
Python/deepfreeze/_collections_abc.o \
|
|
||||||
Python/deepfreeze/_sitebuiltins.o \
|
|
||||||
Python/deepfreeze/genericpath.o \
|
|
||||||
Python/deepfreeze/ntpath.o \
|
|
||||||
Python/deepfreeze/posixpath.o \
|
|
||||||
Python/deepfreeze/os.o \
|
|
||||||
Python/deepfreeze/site.o \
|
|
||||||
Python/deepfreeze/stat.o \
|
|
||||||
Python/deepfreeze/importlib.util.o \
|
|
||||||
Python/deepfreeze/importlib.machinery.o \
|
|
||||||
Python/deepfreeze/runpy.o \
|
|
||||||
Python/deepfreeze/__hello__.o \
|
|
||||||
Python/deepfreeze/__phello__.o \
|
|
||||||
Python/deepfreeze/__phello__.ham.o \
|
|
||||||
Python/deepfreeze/__phello__.ham.eggs.o \
|
|
||||||
Python/deepfreeze/__phello__.spam.o \
|
|
||||||
Python/deepfreeze/frozen_only.o
|
|
||||||
# End DEEPFREEZE_OBJS
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# objects that get linked into the Python library
|
# objects that get linked into the Python library
|
||||||
|
@ -984,86 +959,6 @@ _bootstrap_python: $(LIBRARY_OBJS_OMIT_FROZEN) Programs/_bootstrap_python.o Modu
|
||||||
$(LINKCC) $(PY_LDFLAGS_NOLTO) -o $@ $(LIBRARY_OBJS_OMIT_FROZEN) \
|
$(LINKCC) $(PY_LDFLAGS_NOLTO) -o $@ $(LIBRARY_OBJS_OMIT_FROZEN) \
|
||||||
Programs/_bootstrap_python.o Modules/getpath.o $(LIBS) $(MODLIBS) $(SYSLIBS)
|
Programs/_bootstrap_python.o Modules/getpath.o $(LIBS) $(MODLIBS) $(SYSLIBS)
|
||||||
|
|
||||||
############################################################################
|
|
||||||
# Deepfreeze targets
|
|
||||||
|
|
||||||
.PHONY: regen-deepfreeze
|
|
||||||
regen-deepfreeze: $(DEEPFREEZE_OBJS)
|
|
||||||
|
|
||||||
DEEPFREEZE_DEPS=$(srcdir)/Tools/scripts/deepfreeze.py $(FREEZE_MODULE_DEPS)
|
|
||||||
|
|
||||||
# BEGIN: deepfreeze modules
|
|
||||||
|
|
||||||
Python/deepfreeze/importlib._bootstrap.c: Python/frozen_modules/importlib._bootstrap.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/importlib._bootstrap.h -m importlib._bootstrap -o Python/deepfreeze/importlib._bootstrap.c
|
|
||||||
|
|
||||||
Python/deepfreeze/importlib._bootstrap_external.c: Python/frozen_modules/importlib._bootstrap_external.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/importlib._bootstrap_external.h -m importlib._bootstrap_external -o Python/deepfreeze/importlib._bootstrap_external.c
|
|
||||||
|
|
||||||
Python/deepfreeze/zipimport.c: Python/frozen_modules/zipimport.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/zipimport.h -m zipimport -o Python/deepfreeze/zipimport.c
|
|
||||||
|
|
||||||
Python/deepfreeze/abc.c: Python/frozen_modules/abc.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/abc.h -m abc -o Python/deepfreeze/abc.c
|
|
||||||
|
|
||||||
Python/deepfreeze/codecs.c: Python/frozen_modules/codecs.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/codecs.h -m codecs -o Python/deepfreeze/codecs.c
|
|
||||||
|
|
||||||
Python/deepfreeze/io.c: Python/frozen_modules/io.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/io.h -m io -o Python/deepfreeze/io.c
|
|
||||||
|
|
||||||
Python/deepfreeze/_collections_abc.c: Python/frozen_modules/_collections_abc.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/_collections_abc.h -m _collections_abc -o Python/deepfreeze/_collections_abc.c
|
|
||||||
|
|
||||||
Python/deepfreeze/_sitebuiltins.c: Python/frozen_modules/_sitebuiltins.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/_sitebuiltins.h -m _sitebuiltins -o Python/deepfreeze/_sitebuiltins.c
|
|
||||||
|
|
||||||
Python/deepfreeze/genericpath.c: Python/frozen_modules/genericpath.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/genericpath.h -m genericpath -o Python/deepfreeze/genericpath.c
|
|
||||||
|
|
||||||
Python/deepfreeze/ntpath.c: Python/frozen_modules/ntpath.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/ntpath.h -m ntpath -o Python/deepfreeze/ntpath.c
|
|
||||||
|
|
||||||
Python/deepfreeze/posixpath.c: Python/frozen_modules/posixpath.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/posixpath.h -m posixpath -o Python/deepfreeze/posixpath.c
|
|
||||||
|
|
||||||
Python/deepfreeze/os.c: Python/frozen_modules/os.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/os.h -m os -o Python/deepfreeze/os.c
|
|
||||||
|
|
||||||
Python/deepfreeze/site.c: Python/frozen_modules/site.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/site.h -m site -o Python/deepfreeze/site.c
|
|
||||||
|
|
||||||
Python/deepfreeze/stat.c: Python/frozen_modules/stat.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/stat.h -m stat -o Python/deepfreeze/stat.c
|
|
||||||
|
|
||||||
Python/deepfreeze/importlib.util.c: Python/frozen_modules/importlib.util.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/importlib.util.h -m importlib.util -o Python/deepfreeze/importlib.util.c
|
|
||||||
|
|
||||||
Python/deepfreeze/importlib.machinery.c: Python/frozen_modules/importlib.machinery.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/importlib.machinery.h -m importlib.machinery -o Python/deepfreeze/importlib.machinery.c
|
|
||||||
|
|
||||||
Python/deepfreeze/runpy.c: Python/frozen_modules/runpy.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/runpy.h -m runpy -o Python/deepfreeze/runpy.c
|
|
||||||
|
|
||||||
Python/deepfreeze/__hello__.c: Python/frozen_modules/__hello__.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/__hello__.h -m __hello__ -o Python/deepfreeze/__hello__.c
|
|
||||||
|
|
||||||
Python/deepfreeze/__phello__.c: Python/frozen_modules/__phello__.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/__phello__.h -m __phello__ -o Python/deepfreeze/__phello__.c
|
|
||||||
|
|
||||||
Python/deepfreeze/__phello__.ham.c: Python/frozen_modules/__phello__.ham.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/__phello__.ham.h -m __phello__.ham -o Python/deepfreeze/__phello__.ham.c
|
|
||||||
|
|
||||||
Python/deepfreeze/__phello__.ham.eggs.c: Python/frozen_modules/__phello__.ham.eggs.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/__phello__.ham.eggs.h -m __phello__.ham.eggs -o Python/deepfreeze/__phello__.ham.eggs.c
|
|
||||||
|
|
||||||
Python/deepfreeze/__phello__.spam.c: Python/frozen_modules/__phello__.spam.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/__phello__.spam.h -m __phello__.spam -o Python/deepfreeze/__phello__.spam.c
|
|
||||||
|
|
||||||
Python/deepfreeze/frozen_only.c: Python/frozen_modules/frozen_only.h $(DEEPFREEZE_DEPS)
|
|
||||||
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/frozen_only.h -m frozen_only -o Python/deepfreeze/frozen_only.c
|
|
||||||
|
|
||||||
# END: deepfreeze modules
|
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
# frozen modules (including importlib)
|
# frozen modules (including importlib)
|
||||||
|
@ -1235,6 +1130,44 @@ regen-frozen: Tools/scripts/freeze_modules.py $(FROZEN_FILES_IN)
|
||||||
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/freeze_modules.py
|
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/freeze_modules.py
|
||||||
@echo "The Makefile was updated, you may need to re-run make."
|
@echo "The Makefile was updated, you may need to re-run make."
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
# Deepfreeze targets
|
||||||
|
|
||||||
|
.PHONY: regen-deepfreeze
|
||||||
|
regen-deepfreeze: $(DEEPFREEZE_OBJS)
|
||||||
|
|
||||||
|
DEEPFREEZE_DEPS=$(srcdir)/Tools/scripts/deepfreeze.py $(FREEZE_MODULE_DEPS) $(FROZEN_FILES_OUT)
|
||||||
|
|
||||||
|
# BEGIN: deepfreeze modules
|
||||||
|
Python/deepfreeze/deepfreeze.c: $(DEEPFREEZE_DEPS)
|
||||||
|
$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py \
|
||||||
|
Python/frozen_modules/importlib._bootstrap.h:importlib._bootstrap \
|
||||||
|
Python/frozen_modules/importlib._bootstrap_external.h:importlib._bootstrap_external \
|
||||||
|
Python/frozen_modules/zipimport.h:zipimport \
|
||||||
|
Python/frozen_modules/abc.h:abc \
|
||||||
|
Python/frozen_modules/codecs.h:codecs \
|
||||||
|
Python/frozen_modules/io.h:io \
|
||||||
|
Python/frozen_modules/_collections_abc.h:_collections_abc \
|
||||||
|
Python/frozen_modules/_sitebuiltins.h:_sitebuiltins \
|
||||||
|
Python/frozen_modules/genericpath.h:genericpath \
|
||||||
|
Python/frozen_modules/ntpath.h:ntpath \
|
||||||
|
Python/frozen_modules/posixpath.h:posixpath \
|
||||||
|
Python/frozen_modules/os.h:os \
|
||||||
|
Python/frozen_modules/site.h:site \
|
||||||
|
Python/frozen_modules/stat.h:stat \
|
||||||
|
Python/frozen_modules/importlib.util.h:importlib.util \
|
||||||
|
Python/frozen_modules/importlib.machinery.h:importlib.machinery \
|
||||||
|
Python/frozen_modules/runpy.h:runpy \
|
||||||
|
Python/frozen_modules/__hello__.h:__hello__ \
|
||||||
|
Python/frozen_modules/__phello__.h:__phello__ \
|
||||||
|
Python/frozen_modules/__phello__.ham.h:__phello__.ham \
|
||||||
|
Python/frozen_modules/__phello__.ham.eggs.h:__phello__.ham.eggs \
|
||||||
|
Python/frozen_modules/__phello__.spam.h:__phello__.spam \
|
||||||
|
Python/frozen_modules/frozen_only.h:frozen_only \
|
||||||
|
-o Python/deepfreeze/deepfreeze.c
|
||||||
|
|
||||||
|
# END: deepfreeze modules
|
||||||
|
|
||||||
# We keep this renamed target around for folks with muscle memory.
|
# We keep this renamed target around for folks with muscle memory.
|
||||||
.PHONY: regen-importlib
|
.PHONY: regen-importlib
|
||||||
regen-importlib: regen-frozen
|
regen-importlib: regen-frozen
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Merge all deep-frozen files into one for space savings. Patch by Kumar Aditya.
|
|
@ -241,162 +241,116 @@
|
||||||
<ModName>importlib._bootstrap</ModName>
|
<ModName>importlib._bootstrap</ModName>
|
||||||
<IntFile>$(IntDir)importlib._bootstrap.g.h</IntFile>
|
<IntFile>$(IntDir)importlib._bootstrap.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\importlib._bootstrap.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\importlib._bootstrap.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)importlib._bootstrap.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.importlib._bootstrap.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\importlib\_bootstrap_external.py">
|
<None Include="..\Lib\importlib\_bootstrap_external.py">
|
||||||
<ModName>importlib._bootstrap_external</ModName>
|
<ModName>importlib._bootstrap_external</ModName>
|
||||||
<IntFile>$(IntDir)importlib._bootstrap_external.g.h</IntFile>
|
<IntFile>$(IntDir)importlib._bootstrap_external.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\importlib._bootstrap_external.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\importlib._bootstrap_external.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)importlib._bootstrap_external.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.importlib._bootstrap_external.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\zipimport.py">
|
<None Include="..\Lib\zipimport.py">
|
||||||
<ModName>zipimport</ModName>
|
<ModName>zipimport</ModName>
|
||||||
<IntFile>$(IntDir)zipimport.g.h</IntFile>
|
<IntFile>$(IntDir)zipimport.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\zipimport.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\zipimport.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)zipimport.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.zipimport.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\abc.py">
|
<None Include="..\Lib\abc.py">
|
||||||
<ModName>abc</ModName>
|
<ModName>abc</ModName>
|
||||||
<IntFile>$(IntDir)abc.g.h</IntFile>
|
<IntFile>$(IntDir)abc.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\abc.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\abc.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)abc.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.abc.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\codecs.py">
|
<None Include="..\Lib\codecs.py">
|
||||||
<ModName>codecs</ModName>
|
<ModName>codecs</ModName>
|
||||||
<IntFile>$(IntDir)codecs.g.h</IntFile>
|
<IntFile>$(IntDir)codecs.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\codecs.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\codecs.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)codecs.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.codecs.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\io.py">
|
<None Include="..\Lib\io.py">
|
||||||
<ModName>io</ModName>
|
<ModName>io</ModName>
|
||||||
<IntFile>$(IntDir)io.g.h</IntFile>
|
<IntFile>$(IntDir)io.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\io.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\io.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)io.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.io.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\_collections_abc.py">
|
<None Include="..\Lib\_collections_abc.py">
|
||||||
<ModName>_collections_abc</ModName>
|
<ModName>_collections_abc</ModName>
|
||||||
<IntFile>$(IntDir)_collections_abc.g.h</IntFile>
|
<IntFile>$(IntDir)_collections_abc.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\_collections_abc.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\_collections_abc.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)_collections_abc.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df._collections_abc.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\_sitebuiltins.py">
|
<None Include="..\Lib\_sitebuiltins.py">
|
||||||
<ModName>_sitebuiltins</ModName>
|
<ModName>_sitebuiltins</ModName>
|
||||||
<IntFile>$(IntDir)_sitebuiltins.g.h</IntFile>
|
<IntFile>$(IntDir)_sitebuiltins.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\_sitebuiltins.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\_sitebuiltins.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)_sitebuiltins.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df._sitebuiltins.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\genericpath.py">
|
<None Include="..\Lib\genericpath.py">
|
||||||
<ModName>genericpath</ModName>
|
<ModName>genericpath</ModName>
|
||||||
<IntFile>$(IntDir)genericpath.g.h</IntFile>
|
<IntFile>$(IntDir)genericpath.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\genericpath.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\genericpath.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)genericpath.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.genericpath.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\ntpath.py">
|
<None Include="..\Lib\ntpath.py">
|
||||||
<ModName>ntpath</ModName>
|
<ModName>ntpath</ModName>
|
||||||
<IntFile>$(IntDir)ntpath.g.h</IntFile>
|
<IntFile>$(IntDir)ntpath.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\ntpath.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\ntpath.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)ntpath.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.ntpath.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\posixpath.py">
|
<None Include="..\Lib\posixpath.py">
|
||||||
<ModName>posixpath</ModName>
|
<ModName>posixpath</ModName>
|
||||||
<IntFile>$(IntDir)posixpath.g.h</IntFile>
|
<IntFile>$(IntDir)posixpath.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\posixpath.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\posixpath.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)posixpath.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.posixpath.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\os.py">
|
<None Include="..\Lib\os.py">
|
||||||
<ModName>os</ModName>
|
<ModName>os</ModName>
|
||||||
<IntFile>$(IntDir)os.g.h</IntFile>
|
<IntFile>$(IntDir)os.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\os.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\os.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)os.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.os.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\site.py">
|
<None Include="..\Lib\site.py">
|
||||||
<ModName>site</ModName>
|
<ModName>site</ModName>
|
||||||
<IntFile>$(IntDir)site.g.h</IntFile>
|
<IntFile>$(IntDir)site.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\site.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\site.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)site.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.site.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\stat.py">
|
<None Include="..\Lib\stat.py">
|
||||||
<ModName>stat</ModName>
|
<ModName>stat</ModName>
|
||||||
<IntFile>$(IntDir)stat.g.h</IntFile>
|
<IntFile>$(IntDir)stat.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\stat.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\stat.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)stat.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.stat.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\importlib\util.py">
|
<None Include="..\Lib\importlib\util.py">
|
||||||
<ModName>importlib.util</ModName>
|
<ModName>importlib.util</ModName>
|
||||||
<IntFile>$(IntDir)importlib.util.g.h</IntFile>
|
<IntFile>$(IntDir)importlib.util.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\importlib.util.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\importlib.util.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)importlib.util.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.importlib.util.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\importlib\machinery.py">
|
<None Include="..\Lib\importlib\machinery.py">
|
||||||
<ModName>importlib.machinery</ModName>
|
<ModName>importlib.machinery</ModName>
|
||||||
<IntFile>$(IntDir)importlib.machinery.g.h</IntFile>
|
<IntFile>$(IntDir)importlib.machinery.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\importlib.machinery.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\importlib.machinery.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)importlib.machinery.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.importlib.machinery.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\runpy.py">
|
<None Include="..\Lib\runpy.py">
|
||||||
<ModName>runpy</ModName>
|
<ModName>runpy</ModName>
|
||||||
<IntFile>$(IntDir)runpy.g.h</IntFile>
|
<IntFile>$(IntDir)runpy.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\runpy.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\runpy.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)runpy.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.runpy.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\__hello__.py">
|
<None Include="..\Lib\__hello__.py">
|
||||||
<ModName>__hello__</ModName>
|
<ModName>__hello__</ModName>
|
||||||
<IntFile>$(IntDir)__hello__.g.h</IntFile>
|
<IntFile>$(IntDir)__hello__.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\__hello__.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\__hello__.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)__hello__.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.__hello__.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\__phello__\__init__.py">
|
<None Include="..\Lib\__phello__\__init__.py">
|
||||||
<ModName>__phello__</ModName>
|
<ModName>__phello__</ModName>
|
||||||
<IntFile>$(IntDir)__phello__.g.h</IntFile>
|
<IntFile>$(IntDir)__phello__.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\__phello__.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\__phello__.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)__phello__.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.__phello__.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\__phello__\ham\__init__.py">
|
<None Include="..\Lib\__phello__\ham\__init__.py">
|
||||||
<ModName>__phello__.ham</ModName>
|
<ModName>__phello__.ham</ModName>
|
||||||
<IntFile>$(IntDir)__phello__.ham.g.h</IntFile>
|
<IntFile>$(IntDir)__phello__.ham.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\__phello__.ham.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\__phello__.ham.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)__phello__.ham.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.__phello__.ham.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\__phello__\ham\eggs.py">
|
<None Include="..\Lib\__phello__\ham\eggs.py">
|
||||||
<ModName>__phello__.ham.eggs</ModName>
|
<ModName>__phello__.ham.eggs</ModName>
|
||||||
<IntFile>$(IntDir)__phello__.ham.eggs.g.h</IntFile>
|
<IntFile>$(IntDir)__phello__.ham.eggs.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\__phello__.ham.eggs.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\__phello__.ham.eggs.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)__phello__.ham.eggs.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.__phello__.ham.eggs.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Lib\__phello__\spam.py">
|
<None Include="..\Lib\__phello__\spam.py">
|
||||||
<ModName>__phello__.spam</ModName>
|
<ModName>__phello__.spam</ModName>
|
||||||
<IntFile>$(IntDir)__phello__.spam.g.h</IntFile>
|
<IntFile>$(IntDir)__phello__.spam.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\__phello__.spam.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\__phello__.spam.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)__phello__.spam.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.__phello__.spam.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Tools\freeze\flag.py">
|
<None Include="..\Tools\freeze\flag.py">
|
||||||
<ModName>frozen_only</ModName>
|
<ModName>frozen_only</ModName>
|
||||||
<IntFile>$(IntDir)frozen_only.g.h</IntFile>
|
<IntFile>$(IntDir)frozen_only.g.h</IntFile>
|
||||||
<OutFile>$(PySourcePath)Python\frozen_modules\frozen_only.h</OutFile>
|
<OutFile>$(PySourcePath)Python\frozen_modules\frozen_only.h</OutFile>
|
||||||
<DeepIntFile>$(IntDir)frozen_only.g.c</DeepIntFile>
|
|
||||||
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.frozen_only.c</DeepOutFile>
|
|
||||||
</None>
|
</None>
|
||||||
<!-- END frozen modules -->
|
<!-- END frozen modules -->
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -424,11 +378,11 @@
|
||||||
Condition="'@(_UpdatedGetPath)' != ''" Importance="high" />
|
Condition="'@(_UpdatedGetPath)' != ''" Importance="high" />
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="_RebuildFrozen" AfterTargets="AfterBuild" Condition="$(Configuration) != 'PGUpdate'">
|
<Target Name="_RebuildFrozen" AfterTargets="AfterBuild" Condition="$(Configuration) != 'PGUpdate'">
|
||||||
<Exec Command='"$(TargetPath)" "%(None.ModName)" "%(None.FullPath)" "%(None.DeepIntFile)"' />
|
<Exec Command='"$(TargetPath)" "%(None.ModName)" "%(None.FullPath)" "%(None.IntFile)"' />
|
||||||
|
|
||||||
<Copy SourceFiles="%(None.DeepIntFile)"
|
<Copy SourceFiles="%(None.IntFile)"
|
||||||
DestinationFiles="%(None.OutFile)"
|
DestinationFiles="%(None.OutFile)"
|
||||||
Condition="!Exists(%(None.OutFile)) or (Exists(%(None.DeepIntFile)) and '$([System.IO.File]::ReadAllText(%(None.OutFile)).Replace(`
`, `
`))' != '$([System.IO.File]::ReadAllText(%(None.DeepIntFile)).Replace(`
`, `
`))')">
|
Condition="!Exists(%(None.OutFile)) or (Exists(%(None.IntFile)) and '$([System.IO.File]::ReadAllText(%(None.OutFile)).Replace(`
`, `
`))' != '$([System.IO.File]::ReadAllText(%(None.IntFile)).Replace(`
`, `
`))')">
|
||||||
<Output TaskParameter="CopiedFiles" ItemName="_Updated" />
|
<Output TaskParameter="CopiedFiles" ItemName="_Updated" />
|
||||||
</Copy>
|
</Copy>
|
||||||
|
|
||||||
|
@ -439,16 +393,33 @@
|
||||||
AfterTargets="_RebuildFrozen"
|
AfterTargets="_RebuildFrozen"
|
||||||
DependsOnTargets="FindPythonForBuild"
|
DependsOnTargets="FindPythonForBuild"
|
||||||
Condition="$(Configuration) != 'PGUpdate'">
|
Condition="$(Configuration) != 'PGUpdate'">
|
||||||
<Exec Command='$(PythonForBuild) "$(PySourcePath)Tools\scripts\deepfreeze.py" "%(None.OutFile)" "-m" "%(None.ModName)" -o "%(None.IntFile)"' />
|
<!-- BEGIN deepfreeze rule -->
|
||||||
|
<Exec Command='$(PythonForBuild) "$(PySourcePath)Tools\scripts\deepfreeze.py" ^
|
||||||
<Copy SourceFiles="%(None.IntFile)"
|
"$(PySourcePath)Python\frozen_modules\importlib._bootstrap.h:importlib._bootstrap" ^
|
||||||
DestinationFiles="%(None.DeepOutFile)"
|
"$(PySourcePath)Python\frozen_modules\importlib._bootstrap_external.h:importlib._bootstrap_external" ^
|
||||||
Condition="!Exists(%(None.DeepOutFile)) or (Exists(%(None.IntFile)) and '$([System.IO.File]::ReadAllText(%(None.DeepOutFile)).Replace(`
`, `
`))' != '$([System.IO.File]::ReadAllText(%(None.IntFile)).Replace(`
`, `
`))')">
|
"$(PySourcePath)Python\frozen_modules\zipimport.h:zipimport" ^
|
||||||
<Output TaskParameter="CopiedFiles" ItemName="_DeepUpdated" />
|
"$(PySourcePath)Python\frozen_modules\abc.h:abc" ^
|
||||||
</Copy>
|
"$(PySourcePath)Python\frozen_modules\codecs.h:codecs" ^
|
||||||
|
"$(PySourcePath)Python\frozen_modules\io.h:io" ^
|
||||||
<Message Text="Updated files: @(_DeepUpdated->'%(Filename)%(Extension)',', ')"
|
"$(PySourcePath)Python\frozen_modules\_collections_abc.h:_collections_abc" ^
|
||||||
Condition="'@(_DeepUpdated)' != ''" Importance="high" />
|
"$(PySourcePath)Python\frozen_modules\_sitebuiltins.h:_sitebuiltins" ^
|
||||||
|
"$(PySourcePath)Python\frozen_modules\genericpath.h:genericpath" ^
|
||||||
|
"$(PySourcePath)Python\frozen_modules\ntpath.h:ntpath" ^
|
||||||
|
"$(PySourcePath)Python\frozen_modules\posixpath.h:posixpath" ^
|
||||||
|
"$(PySourcePath)Python\frozen_modules\os.h:os" ^
|
||||||
|
"$(PySourcePath)Python\frozen_modules\site.h:site" ^
|
||||||
|
"$(PySourcePath)Python\frozen_modules\stat.h:stat" ^
|
||||||
|
"$(PySourcePath)Python\frozen_modules\importlib.util.h:importlib.util" ^
|
||||||
|
"$(PySourcePath)Python\frozen_modules\importlib.machinery.h:importlib.machinery" ^
|
||||||
|
"$(PySourcePath)Python\frozen_modules\runpy.h:runpy" ^
|
||||||
|
"$(PySourcePath)Python\frozen_modules\__hello__.h:__hello__" ^
|
||||||
|
"$(PySourcePath)Python\frozen_modules\__phello__.h:__phello__" ^
|
||||||
|
"$(PySourcePath)Python\frozen_modules\__phello__.ham.h:__phello__.ham" ^
|
||||||
|
"$(PySourcePath)Python\frozen_modules\__phello__.ham.eggs.h:__phello__.ham.eggs" ^
|
||||||
|
"$(PySourcePath)Python\frozen_modules\__phello__.spam.h:__phello__.spam" ^
|
||||||
|
"$(PySourcePath)Python\frozen_modules\frozen_only.h:frozen_only" ^
|
||||||
|
"-o" "$(PySourcePath)Python\deepfreeze\deepfreeze.c"'/>
|
||||||
|
<!-- END deepfreeze rule -->
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="_CleanFrozen" BeforeTargets="CoreClean" Condition="$(Configuration) != 'PGUpdate'">
|
<Target Name="_CleanFrozen" BeforeTargets="CoreClean" Condition="$(Configuration) != 'PGUpdate'">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -528,29 +528,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<!-- BEGIN deepfreeze -->
|
<!-- BEGIN deepfreeze -->
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.importlib._bootstrap.c" />
|
<ClCompile Include="..\Python\deepfreeze\deepfreeze.c" />
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.importlib._bootstrap_external.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.zipimport.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.abc.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.codecs.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.io.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df._collections_abc.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df._sitebuiltins.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.genericpath.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.ntpath.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.posixpath.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.os.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.site.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.stat.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.importlib.util.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.importlib.machinery.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.runpy.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.__hello__.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.__phello__.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.__phello__.ham.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.__phello__.ham.eggs.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.__phello__.spam.c" />
|
|
||||||
<ClCompile Include="..\Python\deepfreeze\df.frozen_only.c" />
|
|
||||||
<!-- END deepfreeze -->
|
<!-- END deepfreeze -->
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition="$(IncludeExternals)">
|
<ItemGroup Condition="$(IncludeExternals)">
|
||||||
|
|
|
@ -10,10 +10,9 @@
|
||||||
import contextlib
|
import contextlib
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
|
||||||
import time
|
import time
|
||||||
import types
|
import types
|
||||||
from typing import Dict, FrozenSet, Tuple, TextIO
|
from typing import Dict, FrozenSet, TextIO, Tuple
|
||||||
|
|
||||||
import umarshal
|
import umarshal
|
||||||
|
|
||||||
|
@ -104,10 +103,10 @@ def removesuffix(base: str, suffix: str) -> str:
|
||||||
|
|
||||||
class Printer:
|
class Printer:
|
||||||
|
|
||||||
def __init__(self, file: TextIO):
|
def __init__(self, file: TextIO) -> None:
|
||||||
self.level = 0
|
self.level = 0
|
||||||
self.file = file
|
self.file = file
|
||||||
self.cache: Dict[Tuple[type, object], str] = {}
|
self.cache: Dict[tuple[type, object, str], str] = {}
|
||||||
self.hits, self.misses = 0, 0
|
self.hits, self.misses = 0, 0
|
||||||
self.patchups: list[str] = []
|
self.patchups: list[str] = []
|
||||||
self.write('#include "Python.h"')
|
self.write('#include "Python.h"')
|
||||||
|
@ -349,6 +348,15 @@ def generate_frozenset(self, name: str, fs: FrozenSet[object]) -> str:
|
||||||
self.write("// TODO: The above tuple should be a frozenset")
|
self.write("// TODO: The above tuple should be a frozenset")
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
def generate_file(self, module: str, code: object)-> None:
|
||||||
|
module = module.replace(".", "_")
|
||||||
|
self.generate(f"{module}_toplevel", code)
|
||||||
|
with self.block(f"static void {module}_do_patchups(void)"):
|
||||||
|
for p in self.patchups:
|
||||||
|
self.write(p)
|
||||||
|
self.patchups.clear()
|
||||||
|
self.write(EPILOGUE.replace("%%NAME%%", module))
|
||||||
|
|
||||||
def generate(self, name: str, obj: object) -> str:
|
def generate(self, name: str, obj: object) -> str:
|
||||||
# Use repr() in the key to distinguish -0.0 from +0.0
|
# Use repr() in the key to distinguish -0.0 from +0.0
|
||||||
key = (type(obj), obj, repr(obj))
|
key = (type(obj), obj, repr(obj))
|
||||||
|
@ -357,7 +365,7 @@ def generate(self, name: str, obj: object) -> str:
|
||||||
# print(f"Cache hit {key!r:.40}: {self.cache[key]!r:.40}")
|
# print(f"Cache hit {key!r:.40}: {self.cache[key]!r:.40}")
|
||||||
return self.cache[key]
|
return self.cache[key]
|
||||||
self.misses += 1
|
self.misses += 1
|
||||||
if isinstance(obj, types.CodeType) or isinstance(obj, umarshal.Code):
|
if isinstance(obj, (types.CodeType, umarshal.Code)) :
|
||||||
val = self.generate_code(name, obj)
|
val = self.generate_code(name, obj)
|
||||||
elif isinstance(obj, tuple):
|
elif isinstance(obj, tuple):
|
||||||
val = self.generate_tuple(name, obj)
|
val = self.generate_tuple(name, obj)
|
||||||
|
@ -393,8 +401,8 @@ def generate(self, name: str, obj: object) -> str:
|
||||||
PyObject *
|
PyObject *
|
||||||
_Py_get_%%NAME%%_toplevel(void)
|
_Py_get_%%NAME%%_toplevel(void)
|
||||||
{
|
{
|
||||||
do_patchups();
|
%%NAME%%_do_patchups();
|
||||||
return (PyObject *) &toplevel;
|
return (PyObject *) &%%NAME%%_toplevel;
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -419,29 +427,25 @@ def decode_frozen_data(source: str) -> types.CodeType:
|
||||||
return umarshal.loads(data)
|
return umarshal.loads(data)
|
||||||
|
|
||||||
|
|
||||||
def generate(source: str, filename: str, modname: str, file: TextIO) -> None:
|
def generate(args: list[str], output: TextIO) -> None:
|
||||||
if is_frozen_header(source):
|
printer = Printer(output)
|
||||||
code = decode_frozen_data(source)
|
for arg in args:
|
||||||
else:
|
file, modname = arg.rsplit(':', 1)
|
||||||
code = compile(source, filename, "exec")
|
with open(file, "r", encoding="utf8") as fd:
|
||||||
printer = Printer(file)
|
source = fd.read()
|
||||||
printer.generate("toplevel", code)
|
if is_frozen_header(source):
|
||||||
printer.write("")
|
code = decode_frozen_data(source)
|
||||||
with printer.block("static void do_patchups(void)"):
|
else:
|
||||||
for p in printer.patchups:
|
code = compile(fd.read(), f"<frozen {modname}>", "exec")
|
||||||
printer.write(p)
|
printer.generate_file(modname, code)
|
||||||
here = os.path.dirname(__file__)
|
|
||||||
printer.write(EPILOGUE.replace("%%NAME%%", modname.replace(".", "_")))
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print(f"Cache hits: {printer.hits}, misses: {printer.misses}")
|
print(f"Cache hits: {printer.hits}, misses: {printer.misses}")
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("-m", "--module", help="Defaults to basename(file)")
|
parser.add_argument("-o", "--output", help="Defaults to deepfreeze.c", default="deepfreeze.c")
|
||||||
parser.add_argument("-o", "--output", help="Defaults to MODULE.c")
|
|
||||||
parser.add_argument("-v", "--verbose", action="store_true", help="Print diagnostics")
|
parser.add_argument("-v", "--verbose", action="store_true", help="Print diagnostics")
|
||||||
parser.add_argument("file", help="Input file (required)")
|
parser.add_argument('args', nargs="+", help="Input file and module name (required) in file:modname format")
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def report_time(label: str):
|
def report_time(label: str):
|
||||||
|
@ -458,13 +462,10 @@ def main() -> None:
|
||||||
global verbose
|
global verbose
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
verbose = args.verbose
|
verbose = args.verbose
|
||||||
with open(args.file, encoding="utf-8") as f:
|
output = args.output
|
||||||
source = f.read()
|
|
||||||
modname = args.module or removesuffix(os.path.basename(args.file), ".py")
|
|
||||||
output = args.output or modname + ".c"
|
|
||||||
with open(output, "w", encoding="utf-8") as file:
|
with open(output, "w", encoding="utf-8") as file:
|
||||||
with report_time("generate"):
|
with report_time("generate"):
|
||||||
generate(source, f"<frozen {modname}>", modname, file)
|
generate(args.args, file)
|
||||||
if verbose:
|
if verbose:
|
||||||
print(f"Wrote {os.path.getsize(output)} bytes to {output}")
|
print(f"Wrote {os.path.getsize(output)} bytes to {output}")
|
||||||
|
|
||||||
|
|
|
@ -575,16 +575,12 @@ def regen_frozen(modules):
|
||||||
def regen_makefile(modules):
|
def regen_makefile(modules):
|
||||||
pyfiles = []
|
pyfiles = []
|
||||||
frozenfiles = []
|
frozenfiles = []
|
||||||
deepfreezefiles = []
|
|
||||||
rules = ['']
|
rules = ['']
|
||||||
deepfreezerules = ['']
|
deepfreezerules = ["Python/deepfreeze/deepfreeze.c: $(DEEPFREEZE_DEPS)",
|
||||||
|
"\t$(PYTHON_FOR_FREEZE) $(srcdir)/Tools/scripts/deepfreeze.py \\"]
|
||||||
for src in _iter_sources(modules):
|
for src in _iter_sources(modules):
|
||||||
frozen_header = relpath_for_posix_display(src.frozenfile, ROOT_DIR)
|
frozen_header = relpath_for_posix_display(src.frozenfile, ROOT_DIR)
|
||||||
deepfreeze_header = relpath_for_posix_display(src.deepfreezefile, ROOT_DIR)
|
|
||||||
frozenfiles.append(f'\t\t{frozen_header} \\')
|
frozenfiles.append(f'\t\t{frozen_header} \\')
|
||||||
cfile = deepfreeze_header[:-2] + ".c"
|
|
||||||
ofile = deepfreeze_header[:-2] + ".o"
|
|
||||||
deepfreezefiles.append(f"\t\t{ofile} \\")
|
|
||||||
|
|
||||||
pyfile = relpath_for_posix_display(src.pyfile, ROOT_DIR)
|
pyfile = relpath_for_posix_display(src.pyfile, ROOT_DIR)
|
||||||
pyfiles.append(f'\t\t{pyfile} \\')
|
pyfiles.append(f'\t\t{pyfile} \\')
|
||||||
|
@ -603,15 +599,11 @@ def regen_makefile(modules):
|
||||||
f'\t{freeze}',
|
f'\t{freeze}',
|
||||||
'',
|
'',
|
||||||
])
|
])
|
||||||
deepfreezerules.append(f'{cfile}: {frozen_header} $(DEEPFREEZE_DEPS)')
|
deepfreezerules.append(f"\t{frozen_header}:{src.frozenid} \\")
|
||||||
deepfreezerules.append(
|
deepfreezerules.append('\t-o Python/deepfreeze/deepfreeze.c')
|
||||||
f"\t$(PYTHON_FOR_FREEZE) "
|
deepfreezerules.append('')
|
||||||
f"$(srcdir)/Tools/scripts/deepfreeze.py "
|
|
||||||
f"{frozen_header} -m {src.frozenid} -o {cfile}")
|
|
||||||
deepfreezerules.append('')
|
|
||||||
pyfiles[-1] = pyfiles[-1].rstrip(" \\")
|
pyfiles[-1] = pyfiles[-1].rstrip(" \\")
|
||||||
frozenfiles[-1] = frozenfiles[-1].rstrip(" \\")
|
frozenfiles[-1] = frozenfiles[-1].rstrip(" \\")
|
||||||
deepfreezefiles[-1] = deepfreezefiles[-1].rstrip(" \\")
|
|
||||||
|
|
||||||
print(f'# Updating {os.path.relpath(MAKEFILE)}')
|
print(f'# Updating {os.path.relpath(MAKEFILE)}')
|
||||||
with updating_file_with_tmpfile(MAKEFILE) as (infile, outfile):
|
with updating_file_with_tmpfile(MAKEFILE) as (infile, outfile):
|
||||||
|
@ -630,13 +622,6 @@ def regen_makefile(modules):
|
||||||
frozenfiles,
|
frozenfiles,
|
||||||
MAKEFILE,
|
MAKEFILE,
|
||||||
)
|
)
|
||||||
lines = replace_block(
|
|
||||||
lines,
|
|
||||||
"DEEPFREEZE_OBJS =",
|
|
||||||
"# End DEEPFREEZE_OBJS",
|
|
||||||
deepfreezefiles,
|
|
||||||
MAKEFILE,
|
|
||||||
)
|
|
||||||
lines = replace_block(
|
lines = replace_block(
|
||||||
lines,
|
lines,
|
||||||
"# BEGIN: freezing modules",
|
"# BEGIN: freezing modules",
|
||||||
|
@ -658,26 +643,24 @@ def regen_pcbuild(modules):
|
||||||
projlines = []
|
projlines = []
|
||||||
filterlines = []
|
filterlines = []
|
||||||
corelines = []
|
corelines = []
|
||||||
|
deepfreezerules = ['\t<Exec Command=\'$(PythonForBuild) "$(PySourcePath)Tools\\scripts\\deepfreeze.py" ^']
|
||||||
for src in _iter_sources(modules):
|
for src in _iter_sources(modules):
|
||||||
pyfile = relpath_for_windows_display(src.pyfile, ROOT_DIR)
|
pyfile = relpath_for_windows_display(src.pyfile, ROOT_DIR)
|
||||||
header = relpath_for_windows_display(src.frozenfile, ROOT_DIR)
|
header = relpath_for_windows_display(src.frozenfile, ROOT_DIR)
|
||||||
deepbase = "df." + src.id
|
|
||||||
deepoutfile = f"Python\\deepfreeze\\{deepbase}.c"
|
|
||||||
intfile = ntpath.splitext(ntpath.basename(header))[0] + '.g.h'
|
intfile = ntpath.splitext(ntpath.basename(header))[0] + '.g.h'
|
||||||
deepintfile = ntpath.splitext(ntpath.basename(header))[0] + '.g.c'
|
|
||||||
projlines.append(f' <None Include="..\\{pyfile}">')
|
projlines.append(f' <None Include="..\\{pyfile}">')
|
||||||
projlines.append(f' <ModName>{src.frozenid}</ModName>')
|
projlines.append(f' <ModName>{src.frozenid}</ModName>')
|
||||||
projlines.append(f' <IntFile>$(IntDir){intfile}</IntFile>')
|
projlines.append(f' <IntFile>$(IntDir){intfile}</IntFile>')
|
||||||
projlines.append(f' <OutFile>$(PySourcePath){header}</OutFile>')
|
projlines.append(f' <OutFile>$(PySourcePath){header}</OutFile>')
|
||||||
projlines.append(f' <DeepIntFile>$(IntDir){deepintfile}</DeepIntFile>')
|
|
||||||
projlines.append(f' <DeepOutFile>$(PySourcePath){deepoutfile}</DeepOutFile>')
|
|
||||||
projlines.append(f' </None>')
|
projlines.append(f' </None>')
|
||||||
|
|
||||||
filterlines.append(f' <None Include="..\\{pyfile}">')
|
filterlines.append(f' <None Include="..\\{pyfile}">')
|
||||||
filterlines.append(' <Filter>Python Files</Filter>')
|
filterlines.append(' <Filter>Python Files</Filter>')
|
||||||
filterlines.append(' </None>')
|
filterlines.append(' </None>')
|
||||||
|
deepfreezerules.append(f'\t\t "$(PySourcePath){header}:{src.frozenid}" ^')
|
||||||
|
deepfreezerules.append('\t\t "-o" "$(PySourcePath)Python\\deepfreeze\\deepfreeze.c"\'/>' )
|
||||||
|
|
||||||
corelines.append(f' <ClCompile Include="..\\{deepoutfile}" />')
|
corelines.append(f' <ClCompile Include="..\\Python\\deepfreeze\\deepfreeze.c" />')
|
||||||
|
|
||||||
print(f'# Updating {os.path.relpath(PCBUILD_PROJECT)}')
|
print(f'# Updating {os.path.relpath(PCBUILD_PROJECT)}')
|
||||||
with updating_file_with_tmpfile(PCBUILD_PROJECT) as (infile, outfile):
|
with updating_file_with_tmpfile(PCBUILD_PROJECT) as (infile, outfile):
|
||||||
|
@ -690,6 +673,16 @@ def regen_pcbuild(modules):
|
||||||
PCBUILD_PROJECT,
|
PCBUILD_PROJECT,
|
||||||
)
|
)
|
||||||
outfile.writelines(lines)
|
outfile.writelines(lines)
|
||||||
|
with updating_file_with_tmpfile(PCBUILD_PROJECT) as (infile, outfile):
|
||||||
|
lines = infile.readlines()
|
||||||
|
lines = replace_block(
|
||||||
|
lines,
|
||||||
|
'<!-- BEGIN deepfreeze rule -->',
|
||||||
|
'<!-- END deepfreeze rule -->',
|
||||||
|
deepfreezerules,
|
||||||
|
PCBUILD_PROJECT,
|
||||||
|
)
|
||||||
|
outfile.writelines(lines)
|
||||||
print(f'# Updating {os.path.relpath(PCBUILD_FILTERS)}')
|
print(f'# Updating {os.path.relpath(PCBUILD_FILTERS)}')
|
||||||
with updating_file_with_tmpfile(PCBUILD_FILTERS) as (infile, outfile):
|
with updating_file_with_tmpfile(PCBUILD_FILTERS) as (infile, outfile):
|
||||||
lines = infile.readlines()
|
lines = infile.readlines()
|
||||||
|
|
Loading…
Reference in a new issue