|
9 | 9 |
|
10 | 10 | import functools
|
11 | 11 | import os
|
12 |
| -import re |
13 | 12 | import sys
|
14 | 13 | from abc import abstractmethod
|
15 | 14 | from collections.abc import Mapping
|
|
30 | 29 | from .warnings import SetuptoolsDeprecationWarning
|
31 | 30 |
|
32 | 31 | import distutils.core
|
33 |
| -from distutils.errors import DistutilsOptionError |
34 | 32 |
|
35 | 33 | __all__ = [
|
36 | 34 | 'setup',
|
@@ -175,42 +173,6 @@ def __init__(self, dist: Distribution, **kw) -> None:
|
175 | 173 | super().__init__(dist)
|
176 | 174 | vars(self).update(kw)
|
177 | 175 |
|
178 |
| - def _ensure_stringlike(self, option, what, default=None): |
179 |
| - val = getattr(self, option) |
180 |
| - if val is None: |
181 |
| - setattr(self, option, default) |
182 |
| - return default |
183 |
| - elif not isinstance(val, str): |
184 |
| - raise DistutilsOptionError(f"'{option}' must be a {what} (got `{val}`)") |
185 |
| - return val |
186 |
| - |
187 |
| - def ensure_string_list(self, option: str) -> None: |
188 |
| - r"""Ensure that 'option' is a list of strings. If 'option' is |
189 |
| - currently a string, we split it either on /,\s*/ or /\s+/, so |
190 |
| - "foo bar baz", "foo,bar,baz", and "foo, bar baz" all become |
191 |
| - ["foo", "bar", "baz"]. |
192 |
| -
|
193 |
| - .. |
194 |
| - TODO: This method seems to be similar to the one in ``distutils.cmd`` |
195 |
| - Probably it is just here for backward compatibility with old Python versions? |
196 |
| -
|
197 |
| - :meta private: |
198 |
| - """ |
199 |
| - val = getattr(self, option) |
200 |
| - if val is None: |
201 |
| - return |
202 |
| - elif isinstance(val, str): |
203 |
| - setattr(self, option, re.split(r',\s*|\s+', val)) |
204 |
| - else: |
205 |
| - if isinstance(val, list): |
206 |
| - ok = all(isinstance(v, str) for v in val) |
207 |
| - else: |
208 |
| - ok = False |
209 |
| - if not ok: |
210 |
| - raise DistutilsOptionError( |
211 |
| - f"'{option}' must be a list of strings (got {val!r})" |
212 |
| - ) |
213 |
| - |
214 | 176 | @overload
|
215 | 177 | def reinitialize_command(
|
216 | 178 | self, command: str, reinit_subcommands: bool = False, **kw
|
|
0 commit comments