codekingpro/portable-devtools
115k
1"""distutils.command.install_headers2 3Implements the Distutils 'install_headers' command, to install C/C++ header4files to the Python include directory."""5 6from typing import ClassVar7 8from ..core import Command9 10 11# XXX force is never used12class install_headers(Command):13 description = "install C/C++ header files"14 15 user_options: ClassVar[list[tuple[str, str, str]]] = [16 ('install-dir=', 'd', "directory to install header files to"),17 ('force', 'f', "force installation (overwrite existing files)"),18 ]19 20 boolean_options: ClassVar[list[str]] = ['force']21 22 def initialize_options(self):23 self.install_dir = None24 self.force = False25 self.outfiles = []26 27 def finalize_options(self):28 self.set_undefined_options(29 'install', ('install_headers', 'install_dir'), ('force', 'force')30 )31 32 def run(self):33 headers = self.distribution.headers34 if not headers:35 return36 37 self.mkpath(self.install_dir)38 for header in headers:39 (out, _) = self.copy_file(header, self.install_dir)40 self.outfiles.append(out)41 42 def get_inputs(self):43 return self.distribution.headers or []44 45 def get_outputs(self):46 return self.outfiles47 