PageRenderTime 117ms CodeModel.GetById 40ms app.highlight 4ms RepoModel.GetById 37ms app.codeStats 0ms

/Lib/distutils/command/install_headers.py

http://unladen-swallow.googlecode.com/
Python | 52 lines | 50 code | 0 blank | 2 comment | 0 complexity | d799a566e19d66674b3a9553b94d69c0 MD5 | raw file
 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# This module should be kept compatible with Python 2.1.
 7
 8__revision__ = "$Id: install_headers.py 61000 2008-02-23 17:40:11Z christian.heimes $"
 9
10from distutils.core import Command
11
12
13class install_headers (Command):
14
15    description = "install C/C++ header files"
16
17    user_options = [('install-dir=', 'd',
18                     "directory to install header files to"),
19                    ('force', 'f',
20                     "force installation (overwrite existing files)"),
21                   ]
22
23    boolean_options = ['force']
24
25    def initialize_options (self):
26        self.install_dir = None
27        self.force = 0
28        self.outfiles = []
29
30    def finalize_options (self):
31        self.set_undefined_options('install',
32                                   ('install_headers', 'install_dir'),
33                                   ('force', 'force'))
34
35
36    def run (self):
37        headers = self.distribution.headers
38        if not headers:
39            return
40
41        self.mkpath(self.install_dir)
42        for header in headers:
43            (out, _) = self.copy_file(header, self.install_dir)
44            self.outfiles.append(out)
45
46    def get_inputs (self):
47        return self.distribution.headers or []
48
49    def get_outputs (self):
50        return self.outfiles
51
52# class install_headers