FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-45019: Do some cleanup related to frozen modules. by ericsnowcurrently · Pull Request #28319 · python/cpython · GitHub

Repository navigation

Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
63cd6f6
Fix freeze_module() in freeze_modules.py.
ericsnowcurrently Sep 2, 2021
0223e32
Add FrozenSource and FrozenModule to freeze_modules.py.
ericsnowcurrently Sep 1, 2021
a2be976
Leave all non-required frozen modules uncommitted.
ericsnowcurrently Sep 2, 2021
7a9d113
Leave *all* frozen modules uncommitted.
ericsnowcurrently Sep 2, 2021
e0f264f
Generate the list of frozen modules used by test_ctypes.
ericsnowcurrently Sep 1, 2021
c4cea0f
Ignore frozen submodules in generate_stdlib_module_names.py.
ericsnowcurrently Sep 7, 2021
1336b4e
Add a comment to the frozen modules manifest file.
ericsnowcurrently Sep 7, 2021
122492a
Show how the frozen manifest changed.
ericsnowcurrently Sep 7, 2021
4c1bc81
Go back to keeping frozen modules in the repo.
ericsnowcurrently Sep 7, 2021
cd99280
Also stop tracking the frozen manifest.
ericsnowcurrently Sep 8, 2021
65a9562
Mark the frozen manifest as a generated file.
ericsnowcurrently Sep 8, 2021
122e642
Drop a superfluous prefix on makefile rule dependencies.
ericsnowcurrently Sep 8, 2021
0704664
Do not generate test code.
ericsnowcurrently Sep 8, 2021
81d70ea
Drop unused code from freeze_modules.py.
ericsnowcurrently Sep 8, 2021
a61afbd
Do not clear the frozen .h files with "make distclean", now that they…
ericsnowcurrently Sep 9, 2021
ca35ee8
Always flush the printed "title" when freezing modules.
ericsnowcurrently Sep 10, 2021
1bf4d2f
Add the frozen manifest back into the repo.
ericsnowcurrently Sep 10, 2021
bd129b5
On Windows, only freeze the essential modules for now.
ericsnowcurrently Sep 13, 2021
20d3b50
Drop an outdated call.
ericsnowcurrently Sep 13, 2021
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
Prev Previous commit
Next Next commit
Drop unused code from freeze_modules.py.
  • Loading branch information
ericsnowcurrently committed Sep 13, 2021
commit 81d70eaaffb8681738656d54ce56e1a28d1cf2cc
59 changes: 1 addition & 58 deletions Tools/scripts/freeze_modules.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def parse_frozen_specs(sectionalspecs=FROZEN, destdir=None):
source = FrozenSource.from_id(frozenid, pyfile, destdir)
seen[frozenid] = source
else:
# assert not pyfile or pyfile == source.pyfile
assert not pyfile
yield FrozenModule(modname, ispkg, section, source)

Expand Down Expand Up @@ -164,30 +163,6 @@ def iter_subs():

class FrozenSource(namedtuple('FrozenSource', 'id pyfile frozenfile')):

@classmethod
def from_raw(cls, raw, destdir=MODULES_DIR):
section = None
if isinstance(raw, cls):
return raw.resolve_frozen(destdir), section
elif isinstance(raw, FrozenSource):
raise NotImplementedError(raw)

# Try FrozenModule.
try:
source = raw.source
section = raw.section
except AttributeError:
pass
else:
if not isinstance(source, FrozenSource):
raise ValueError(f'bad raw value {raw!r}')
return cls.from_raw(source), section

# It must be a raw spec.
frozenid, pyfile, *_, section = mod
source = cls.from_id(frozenid, pyfile, destdir)
return source, section

@classmethod
def from_id(cls, frozenid, pyfile=None, destdir=MODULES_DIR):
if not pyfile:
Expand All @@ -212,20 +187,6 @@ def symbol(self):
name = self.frozenid.replace('.', '_')
return '_Py_M__' + name

def resolve_frozen(self, destdir=MODULES_DIR):
if not destdir:
return self
if self.frozenfile != os.path.basename(self.frozenfile):
return self
return self._replace(
frozenfile=resolve_frozenfile(self.id, destdir),
)

def get_array_size(self):
with open(self.frozenfile) as frozenfile:
text = frozenfile.read()
return text.count(',')


def resolve_frozen_file(frozenid, destdir=MODULES_DIR):
"""Return the filename corresponding to the given frozen ID.
Expand All @@ -245,24 +206,6 @@ def resolve_frozen_file(frozenid, destdir=MODULES_DIR):
return os.path.join(destdir, frozenfile)


def resolve_frozen_files(modules, destdir=MODULES_DIR):
frozen = {}
frozenids = []
lastsection = None
for mod in modules:
src, section = FrozenSource.from_raw(mod, destdir)
if src.frozenid in frozen:
if section is None:
lastsection = None
else:
assert section == lastsection
continue
lastsection = section
frozen[frozenid] = src
frozenids.append(frozenid)
return frozen, frozenids


#######################################
# frozen modules

Expand Down Expand Up @@ -290,7 +233,7 @@ def summarize(self):
}


def _iter_sources(modules, destdir=MODULES_DIR):
def _iter_sources(modules):
seen = set()
for mod in modules:
if mod.source not in seen:
Expand Down

Back | FazBrowse Home | New Git URL