Skip to content

Commit

Permalink
Extract method for _section_options.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Mar 6, 2023
1 parent aab7fa7 commit 997f671
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions setuptools/config/setupcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,25 +251,29 @@ def __init__(
ignore_option_errors,
ensure_discovered: expand.EnsurePackagesDiscovered,
):
self.ignore_option_errors = ignore_option_errors
self.target_obj = target_obj
self.sections = self._section_options(options)
self.set_options: List[str] = []
self.ensure_discovered = ensure_discovered
self._referenced_files: Set[str] = set()
"""After parsing configurations, this property will enumerate
all files referenced by the "file:" directive. Private API for setuptools only.
"""

@classmethod
def _section_options(cls, options: AllCommandOptions):
sections: AllCommandOptions = {}

section_prefix = self.section_prefix
section_prefix = cls.section_prefix
for section_name, section_options in options.items():
if not section_name.startswith(section_prefix):
continue

section_name = section_name.replace(section_prefix, '').strip('.')
sections[section_name] = section_options

self.ignore_option_errors = ignore_option_errors
self.target_obj = target_obj
self.sections = sections
self.set_options: List[str] = []
self.ensure_discovered = ensure_discovered
self._referenced_files: Set[str] = set()
"""After parsing configurations, this property will enumerate
all files referenced by the "file:" directive. Private API for setuptools only.
"""
return sections

@property
def parsers(self):
Expand Down

0 comments on commit 997f671

Please sign in to comment.