|
17 | 17 | import docutils.utils |
18 | 18 | import setuptools |
19 | 19 |
|
20 | | -__updated__ = '2020-01-29' |
| 20 | +__updated__ = '2020-02-02' |
21 | 21 |
|
22 | 22 | SETUP_TEMPLATE = '''"""Setup script.""" |
23 | 23 |
|
@@ -84,9 +84,10 @@ def parse_requirements( |
84 | 84 |
|
85 | 85 | def partition_version_classifiers( |
86 | 86 | classifiers: t.Sequence[str], version_prefix: str = 'Programming Language :: Python :: ', |
87 | | - only_suffix: str = ' :: Only') -> t.Tuple[t.List[str], t.List[str]]: |
| 87 | + only_suffix: str = ' :: Only') -> t.Tuple[t.List[t.Sequence[int]], t.List[t.Sequence[int]]]: |
88 | 88 | """Find version number classifiers in given list and partition them into 2 groups.""" |
89 | | - versions_min, versions_only = [], [] |
| 89 | + versions_min: t.List[t.Sequence[int]] = [] |
| 90 | + versions_only: t.List[t.Sequence[int]] = [] |
90 | 91 | for classifier in classifiers: |
91 | 92 | version = classifier.replace(version_prefix, '') |
92 | 93 | versions = versions_min |
@@ -148,6 +149,7 @@ def __init__(self, *args, **kwargs): |
148 | 149 |
|
149 | 150 | def visit_reference(self, node: docutils.nodes.reference) -> None: |
150 | 151 | """Call for "reference" nodes.""" |
| 152 | + assert isinstance(node, docutils.nodes.TextElement), type(node) |
151 | 153 | if len(node.children) != 1 or not isinstance(node.children[0], docutils.nodes.Text) \ |
152 | 154 | or not all(_ in node.attributes for _ in ('name', 'refuri')): |
153 | 155 | return |
@@ -229,8 +231,8 @@ class Package: |
229 | 231 | packages = None # type: t.List[str] |
230 | 232 | """If None, determined with help of setuptools.""" |
231 | 233 |
|
232 | | - package_data = {} |
233 | | - exclude_package_data = {} |
| 234 | + package_data = {} # type: t.Dict[str, t.List[str]] |
| 235 | + exclude_package_data = {} # type: t.Dict[str, t.List[str]] |
234 | 236 |
|
235 | 237 | install_requires = None # type: t.List[str] |
236 | 238 | """If None, determined using requirements.txt.""" |
@@ -259,14 +261,14 @@ def try_fields(cls, *names) -> t.Optional[t.Any]: |
259 | 261 | raise AttributeError((cls, names)) |
260 | 262 |
|
261 | 263 | @classmethod |
262 | | - def parse_readme(cls, readme_path: str = 'README.rst', |
| 264 | + def parse_readme(cls, readme_filename: str = 'README.rst', |
263 | 265 | encoding: str = 'utf-8') -> t.Tuple[str, str]: |
264 | 266 | """Parse readme and resolve relative links in it if it is feasible. |
265 | 267 |
|
266 | 268 | Links are resolved if readme is in rst format and the package is hosted on GitHub. |
267 | 269 | """ |
268 | | - readme_path = pathlib.Path(readme_path) |
269 | | - with HERE.joinpath(readme_path).open(encoding=encoding) as readme_file: |
| 270 | + readme_path = HERE.joinpath(readme_filename) |
| 271 | + with readme_path.open(encoding=encoding) as readme_file: |
270 | 272 | long_description = readme_file.read() # type: str |
271 | 273 |
|
272 | 274 | if readme_path.suffix.lower() == '.rst' and cls.url.startswith('https://github.com/'): |
|
0 commit comments