mirror of
https://github.com/python/cpython.git
synced 2025-07-18 16:55:20 +00:00
bpo-45949: Pure Python freeze module for cross builds (GH-29899)
This commit is contained in:
parent
a62be77266
commit
eb483c46d6
9 changed files with 205 additions and 115 deletions
|
@ -264,6 +264,10 @@ class FrozenSource(namedtuple('FrozenSource', 'id pyfile frozenfile deepfreezefi
|
|||
else:
|
||||
return os.path.basename(self.pyfile) == '__init__.py'
|
||||
|
||||
@property
|
||||
def isbootstrap(self):
|
||||
return self.id in BOOTSTRAP
|
||||
|
||||
|
||||
def resolve_frozen_file(frozenid, destdir):
|
||||
"""Return the filename corresponding to the given frozen ID.
|
||||
|
@ -476,7 +480,7 @@ def regen_frozen(modules):
|
|||
indent = ' '
|
||||
lastsection = None
|
||||
for mod in modules:
|
||||
if mod.frozenid in BOOTSTRAP:
|
||||
if mod.isbootstrap:
|
||||
lines = bootstraplines
|
||||
elif mod.section == TESTS_SECTION:
|
||||
lines = testlines
|
||||
|
@ -585,10 +589,17 @@ def regen_makefile(modules):
|
|||
pyfile = relpath_for_posix_display(src.pyfile, ROOT_DIR)
|
||||
pyfiles.append(f'\t\t{pyfile} \\')
|
||||
|
||||
freeze = (f'$(FREEZE_MODULE) {src.frozenid} '
|
||||
f'$(srcdir)/{pyfile} {frozen_header}')
|
||||
if src.isbootstrap:
|
||||
freezecmd = '$(FREEZE_MODULE_BOOTSTRAP)'
|
||||
freezedep = '$(FREEZE_MODULE_BOOTSTRAP_DEPS)'
|
||||
else:
|
||||
freezecmd = '$(FREEZE_MODULE)'
|
||||
freezedep = '$(FREEZE_MODULE_DEPS)'
|
||||
|
||||
freeze = (f'{freezecmd} {src.frozenid} '
|
||||
f'$(srcdir)/{pyfile} {frozen_header}')
|
||||
rules.extend([
|
||||
f'{frozen_header}: $(FREEZE_MODULE) {pyfile}',
|
||||
f'{frozen_header}: {pyfile} {freezedep}',
|
||||
f'\t{freeze}',
|
||||
'',
|
||||
])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue