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