Skip to content

Commit 997f671

Browse files
committed
Extract method for _section_options.
1 parent aab7fa7 commit 997f671

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

setuptools/config/setupcfg.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -251,25 +251,29 @@ def __init__(
251251
ignore_option_errors,
252252
ensure_discovered: expand.EnsurePackagesDiscovered,
253253
):
254+
self.ignore_option_errors = ignore_option_errors
255+
self.target_obj = target_obj
256+
self.sections = self._section_options(options)
257+
self.set_options: List[str] = []
258+
self.ensure_discovered = ensure_discovered
259+
self._referenced_files: Set[str] = set()
260+
"""After parsing configurations, this property will enumerate
261+
all files referenced by the "file:" directive. Private API for setuptools only.
262+
"""
263+
264+
@classmethod
265+
def _section_options(cls, options: AllCommandOptions):
254266
sections: AllCommandOptions = {}
255267

256-
section_prefix = self.section_prefix
268+
section_prefix = cls.section_prefix
257269
for section_name, section_options in options.items():
258270
if not section_name.startswith(section_prefix):
259271
continue
260272

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

264-
self.ignore_option_errors = ignore_option_errors
265-
self.target_obj = target_obj
266-
self.sections = sections
267-
self.set_options: List[str] = []
268-
self.ensure_discovered = ensure_discovered
269-
self._referenced_files: Set[str] = set()
270-
"""After parsing configurations, this property will enumerate
271-
all files referenced by the "file:" directive. Private API for setuptools only.
272-
"""
276+
return sections
273277

274278
@property
275279
def parsers(self):

0 commit comments

Comments
 (0)