2000-05-27 01:25:16 +00:00
|
|
|
"""distutils.command.install_headers
|
|
|
|
|
|
|
|
Implements the Distutils 'install_headers' command, to install C/C++ header
|
|
|
|
files to the Python include directory."""
|
|
|
|
|
|
|
|
# created 2000/05/26, Greg Ward
|
|
|
|
|
|
|
|
__revision__ = "$Id$"
|
|
|
|
|
2000-06-21 03:13:51 +00:00
|
|
|
import os
|
2000-05-27 01:25:16 +00:00
|
|
|
from distutils.core import Command
|
|
|
|
|
|
|
|
|
|
|
|
class install_headers (Command):
|
|
|
|
|
|
|
|
description = "install C/C++ header files"
|
|
|
|
|
|
|
|
user_options = [('install-dir=', 'd',
|
|
|
|
"directory to install header files to"),
|
2000-09-13 01:02:25 +00:00
|
|
|
('force', 'f',
|
|
|
|
"force installation (overwrite existing files)"),
|
2000-05-27 01:25:16 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
def initialize_options (self):
|
|
|
|
self.install_dir = None
|
2000-09-13 01:02:25 +00:00
|
|
|
self.force = 0
|
2000-07-07 20:45:21 +00:00
|
|
|
self.outfiles = []
|
2000-05-27 01:25:16 +00:00
|
|
|
|
|
|
|
def finalize_options (self):
|
|
|
|
self.set_undefined_options('install',
|
2000-09-13 01:02:25 +00:00
|
|
|
('install_headers', 'install_dir'),
|
|
|
|
('force', 'force'))
|
|
|
|
|
2000-05-27 01:25:16 +00:00
|
|
|
|
|
|
|
def run (self):
|
|
|
|
headers = self.distribution.headers
|
|
|
|
if not headers:
|
|
|
|
return
|
|
|
|
|
|
|
|
self.mkpath(self.install_dir)
|
|
|
|
for header in headers:
|
2000-06-21 03:13:51 +00:00
|
|
|
out = self.copy_file(header, self.install_dir)
|
|
|
|
self.outfiles.append(out)
|
2000-05-27 01:25:16 +00:00
|
|
|
|
2000-06-21 03:13:51 +00:00
|
|
|
def get_inputs (self):
|
|
|
|
return self.distribution.headers or []
|
|
|
|
|
|
|
|
def get_outputs (self):
|
|
|
|
return self.outfiles
|
2000-05-27 01:25:16 +00:00
|
|
|
|
|
|
|
# class install_headers
|