1cdee823dc27e67e8a4dc2c75c9235276b5d1d40
[SubU] /
1 """distutils.command.install_headers
2
3 Implements the Distutils 'install_headers' command, to install C/C++ header
4 files to the Python include directory."""
5
6 from ..core import Command
7
8
9 # XXX force is never used
10 class install_headers(Command):
11
12     description = "install C/C++ header files"
13
14     user_options = [
15         ('install-dir=', 'd', "directory to install header files to"),
16         ('force', 'f', "force installation (overwrite existing files)"),
17     ]
18
19     boolean_options = ['force']
20
21     def initialize_options(self):
22         self.install_dir = None
23         self.force = 0
24         self.outfiles = []
25
26     def finalize_options(self):
27         self.set_undefined_options(
28             'install', ('install_headers', 'install_dir'), ('force', 'force')
29         )
30
31     def run(self):
32         headers = self.distribution.headers
33         if not headers:
34             return
35
36         self.mkpath(self.install_dir)
37         for header in headers:
38             (out, _) = self.copy_file(header, self.install_dir)
39             self.outfiles.append(out)
40
41     def get_inputs(self):
42         return self.distribution.headers or []
43
44     def get_outputs(self):
45         return self.outfiles