ยปCore Development>Code coverage>Lib/distutils/command/install_headers.py

Python code coverage for Lib/distutils/command/install_headers.py

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