2000-05-26 22:25:16 -03:00
|
|
|
"""distutils.command.install_headers
|
|
|
|
|
|
|
|
Implements the Distutils 'install_headers' command, to install C/C++ header
|
|
|
|
files to the Python include directory."""
|
|
|
|
|
|
|
|
__revision__ = "$Id$"
|
|
|
|
|
|
|
|
from distutils.core import Command
|
|
|
|
|
|
|
|
|
2009-03-31 17:55:21 -03:00
|
|
|
# XXX force is never used
|
|
|
|
class install_headers(Command):
|
2000-05-26 22:25:16 -03:00
|
|
|
|
|
|
|
description = "install C/C++ header files"
|
|
|
|
|
|
|
|
user_options = [('install-dir=', 'd',
|
|
|
|
"directory to install header files to"),
|
2000-09-12 22:02:25 -03:00
|
|
|
('force', 'f',
|
|
|
|
"force installation (overwrite existing files)"),
|
2000-05-26 22:25:16 -03:00
|
|
|
]
|
|
|
|
|
2000-09-24 22:41:15 -03:00
|
|
|
boolean_options = ['force']
|
2000-05-26 22:25:16 -03:00
|
|
|
|
2009-03-31 17:55:21 -03:00
|
|
|
def initialize_options(self):
|
2000-05-26 22:25:16 -03:00
|
|
|
self.install_dir = None
|
2000-09-12 22:02:25 -03:00
|
|
|
self.force = 0
|
2000-07-07 17:45:21 -03:00
|
|
|
self.outfiles = []
|
2000-05-26 22:25:16 -03:00
|
|
|
|
2009-03-31 17:55:21 -03:00
|
|
|
def finalize_options(self):
|
2000-05-26 22:25:16 -03:00
|
|
|
self.set_undefined_options('install',
|
2000-09-12 22:02:25 -03:00
|
|
|
('install_headers', 'install_dir'),
|
|
|
|
('force', 'force'))
|
2001-12-06 17:01:19 -04:00
|
|
|
|
2000-05-26 22:25:16 -03:00
|
|
|
|
2009-03-31 17:55:21 -03:00
|
|
|
def run(self):
|
2000-05-26 22:25:16 -03:00
|
|
|
headers = self.distribution.headers
|
|
|
|
if not headers:
|
|
|
|
return
|
|
|
|
|
|
|
|
self.mkpath(self.install_dir)
|
|
|
|
for header in headers:
|
2000-09-30 14:34:50 -03:00
|
|
|
(out, _) = self.copy_file(header, self.install_dir)
|
2000-06-21 00:13:51 -03:00
|
|
|
self.outfiles.append(out)
|
2000-05-26 22:25:16 -03:00
|
|
|
|
2009-03-31 17:55:21 -03:00
|
|
|
def get_inputs(self):
|
2000-06-21 00:13:51 -03:00
|
|
|
return self.distribution.headers or []
|
|
|
|
|
2009-03-31 17:55:21 -03:00
|
|
|
def get_outputs(self):
|
2000-06-21 00:13:51 -03:00
|
|
|
return self.outfiles
|
2000-05-26 22:25:16 -03:00
|
|
|
|
|
|
|
# class install_headers
|