codekingpro/portable-devtools
114k
1"""distutils.command.install_headers2 3Implements the Distutils 'install_headers' command, to install C/C++ header4files to the Python include directory."""5 6from ..core import Command7 8 9# XXX force is never used10class install_headers(Command):11 description = "install C/C++ header files"12 13 user_options = [14 ('install-dir=', 'd', "directory to install header files to"),15 ('force', 'f', "force installation (overwrite existing files)"),16 ]17 18 boolean_options = ['force']19 20 def initialize_options(self):21 self.install_dir = None22 self.force = 023 self.outfiles = []24 25 def finalize_options(self):26 self.set_undefined_options(27 'install', ('install_headers', 'install_dir'), ('force', 'force')28 )29 30 def run(self):31 headers = self.distribution.headers32 if not headers:33 return34 35 self.mkpath(self.install_dir)36 for header in headers:37 (out, _) = self.copy_file(header, self.install_dir)38 self.outfiles.append(out)39 40 def get_inputs(self):41 return self.distribution.headers or []42 43 def get_outputs(self):44 return self.outfiles45 