import itertools
+import logging
import os
import pathlib
import sys
static library of the common parser sources (this is useful in case you are
creating multiple extensions).
"""
+ import setuptools.command.build_ext
import setuptools.logging
from setuptools import Extension, Distribution
from setuptools._distutils.sysconfig import customize_compiler
if verbose:
- setuptools.logging.set_threshold(setuptools.logging.logging.DEBUG)
+ setuptools.logging.set_threshold(logging.DEBUG)
source_file_path = pathlib.Path(generated_source_path)
extension_name = source_file_path.stem
)
dist = Distribution({"name": extension_name, "ext_modules": [extension]})
cmd = dist.get_command_obj("build_ext")
+ assert isinstance(cmd, setuptools.command.build_ext.build_ext)
fixup_build_ext(cmd)
cmd.build_lib = str(source_file_path.parent)
cmd.include_dirs = include_dirs
if build_dir:
cmd.build_temp = build_dir
- cmd.ensure_finalized()
+ # A deficiency in typeshed's stubs means we have to type: ignore:
+ cmd.ensure_finalized() # type: ignore[attr-defined]
compiler = new_compiler()
customize_compiler(compiler)
library_filename = compiler.library_filename(extension_name, output_dir=library_dir)
if newer_group(common_sources, library_filename, "newer"):
if sys.platform == "win32":
- pdb = compiler.static_lib_format % (extension_name, ".pdb")
+ # A deficiency in typeshed's stubs means we have to type: ignore:
+ pdb = compiler.static_lib_format % (extension_name, ".pdb") # type: ignore[attr-defined]
compile_opts = [f"/Fd{library_dir}\\{pdb}"]
compile_opts.extend(extra_compile_args)
else: