Skip to content

Commit a7415ed

Browse files
committed
Give generated .c files a "df." prefix
Also use a separate intermediate file for deepfreeze.
1 parent aea38e0 commit a7415ed

File tree

3 files changed

+66
-46
lines changed

3 files changed

+66
-46
lines changed

PCbuild/_freeze_module.vcxproj

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -234,133 +234,153 @@
234234
<ModName>importlib._bootstrap</ModName>
235235
<IntFile>$(IntDir)importlib._bootstrap.g.h</IntFile>
236236
<OutFile>$(PySourcePath)Python\frozen_modules\importlib._bootstrap.h</OutFile>
237-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\importlib._bootstrap.c</DeepOutFile>
237+
<DeepIntFile>$(IntDir)importlib._bootstrap.g.c</DeepIntFile>
238+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.importlib._bootstrap.c</DeepOutFile>
238239
</None>
239240
<None Include="..\Lib\importlib\_bootstrap_external.py">
240241
<ModName>importlib._bootstrap_external</ModName>
241242
<IntFile>$(IntDir)importlib._bootstrap_external.g.h</IntFile>
242243
<OutFile>$(PySourcePath)Python\frozen_modules\importlib._bootstrap_external.h</OutFile>
243-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\importlib._bootstrap_external.c</DeepOutFile>
244+
<DeepIntFile>$(IntDir)importlib._bootstrap_external.g.c</DeepIntFile>
245+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.importlib._bootstrap_external.c</DeepOutFile>
244246
</None>
245247
<None Include="..\Lib\zipimport.py">
246248
<ModName>zipimport</ModName>
247249
<IntFile>$(IntDir)zipimport.g.h</IntFile>
248250
<OutFile>$(PySourcePath)Python\frozen_modules\zipimport.h</OutFile>
249-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\zipimport.c</DeepOutFile>
251+
<DeepIntFile>$(IntDir)zipimport.g.c</DeepIntFile>
252+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.zipimport.c</DeepOutFile>
250253
</None>
251254
<None Include="..\Lib\abc.py">
252255
<ModName>abc</ModName>
253256
<IntFile>$(IntDir)abc.g.h</IntFile>
254257
<OutFile>$(PySourcePath)Python\frozen_modules\abc.h</OutFile>
255-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\abc.c</DeepOutFile>
258+
<DeepIntFile>$(IntDir)abc.g.c</DeepIntFile>
259+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.abc.c</DeepOutFile>
256260
</None>
257261
<None Include="..\Lib\codecs.py">
258262
<ModName>codecs</ModName>
259263
<IntFile>$(IntDir)codecs.g.h</IntFile>
260264
<OutFile>$(PySourcePath)Python\frozen_modules\codecs.h</OutFile>
261-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\codecs_.c</DeepOutFile>
265+
<DeepIntFile>$(IntDir)codecs.g.c</DeepIntFile>
266+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.codecs.c</DeepOutFile>
262267
</None>
263268
<None Include="..\Lib\io.py">
264269
<ModName>io</ModName>
265270
<IntFile>$(IntDir)io.g.h</IntFile>
266271
<OutFile>$(PySourcePath)Python\frozen_modules\io.h</OutFile>
267-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\io.c</DeepOutFile>
272+
<DeepIntFile>$(IntDir)io.g.c</DeepIntFile>
273+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.io.c</DeepOutFile>
268274
</None>
269275
<None Include="..\Lib\_collections_abc.py">
270276
<ModName>_collections_abc</ModName>
271277
<IntFile>$(IntDir)_collections_abc.g.h</IntFile>
272278
<OutFile>$(PySourcePath)Python\frozen_modules\_collections_abc.h</OutFile>
273-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\_collections_abc.c</DeepOutFile>
279+
<DeepIntFile>$(IntDir)_collections_abc.g.c</DeepIntFile>
280+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df._collections_abc.c</DeepOutFile>
274281
</None>
275282
<None Include="..\Lib\_sitebuiltins.py">
276283
<ModName>_sitebuiltins</ModName>
277284
<IntFile>$(IntDir)_sitebuiltins.g.h</IntFile>
278285
<OutFile>$(PySourcePath)Python\frozen_modules\_sitebuiltins.h</OutFile>
279-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\_sitebuiltins.c</DeepOutFile>
286+
<DeepIntFile>$(IntDir)_sitebuiltins.g.c</DeepIntFile>
287+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df._sitebuiltins.c</DeepOutFile>
280288
</None>
281289
<None Include="..\Lib\genericpath.py">
282290
<ModName>genericpath</ModName>
283291
<IntFile>$(IntDir)genericpath.g.h</IntFile>
284292
<OutFile>$(PySourcePath)Python\frozen_modules\genericpath.h</OutFile>
285-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\genericpath.c</DeepOutFile>
293+
<DeepIntFile>$(IntDir)genericpath.g.c</DeepIntFile>
294+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.genericpath.c</DeepOutFile>
286295
</None>
287296
<None Include="..\Lib\ntpath.py">
288297
<ModName>ntpath</ModName>
289298
<IntFile>$(IntDir)ntpath.g.h</IntFile>
290299
<OutFile>$(PySourcePath)Python\frozen_modules\ntpath.h</OutFile>
291-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\ntpath.c</DeepOutFile>
300+
<DeepIntFile>$(IntDir)ntpath.g.c</DeepIntFile>
301+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.ntpath.c</DeepOutFile>
292302
</None>
293303
<None Include="..\Lib\posixpath.py">
294304
<ModName>posixpath</ModName>
295305
<IntFile>$(IntDir)posixpath.g.h</IntFile>
296306
<OutFile>$(PySourcePath)Python\frozen_modules\posixpath.h</OutFile>
297-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\posixpath.c</DeepOutFile>
307+
<DeepIntFile>$(IntDir)posixpath.g.c</DeepIntFile>
308+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.posixpath.c</DeepOutFile>
298309
</None>
299310
<None Include="..\Lib\os.py">
300311
<ModName>os</ModName>
301312
<IntFile>$(IntDir)os.g.h</IntFile>
302313
<OutFile>$(PySourcePath)Python\frozen_modules\os.h</OutFile>
303-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\os.c</DeepOutFile>
314+
<DeepIntFile>$(IntDir)os.g.c</DeepIntFile>
315+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.os.c</DeepOutFile>
304316
</None>
305317
<None Include="..\Lib\site.py">
306318
<ModName>site</ModName>
307319
<IntFile>$(IntDir)site.g.h</IntFile>
308320
<OutFile>$(PySourcePath)Python\frozen_modules\site.h</OutFile>
309-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\site.c</DeepOutFile>
321+
<DeepIntFile>$(IntDir)site.g.c</DeepIntFile>
322+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.site.c</DeepOutFile>
310323
</None>
311324
<None Include="..\Lib\stat.py">
312325
<ModName>stat</ModName>
313326
<IntFile>$(IntDir)stat.g.h</IntFile>
314327
<OutFile>$(PySourcePath)Python\frozen_modules\stat.h</OutFile>
315-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\stat.c</DeepOutFile>
328+
<DeepIntFile>$(IntDir)stat.g.c</DeepIntFile>
329+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.stat.c</DeepOutFile>
316330
</None>
317331
<None Include="..\Lib\__hello__.py">
318332
<ModName>__hello__</ModName>
319333
<IntFile>$(IntDir)__hello__.g.h</IntFile>
320334
<OutFile>$(PySourcePath)Python\frozen_modules\__hello__.h</OutFile>
321-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\__hello__.c</DeepOutFile>
335+
<DeepIntFile>$(IntDir)__hello__.g.c</DeepIntFile>
336+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.__hello__.c</DeepOutFile>
322337
</None>
323338
<None Include="..\Lib\__phello__\__init__.py">
324339
<ModName>__phello__</ModName>
325340
<IntFile>$(IntDir)__phello__.g.h</IntFile>
326341
<OutFile>$(PySourcePath)Python\frozen_modules\__phello__.h</OutFile>
327-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\__phello__.c</DeepOutFile>
342+
<DeepIntFile>$(IntDir)__phello__.g.c</DeepIntFile>
343+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.__phello__.c</DeepOutFile>
328344
</None>
329345
<None Include="..\Lib\__phello__\ham\__init__.py">
330346
<ModName>__phello__.ham</ModName>
331347
<IntFile>$(IntDir)__phello__.ham.g.h</IntFile>
332348
<OutFile>$(PySourcePath)Python\frozen_modules\__phello__.ham.h</OutFile>
333-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\__phello__.ham.c</DeepOutFile>
349+
<DeepIntFile>$(IntDir)__phello__.ham.g.c</DeepIntFile>
350+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.__phello__.ham.c</DeepOutFile>
334351
</None>
335352
<None Include="..\Lib\__phello__\ham\eggs.py">
336353
<ModName>__phello__.ham.eggs</ModName>
337354
<IntFile>$(IntDir)__phello__.ham.eggs.g.h</IntFile>
338355
<OutFile>$(PySourcePath)Python\frozen_modules\__phello__.ham.eggs.h</OutFile>
339-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\__phello__.ham.eggs.c</DeepOutFile>
356+
<DeepIntFile>$(IntDir)__phello__.ham.eggs.g.c</DeepIntFile>
357+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.__phello__.ham.eggs.c</DeepOutFile>
340358
</None>
341359
<None Include="..\Lib\__phello__\spam.py">
342360
<ModName>__phello__.spam</ModName>
343361
<IntFile>$(IntDir)__phello__.spam.g.h</IntFile>
344362
<OutFile>$(PySourcePath)Python\frozen_modules\__phello__.spam.h</OutFile>
345-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\__phello__.spam.c</DeepOutFile>
363+
<DeepIntFile>$(IntDir)__phello__.spam.g.c</DeepIntFile>
364+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.__phello__.spam.c</DeepOutFile>
346365
</None>
347366
<None Include="..\Tools\freeze\flag.py">
348367
<ModName>frozen_only</ModName>
349368
<IntFile>$(IntDir)frozen_only.g.h</IntFile>
350369
<OutFile>$(PySourcePath)Python\frozen_modules\frozen_only.h</OutFile>
351-
<DeepOutFile>$(PySourcePath)Python\deepfreeze\frozen_only.c</DeepOutFile>
370+
<DeepIntFile>$(IntDir)frozen_only.g.c</DeepIntFile>
371+
<DeepOutFile>$(PySourcePath)Python\deepfreeze\df.frozen_only.c</DeepOutFile>
352372
</None>
353373
<!-- END frozen modules -->
354374
</ItemGroup>
355375
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
356376
<ImportGroup Label="ExtensionTargets">
357377
</ImportGroup>
358378
<Target Name="_RebuildFrozen" AfterTargets="AfterBuild" Condition="$(Configuration) != 'PGUpdate'">
359-
<Exec Command='"$(TargetPath)" "%(None.ModName)" "%(None.FullPath)" "%(None.IntFile)"' />
379+
<Exec Command='"$(TargetPath)" "%(None.ModName)" "%(None.FullPath)" "%(None.DeepIntFile)"' />
360380

361-
<Copy SourceFiles="%(None.IntFile)"
381+
<Copy SourceFiles="%(None.DeepIntFile)"
362382
DestinationFiles="%(None.OutFile)"
363-
Condition="!Exists(%(None.OutFile)) or (Exists(%(None.IntFile)) and '$([System.IO.File]::ReadAllText(%(None.OutFile)).Replace(`&#x0D;&#x0A;`, `&#x0A;`))' != '$([System.IO.File]::ReadAllText(%(None.IntFile)).Replace(`&#x0D;&#x0A;`, `&#x0A;`))')">
383+
Condition="!Exists(%(None.OutFile)) or (Exists(%(None.DeepIntFile)) and '$([System.IO.File]::ReadAllText(%(None.OutFile)).Replace(`&#x0D;&#x0A;`, `&#x0A;`))' != '$([System.IO.File]::ReadAllText(%(None.DeepIntFile)).Replace(`&#x0D;&#x0A;`, `&#x0A;`))')">
364384
<Output TaskParameter="CopiedFiles" ItemName="_Updated" />
365385
</Copy>
366386

PCbuild/pythoncore.vcxproj

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -502,26 +502,26 @@
502502
</ItemGroup>
503503
<ItemGroup>
504504
<!-- BEGIN deepfreeze -->
505-
<ClCompile Include="..\Python\deepfreeze\importlib._bootstrap.c" />
506-
<ClCompile Include="..\Python\deepfreeze\importlib._bootstrap_external.c" />
507-
<ClCompile Include="..\Python\deepfreeze\zipimport.c" />
508-
<ClCompile Include="..\Python\deepfreeze\abc.c" />
509-
<ClCompile Include="..\Python\deepfreeze\codecs_.c" />
510-
<ClCompile Include="..\Python\deepfreeze\io.c" />
511-
<ClCompile Include="..\Python\deepfreeze\_collections_abc.c" />
512-
<ClCompile Include="..\Python\deepfreeze\_sitebuiltins.c" />
513-
<ClCompile Include="..\Python\deepfreeze\genericpath.c" />
514-
<ClCompile Include="..\Python\deepfreeze\ntpath.c" />
515-
<ClCompile Include="..\Python\deepfreeze\posixpath.c" />
516-
<ClCompile Include="..\Python\deepfreeze\os.c" />
517-
<ClCompile Include="..\Python\deepfreeze\site.c" />
518-
<ClCompile Include="..\Python\deepfreeze\stat.c" />
519-
<ClCompile Include="..\Python\deepfreeze\__hello__.c" />
520-
<ClCompile Include="..\Python\deepfreeze\__phello__.c" />
521-
<ClCompile Include="..\Python\deepfreeze\__phello__.ham.c" />
522-
<ClCompile Include="..\Python\deepfreeze\__phello__.ham.eggs.c" />
523-
<ClCompile Include="..\Python\deepfreeze\__phello__.spam.c" />
524-
<ClCompile Include="..\Python\deepfreeze\frozen_only.c" />
505+
<ClCompile Include="..\Python\deepfreeze\df.importlib._bootstrap.c" />
506+
<ClCompile Include="..\Python\deepfreeze\df.importlib._bootstrap_external.c" />
507+
<ClCompile Include="..\Python\deepfreeze\df.zipimport.c" />
508+
<ClCompile Include="..\Python\deepfreeze\df.abc.c" />
509+
<ClCompile Include="..\Python\deepfreeze\df.codecs.c" />
510+
<ClCompile Include="..\Python\deepfreeze\df.io.c" />
511+
<ClCompile Include="..\Python\deepfreeze\df._collections_abc.c" />
512+
<ClCompile Include="..\Python\deepfreeze\df._sitebuiltins.c" />
513+
<ClCompile Include="..\Python\deepfreeze\df.genericpath.c" />
514+
<ClCompile Include="..\Python\deepfreeze\df.ntpath.c" />
515+
<ClCompile Include="..\Python\deepfreeze\df.posixpath.c" />
516+
<ClCompile Include="..\Python\deepfreeze\df.os.c" />
517+
<ClCompile Include="..\Python\deepfreeze\df.site.c" />
518+
<ClCompile Include="..\Python\deepfreeze\df.stat.c" />
519+
<ClCompile Include="..\Python\deepfreeze\df.__hello__.c" />
520+
<ClCompile Include="..\Python\deepfreeze\df.__phello__.c" />
521+
<ClCompile Include="..\Python\deepfreeze\df.__phello__.ham.c" />
522+
<ClCompile Include="..\Python\deepfreeze\df.__phello__.ham.eggs.c" />
523+
<ClCompile Include="..\Python\deepfreeze\df.__phello__.spam.c" />
524+
<ClCompile Include="..\Python\deepfreeze\df.frozen_only.c" />
525525
<!-- END deepfreeze -->
526526
</ItemGroup>
527527
<ItemGroup Condition="$(IncludeExternals)">

Tools/scripts/freeze_modules.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -721,15 +721,15 @@ def regen_pcbuild(modules):
721721
for src in _iter_sources(modules):
722722
pyfile = relpath_for_windows_display(src.pyfile, ROOT_DIR)
723723
header = relpath_for_windows_display(src.frozenfile, ROOT_DIR)
724-
deepbase = src.id
725-
if deepbase == "codecs":
726-
deepbase = "codecs_" # Annoying exception (duplicate file)
724+
deepbase = "df." + src.id
727725
deepoutfile = f"Python\\deepfreeze\\{deepbase}.c"
728726
intfile = ntpath.splitext(ntpath.basename(header))[0] + '.g.h'
727+
deepintfile = ntpath.splitext(ntpath.basename(header))[0] + '.g.c'
729728
projlines.append(f' <None Include="..\\{pyfile}">')
730729
projlines.append(f' <ModName>{src.frozenid}</ModName>')
731730
projlines.append(f' <IntFile>$(IntDir){intfile}</IntFile>')
732731
projlines.append(f' <OutFile>$(PySourcePath){header}</OutFile>')
732+
projlines.append(f' <DeepIntFile>$(IntDir){deepintfile}</DeepIntFile>')
733733
projlines.append(f' <DeepOutFile>$(PySourcePath){deepoutfile}</DeepOutFile>')
734734
projlines.append(f' </None>')
735735

0 commit comments

Comments
 (0)