py2docfx 0.1.9.dev1917798__py3-none-any.whl → 0.1.9.dev1926139__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- py2docfx/__main__.py +77 -22
- py2docfx/convert_prepare/environment.py +34 -13
- py2docfx/convert_prepare/generate_document.py +12 -5
- py2docfx/convert_prepare/get_source.py +5 -1
- py2docfx/convert_prepare/git.py +24 -20
- py2docfx/convert_prepare/package_info.py +15 -9
- py2docfx/convert_prepare/pip_utils.py +29 -8
- py2docfx/convert_prepare/post_process/merge_toc.py +5 -1
- py2docfx/convert_prepare/sphinx_caller.py +31 -14
- py2docfx/convert_prepare/tests/test_generate_document.py +2 -0
- py2docfx/convert_prepare/tests/test_sphinx_caller.py +2 -0
- py2docfx/convert_prepare/tests/utils.py +11 -0
- py2docfx/docfx_yaml/build_finished.py +11 -3
- py2docfx/docfx_yaml/convert_class.py +4 -2
- py2docfx/docfx_yaml/convert_enum.py +4 -2
- py2docfx/docfx_yaml/convert_module.py +4 -2
- py2docfx/docfx_yaml/convert_package.py +4 -2
- py2docfx/docfx_yaml/logger.py +68 -0
- py2docfx/docfx_yaml/process_doctree.py +6 -4
- py2docfx/docfx_yaml/translator.py +5 -7
- py2docfx/docfx_yaml/writer.py +10 -4
- py2docfx/docfx_yaml/yaml_builder.py +0 -1
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/build_meta.py +2 -2
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/command/bdist_egg.py +1 -1
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/command/bdist_wheel.py +25 -39
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/command/build_ext.py +2 -2
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/command/build_py.py +9 -14
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/command/easy_install.py +2 -2
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/command/editable_wheel.py +2 -2
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/command/egg_info.py +3 -2
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/command/install_egg_info.py +2 -2
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/command/saveopts.py +2 -2
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/command/sdist.py +2 -2
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/command/setopt.py +1 -1
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/config/pyprojecttoml.py +0 -13
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/dist.py +3 -2
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/monkey.py +3 -3
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/msvc.py +11 -11
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/tests/config/test_pyprojecttoml.py +0 -7
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/tests/test_core_metadata.py +168 -72
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/unicode_utils.py +3 -3
- py2docfx/venv/basevenv/Lib/site-packages/wheel/__init__.py +1 -1
- py2docfx/venv/basevenv/Lib/site-packages/wheel/cli/convert.py +1 -2
- py2docfx/venv/venv1/Lib/site-packages/jwt/__init__.py +3 -2
- py2docfx/venv/venv1/Lib/site-packages/jwt/algorithms.py +31 -16
- py2docfx/venv/venv1/Lib/site-packages/jwt/api_jws.py +19 -8
- py2docfx/venv/venv1/Lib/site-packages/jwt/api_jwt.py +75 -19
- py2docfx/venv/venv1/Lib/site-packages/jwt/exceptions.py +8 -0
- py2docfx/venv/venv1/Lib/site-packages/jwt/help.py +4 -1
- py2docfx/venv/venv1/Lib/site-packages/jwt/jwks_client.py +4 -2
- py2docfx/venv/venv1/Lib/site-packages/jwt/utils.py +7 -10
- py2docfx/venv/venv1/Lib/site-packages/msal/application.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/msal/managed_identity.py +5 -3
- py2docfx/venv/venv1/Lib/site-packages/setuptools/build_meta.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/setuptools/command/bdist_egg.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/setuptools/command/bdist_wheel.py +25 -39
- py2docfx/venv/venv1/Lib/site-packages/setuptools/command/build_ext.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/setuptools/command/build_py.py +9 -14
- py2docfx/venv/venv1/Lib/site-packages/setuptools/command/easy_install.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/setuptools/command/editable_wheel.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/setuptools/command/egg_info.py +3 -2
- py2docfx/venv/venv1/Lib/site-packages/setuptools/command/install_egg_info.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/setuptools/command/saveopts.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/setuptools/command/sdist.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/setuptools/command/setopt.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/setuptools/config/pyprojecttoml.py +0 -13
- py2docfx/venv/venv1/Lib/site-packages/setuptools/dist.py +3 -2
- py2docfx/venv/venv1/Lib/site-packages/setuptools/monkey.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/setuptools/msvc.py +11 -11
- py2docfx/venv/venv1/Lib/site-packages/setuptools/tests/config/test_pyprojecttoml.py +0 -7
- py2docfx/venv/venv1/Lib/site-packages/setuptools/tests/test_core_metadata.py +168 -72
- py2docfx/venv/venv1/Lib/site-packages/setuptools/unicode_utils.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/wheel/__init__.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/wheel/cli/convert.py +1 -2
- {py2docfx-0.1.9.dev1917798.dist-info → py2docfx-0.1.9.dev1926139.dist-info}/METADATA +1 -1
- {py2docfx-0.1.9.dev1917798.dist-info → py2docfx-0.1.9.dev1926139.dist-info}/RECORD +79 -77
- {py2docfx-0.1.9.dev1917798.dist-info → py2docfx-0.1.9.dev1926139.dist-info}/WHEEL +1 -1
- /py2docfx/convert_prepare/conf_templates/{master_doc.rst_t → root_doc.rst_t} +0 -0
- {py2docfx-0.1.9.dev1917798.dist-info → py2docfx-0.1.9.dev1926139.dist-info}/top_level.txt +0 -0
@@ -14,14 +14,12 @@ import sys
|
|
14
14
|
import sysconfig
|
15
15
|
import warnings
|
16
16
|
from collections.abc import Iterable, Sequence
|
17
|
-
from email.generator import BytesGenerator
|
18
|
-
from email.policy import EmailPolicy
|
17
|
+
from email.generator import BytesGenerator
|
19
18
|
from glob import iglob
|
20
19
|
from typing import Literal, cast
|
21
20
|
from zipfile import ZIP_DEFLATED, ZIP_STORED
|
22
21
|
|
23
22
|
from packaging import tags, version as _packaging_version
|
24
|
-
from wheel.metadata import pkginfo_to_metadata
|
25
23
|
from wheel.wheelfile import WheelFile
|
26
24
|
|
27
25
|
from .. import Command, __version__, _shutil
|
@@ -220,7 +218,7 @@ class bdist_wheel(Command):
|
|
220
218
|
|
221
219
|
def initialize_options(self) -> None:
|
222
220
|
self.bdist_dir: str | None = None
|
223
|
-
self.data_dir
|
221
|
+
self.data_dir = ""
|
224
222
|
self.plat_name: str | None = None
|
225
223
|
self.plat_tag: str | None = None
|
226
224
|
self.format = "zip"
|
@@ -569,42 +567,30 @@ class bdist_wheel(Command):
|
|
569
567
|
|
570
568
|
raise ValueError(err)
|
571
569
|
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
ignore=lambda x, y: {
|
586
|
-
"PKG-INFO",
|
587
|
-
"requires.txt",
|
588
|
-
"SOURCES.txt",
|
589
|
-
"not-zip-safe",
|
590
|
-
},
|
591
|
-
)
|
592
|
-
|
593
|
-
# delete dependency_links if it is only whitespace
|
594
|
-
dependency_links_path = os.path.join(distinfo_path, "dependency_links.txt")
|
595
|
-
with open(dependency_links_path, encoding="utf-8") as dependency_links_file:
|
596
|
-
dependency_links = dependency_links_file.read().strip()
|
597
|
-
if not dependency_links:
|
598
|
-
adios(dependency_links_path)
|
599
|
-
|
600
|
-
pkg_info_path = os.path.join(distinfo_path, "METADATA")
|
601
|
-
serialization_policy = EmailPolicy(
|
602
|
-
utf8=True,
|
603
|
-
mangle_from_=False,
|
604
|
-
max_line_length=0,
|
570
|
+
# .egg-info is a directory
|
571
|
+
pkginfo_path = os.path.join(egginfo_path, "PKG-INFO")
|
572
|
+
|
573
|
+
# ignore common egg metadata that is useless to wheel
|
574
|
+
shutil.copytree(
|
575
|
+
egginfo_path,
|
576
|
+
distinfo_path,
|
577
|
+
ignore=lambda x, y: {
|
578
|
+
"PKG-INFO",
|
579
|
+
"requires.txt",
|
580
|
+
"SOURCES.txt",
|
581
|
+
"not-zip-safe",
|
582
|
+
},
|
605
583
|
)
|
606
|
-
|
607
|
-
|
584
|
+
|
585
|
+
# delete dependency_links if it is only whitespace
|
586
|
+
dependency_links_path = os.path.join(distinfo_path, "dependency_links.txt")
|
587
|
+
with open(dependency_links_path, encoding="utf-8") as dependency_links_file:
|
588
|
+
dependency_links = dependency_links_file.read().strip()
|
589
|
+
if not dependency_links:
|
590
|
+
adios(dependency_links_path)
|
591
|
+
|
592
|
+
metadata_path = os.path.join(distinfo_path, "METADATA")
|
593
|
+
shutil.copy(pkginfo_path, metadata_path)
|
608
594
|
|
609
595
|
for license_path in self.license_paths:
|
610
596
|
filename = os.path.basename(license_path)
|
@@ -95,7 +95,7 @@ class build_ext(_build_ext):
|
|
95
95
|
|
96
96
|
def run(self):
|
97
97
|
"""Build extensions in build directory, then copy if --inplace"""
|
98
|
-
old_inplace, self.inplace = self.inplace,
|
98
|
+
old_inplace, self.inplace = self.inplace, False
|
99
99
|
_build_ext.run(self)
|
100
100
|
self.inplace = old_inplace
|
101
101
|
if old_inplace:
|
@@ -248,7 +248,7 @@ class build_ext(_build_ext):
|
|
248
248
|
compiler.set_link_objects(self.link_objects)
|
249
249
|
|
250
250
|
# hack so distutils' build_extension() builds a library instead
|
251
|
-
compiler.link_shared_object = link_shared_object.__get__(compiler)
|
251
|
+
compiler.link_shared_object = link_shared_object.__get__(compiler) # type: ignore[method-assign]
|
252
252
|
|
253
253
|
def get_export_symbols(self, ext):
|
254
254
|
if isinstance(ext, Library):
|
@@ -39,7 +39,7 @@ class build_py(orig.build_py):
|
|
39
39
|
|
40
40
|
distribution: Distribution # override distutils.dist.Distribution with setuptools.dist.Distribution
|
41
41
|
editable_mode: bool = False
|
42
|
-
existing_egg_info_dir:
|
42
|
+
existing_egg_info_dir: StrPath | None = None #: Private API, internal use only.
|
43
43
|
|
44
44
|
def finalize_options(self):
|
45
45
|
orig.build_py.finalize_options(self)
|
@@ -47,7 +47,6 @@ class build_py(orig.build_py):
|
|
47
47
|
self.exclude_package_data = self.distribution.exclude_package_data or {}
|
48
48
|
if 'data_files' in self.__dict__:
|
49
49
|
del self.__dict__['data_files']
|
50
|
-
self.__updated_files = []
|
51
50
|
|
52
51
|
def copy_file( # type: ignore[override] # No overload, no bytes support
|
53
52
|
self,
|
@@ -89,12 +88,6 @@ class build_py(orig.build_py):
|
|
89
88
|
return self.data_files
|
90
89
|
return orig.build_py.__getattr__(self, attr)
|
91
90
|
|
92
|
-
def build_module(self, module, module_file, package):
|
93
|
-
outfile, copied = orig.build_py.build_module(self, module, module_file, package)
|
94
|
-
if copied:
|
95
|
-
self.__updated_files.append(outfile)
|
96
|
-
return outfile, copied
|
97
|
-
|
98
91
|
def _get_data_files(self):
|
99
92
|
"""Generate list of '(package,src_dir,build_dir,filenames)' tuples"""
|
100
93
|
self.analyze_manifest()
|
@@ -178,17 +171,17 @@ class build_py(orig.build_py):
|
|
178
171
|
_outf, _copied = self.copy_file(srcfile, target)
|
179
172
|
make_writable(target)
|
180
173
|
|
181
|
-
def analyze_manifest(self):
|
182
|
-
self.manifest_files
|
174
|
+
def analyze_manifest(self) -> None:
|
175
|
+
self.manifest_files: dict[str, list[str]] = {}
|
183
176
|
if not self.distribution.include_package_data:
|
184
177
|
return
|
185
|
-
src_dirs = {}
|
178
|
+
src_dirs: dict[str, str] = {}
|
186
179
|
for package in self.packages or ():
|
187
180
|
# Locate package source directory
|
188
181
|
src_dirs[assert_relative(self.get_package_dir(package))] = package
|
189
182
|
|
190
183
|
if (
|
191
|
-
|
184
|
+
self.existing_egg_info_dir
|
192
185
|
and Path(self.existing_egg_info_dir, "SOURCES.txt").exists()
|
193
186
|
):
|
194
187
|
egg_info_dir = self.existing_egg_info_dir
|
@@ -217,9 +210,11 @@ class build_py(orig.build_py):
|
|
217
210
|
importable = check.importable_subpackage(src_dirs[d], f)
|
218
211
|
if importable:
|
219
212
|
check.warn(importable)
|
220
|
-
|
213
|
+
self.manifest_files.setdefault(src_dirs[d], []).append(path)
|
221
214
|
|
222
|
-
def _filter_build_files(
|
215
|
+
def _filter_build_files(
|
216
|
+
self, files: Iterable[str], egg_info: StrPath
|
217
|
+
) -> Iterator[str]:
|
223
218
|
"""
|
224
219
|
``build_meta`` may try to create egg_info outside of the project directory,
|
225
220
|
and this can be problematic for certain plugins (reported in issue #3500).
|
@@ -238,7 +238,7 @@ class easy_install(Command):
|
|
238
238
|
print(f'setuptools {dist.version} from {dist.location} (Python {ver})')
|
239
239
|
raise SystemExit
|
240
240
|
|
241
|
-
def finalize_options(self): # noqa: C901 # is too complex (25) # FIXME
|
241
|
+
def finalize_options(self) -> None: # noqa: C901 # is too complex (25) # FIXME
|
242
242
|
self.version and self._render_version()
|
243
243
|
|
244
244
|
py_version = sys.version.split()[0]
|
@@ -354,7 +354,7 @@ class easy_install(Command):
|
|
354
354
|
"No urls, filenames, or requirements specified (see --help)"
|
355
355
|
)
|
356
356
|
|
357
|
-
self.outputs = []
|
357
|
+
self.outputs: list[str] = []
|
358
358
|
|
359
359
|
@staticmethod
|
360
360
|
def _process_site_dirs(site_dirs):
|
@@ -779,12 +779,12 @@ def _empty_dir(dir_: _P) -> _P:
|
|
779
779
|
|
780
780
|
|
781
781
|
class _NamespaceInstaller(namespaces.Installer):
|
782
|
-
def __init__(self, distribution, installation_dir, editable_name, src_root):
|
782
|
+
def __init__(self, distribution, installation_dir, editable_name, src_root) -> None:
|
783
783
|
self.distribution = distribution
|
784
784
|
self.src_root = src_root
|
785
785
|
self.installation_dir = installation_dir
|
786
786
|
self.editable_name = editable_name
|
787
|
-
self.outputs = []
|
787
|
+
self.outputs: list[str] = []
|
788
788
|
self.dry_run = False
|
789
789
|
|
790
790
|
def _get_nspkg_file(self):
|
@@ -7,6 +7,7 @@ import os
|
|
7
7
|
import re
|
8
8
|
import sys
|
9
9
|
import time
|
10
|
+
from collections.abc import Callable
|
10
11
|
|
11
12
|
import packaging
|
12
13
|
import packaging.requirements
|
@@ -330,7 +331,7 @@ class FileList(_FileList):
|
|
330
331
|
super().__init__(warn, debug_print)
|
331
332
|
self.ignore_egg_info_dir = ignore_egg_info_dir
|
332
333
|
|
333
|
-
def process_template_line(self, line):
|
334
|
+
def process_template_line(self, line) -> None:
|
334
335
|
# Parse the line: split it up, make sure the right number of words
|
335
336
|
# is there, and return the relevant words. 'action' is always
|
336
337
|
# defined: it's the first word of the line. Which of the other
|
@@ -338,7 +339,7 @@ class FileList(_FileList):
|
|
338
339
|
# patterns, (dir and patterns), or (dir_pattern).
|
339
340
|
(action, patterns, dir, dir_pattern) = self._parse_template_line(line)
|
340
341
|
|
341
|
-
action_map = {
|
342
|
+
action_map: dict[str, Callable] = {
|
342
343
|
'include': self.include,
|
343
344
|
'exclude': self.exclude,
|
344
345
|
'global-include': self.global_include,
|
@@ -20,13 +20,13 @@ class install_egg_info(namespaces.Installer, Command):
|
|
20
20
|
def initialize_options(self):
|
21
21
|
self.install_dir = None
|
22
22
|
|
23
|
-
def finalize_options(self):
|
23
|
+
def finalize_options(self) -> None:
|
24
24
|
self.set_undefined_options('install_lib', ('install_dir', 'install_dir'))
|
25
25
|
ei_cmd = self.get_finalized_command("egg_info")
|
26
26
|
basename = f"{ei_cmd._get_egg_basename()}.egg-info"
|
27
27
|
self.source = ei_cmd.egg_info
|
28
28
|
self.target = os.path.join(self.install_dir, basename)
|
29
|
-
self.outputs = []
|
29
|
+
self.outputs: list[str] = []
|
30
30
|
|
31
31
|
def run(self) -> None:
|
32
32
|
self.run_command('egg_info')
|
@@ -6,9 +6,9 @@ class saveopts(option_base):
|
|
6
6
|
|
7
7
|
description = "save supplied options to setup.cfg or other config file"
|
8
8
|
|
9
|
-
def run(self):
|
9
|
+
def run(self) -> None:
|
10
10
|
dist = self.distribution
|
11
|
-
settings = {}
|
11
|
+
settings: dict[str, dict[str, str]] = {}
|
12
12
|
|
13
13
|
for cmd in dist.command_options:
|
14
14
|
if cmd == 'saveopts':
|
@@ -202,10 +202,10 @@ class sdist(orig.sdist):
|
|
202
202
|
"""
|
203
203
|
log.info("reading manifest file '%s'", self.manifest)
|
204
204
|
manifest = open(self.manifest, 'rb')
|
205
|
-
for
|
205
|
+
for bytes_line in manifest:
|
206
206
|
# The manifest must contain UTF-8. See #303.
|
207
207
|
try:
|
208
|
-
line =
|
208
|
+
line = bytes_line.decode('UTF-8')
|
209
209
|
except UnicodeDecodeError:
|
210
210
|
log.warn("%r not UTF-8 decodable -- skipping" % line)
|
211
211
|
continue
|
@@ -37,7 +37,7 @@ def edit_config(filename, settings, dry_run=False):
|
|
37
37
|
"""
|
38
38
|
log.debug("Reading configuration from %s", filename)
|
39
39
|
opts = configparser.RawConfigParser()
|
40
|
-
opts.optionxform = lambda
|
40
|
+
opts.optionxform = lambda optionstr: optionstr # type: ignore[method-assign] # overriding method
|
41
41
|
_cfg_read_utf8_with_fallback(opts, filename)
|
42
42
|
|
43
43
|
for section, options in settings.items():
|
@@ -41,19 +41,6 @@ def load_file(filepath: StrPath) -> dict:
|
|
41
41
|
|
42
42
|
|
43
43
|
def validate(config: dict, filepath: StrPath) -> bool:
|
44
|
-
skip = os.getenv("SETUPTOOLS_DANGEROUSLY_SKIP_PYPROJECT_VALIDATION", "false")
|
45
|
-
if skip.lower() == "true": # https://github.com/pypa/setuptools/issues/4459
|
46
|
-
SetuptoolsWarning.emit(
|
47
|
-
"Skipping the validation of `pyproject.toml`.",
|
48
|
-
"""
|
49
|
-
Please note that some setuptools functionalities rely on the validation of
|
50
|
-
`pyproject.toml` against misconfiguration to ensure proper operation.
|
51
|
-
By skipping the automatic checks, you taking responsibility for making sure
|
52
|
-
the file is valid. Otherwise unexpected behaviours may occur.
|
53
|
-
""",
|
54
|
-
)
|
55
|
-
return True
|
56
|
-
|
57
44
|
from . import _validate_pyproject as validator
|
58
45
|
|
59
46
|
trove_classifier = validator.FORMAT_FUNCTIONS.get("trove-classifier")
|
@@ -904,7 +904,7 @@ class Distribution(_Distribution):
|
|
904
904
|
|
905
905
|
return nargs
|
906
906
|
|
907
|
-
def get_cmdline_options(self):
|
907
|
+
def get_cmdline_options(self) -> dict[str, dict[str, str | None]]:
|
908
908
|
"""Return a '{cmd: {opt:val}}' map of all command-line options
|
909
909
|
|
910
910
|
Option names are all long, but do not include the leading '--', and
|
@@ -914,9 +914,10 @@ class Distribution(_Distribution):
|
|
914
914
|
Note that options provided by config files are intentionally excluded.
|
915
915
|
"""
|
916
916
|
|
917
|
-
d = {}
|
917
|
+
d: dict[str, dict[str, str | None]] = {}
|
918
918
|
|
919
919
|
for cmd, opts in self.command_options.items():
|
920
|
+
val: str | None
|
920
921
|
for opt, (src, val) in opts.items():
|
921
922
|
if src != "command line":
|
922
923
|
continue
|
@@ -73,7 +73,7 @@ def patch_all():
|
|
73
73
|
import setuptools
|
74
74
|
|
75
75
|
# we can't patch distutils.cmd, alas
|
76
|
-
distutils.core.Command = setuptools.Command
|
76
|
+
distutils.core.Command = setuptools.Command # type: ignore[misc,assignment] # monkeypatching
|
77
77
|
|
78
78
|
_patch_distribution_metadata()
|
79
79
|
|
@@ -82,8 +82,8 @@ def patch_all():
|
|
82
82
|
module.Distribution = setuptools.dist.Distribution
|
83
83
|
|
84
84
|
# Install the patched Extension
|
85
|
-
distutils.core.Extension = setuptools.extension.Extension
|
86
|
-
distutils.extension.Extension = setuptools.extension.Extension
|
85
|
+
distutils.core.Extension = setuptools.extension.Extension # type: ignore[misc,assignment] # monkeypatching
|
86
|
+
distutils.extension.Extension = setuptools.extension.Extension # type: ignore[misc,assignment] # monkeypatching
|
87
87
|
if 'distutils.command.build_ext' in sys.modules:
|
88
88
|
sys.modules[
|
89
89
|
'distutils.command.build_ext'
|
@@ -20,7 +20,7 @@ from more_itertools import unique_everseen
|
|
20
20
|
import distutils.errors
|
21
21
|
|
22
22
|
if TYPE_CHECKING:
|
23
|
-
from typing_extensions import NotRequired
|
23
|
+
from typing_extensions import LiteralString, NotRequired
|
24
24
|
|
25
25
|
# https://github.com/python/mypy/issues/8166
|
26
26
|
if not TYPE_CHECKING and platform.system() == 'Windows':
|
@@ -426,7 +426,7 @@ class SystemInfo:
|
|
426
426
|
vs_vers.append(ver)
|
427
427
|
return sorted(vs_vers)
|
428
428
|
|
429
|
-
def find_programdata_vs_vers(self):
|
429
|
+
def find_programdata_vs_vers(self) -> dict[float, str]:
|
430
430
|
r"""
|
431
431
|
Find Visual studio 2017+ versions from information in
|
432
432
|
"C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances".
|
@@ -436,7 +436,7 @@ class SystemInfo:
|
|
436
436
|
dict
|
437
437
|
float version as key, path as value.
|
438
438
|
"""
|
439
|
-
vs_versions = {}
|
439
|
+
vs_versions: dict[float, str] = {}
|
440
440
|
instances_dir = r'C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances'
|
441
441
|
|
442
442
|
try:
|
@@ -573,7 +573,7 @@ class SystemInfo:
|
|
573
573
|
return self.ri.lookup(self.ri.vc, '%0.1f' % self.vs_ver) or default_vc
|
574
574
|
|
575
575
|
@property
|
576
|
-
def WindowsSdkVersion(self):
|
576
|
+
def WindowsSdkVersion(self) -> tuple[LiteralString, ...]:
|
577
577
|
"""
|
578
578
|
Microsoft Windows SDK versions for specified MSVC++ version.
|
579
579
|
|
@@ -592,7 +592,7 @@ class SystemInfo:
|
|
592
592
|
return '8.1', '8.1a'
|
593
593
|
elif self.vs_ver >= 14.0:
|
594
594
|
return '10.0', '8.1'
|
595
|
-
return
|
595
|
+
return ()
|
596
596
|
|
597
597
|
@property
|
598
598
|
def WindowsSdkLastVersion(self):
|
@@ -607,7 +607,7 @@ class SystemInfo:
|
|
607
607
|
return self._use_last_dir_name(os.path.join(self.WindowsSdkDir, 'lib'))
|
608
608
|
|
609
609
|
@property
|
610
|
-
def WindowsSdkDir(self): # noqa: C901 # is too complex (12) # FIXME
|
610
|
+
def WindowsSdkDir(self) -> str | None: # noqa: C901 # is too complex (12) # FIXME
|
611
611
|
"""
|
612
612
|
Microsoft Windows SDK directory.
|
613
613
|
|
@@ -616,7 +616,7 @@ class SystemInfo:
|
|
616
616
|
str
|
617
617
|
path
|
618
618
|
"""
|
619
|
-
sdkdir = ''
|
619
|
+
sdkdir: str | None = ''
|
620
620
|
for ver in self.WindowsSdkVersion:
|
621
621
|
# Try to get it from registry
|
622
622
|
loc = os.path.join(self.ri.windows_sdk, 'v%s' % ver)
|
@@ -800,7 +800,7 @@ class SystemInfo:
|
|
800
800
|
return self.ri.lookup(self.ri.vc, 'frameworkdir64') or guess_fw
|
801
801
|
|
802
802
|
@property
|
803
|
-
def FrameworkVersion32(self):
|
803
|
+
def FrameworkVersion32(self) -> tuple[str, ...]:
|
804
804
|
"""
|
805
805
|
Microsoft .NET Framework 32bit versions.
|
806
806
|
|
@@ -812,7 +812,7 @@ class SystemInfo:
|
|
812
812
|
return self._find_dot_net_versions(32)
|
813
813
|
|
814
814
|
@property
|
815
|
-
def FrameworkVersion64(self):
|
815
|
+
def FrameworkVersion64(self) -> tuple[str, ...]:
|
816
816
|
"""
|
817
817
|
Microsoft .NET Framework 64bit versions.
|
818
818
|
|
@@ -823,7 +823,7 @@ class SystemInfo:
|
|
823
823
|
"""
|
824
824
|
return self._find_dot_net_versions(64)
|
825
825
|
|
826
|
-
def _find_dot_net_versions(self, bits):
|
826
|
+
def _find_dot_net_versions(self, bits) -> tuple[str, ...]:
|
827
827
|
"""
|
828
828
|
Find Microsoft .NET Framework versions.
|
829
829
|
|
@@ -851,7 +851,7 @@ class SystemInfo:
|
|
851
851
|
return 'v3.5', 'v2.0.50727'
|
852
852
|
elif self.vs_ver == 8.0:
|
853
853
|
return 'v3.0', 'v2.0.50727'
|
854
|
-
return
|
854
|
+
return ()
|
855
855
|
|
856
856
|
@staticmethod
|
857
857
|
def _use_last_dir_name(path, prefix=''):
|
@@ -17,7 +17,6 @@ from setuptools.config.pyprojecttoml import (
|
|
17
17
|
)
|
18
18
|
from setuptools.dist import Distribution
|
19
19
|
from setuptools.errors import OptionError
|
20
|
-
from setuptools.warnings import SetuptoolsWarning
|
21
20
|
|
22
21
|
import distutils.core
|
23
22
|
|
@@ -395,9 +394,3 @@ def test_warn_tools_typo(tmp_path):
|
|
395
394
|
|
396
395
|
with pytest.warns(_ToolsTypoInMetadata):
|
397
396
|
read_configuration(pyproject)
|
398
|
-
|
399
|
-
|
400
|
-
def test_warn_skipping_validation(monkeypatch):
|
401
|
-
monkeypatch.setenv("SETUPTOOLS_DANGEROUSLY_SKIP_PYPROJECT_VALIDATION", "true")
|
402
|
-
with pytest.warns(SetuptoolsWarning, match="Skipping the validation"):
|
403
|
-
assert validate({"completely-wrong": "data"}, "pyproject.toml") is True
|