summaryrefslogtreecommitdiff
path: root/setuptools
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2023-03-05 22:12:22 -0500
committerJason R. Coombs <jaraco@jaraco.com>2023-03-05 22:12:22 -0500
commit997f671dbf64a5273968ce0f53a2369fd7abbee3 (patch)
tree1e77d3fa855bd197b03c38dbd1baa41a3372b061 /setuptools
parentaab7fa7bd8eb01ea31d4be6fe873d9b9c719365e (diff)
downloadpython-setuptools-git-997f671dbf64a5273968ce0f53a2369fd7abbee3.tar.gz
Extract method for _section_options.
Diffstat (limited to 'setuptools')
-rw-r--r--setuptools/config/setupcfg.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/setuptools/config/setupcfg.py b/setuptools/config/setupcfg.py
index 88042cdd..1b617013 100644
--- a/setuptools/config/setupcfg.py
+++ b/setuptools/config/setupcfg.py
@@ -251,9 +251,21 @@ class ConfigHandler(Generic[Target]):
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
@@ -261,15 +273,7 @@ class ConfigHandler(Generic[Target]):
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):