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."""
|
|
|
|
|
|
|
|
# created 2000/05/26, Greg Ward
|
|
|
|
|
|
|
|
__revision__ = "$Id$"
|
|
|
|
|
2000-06-21 00:13:51 -03:00
|
|
|
import os
|
2000-05-26 22:25:16 -03: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-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
|
|
|
|
|
|
|
def initialize_options (self):
|
|
|
|
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
|
|
|
|
|
|
|
def finalize_options (self):
|
|
|
|
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
|
|
|
|
|
|
|
def run (self):
|
|
|
|
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
|
|
|
|
2000-06-21 00:13:51 -03:00
|
|
|
def get_inputs (self):
|
|
|
|
return self.distribution.headers or []
|
|
|
|
|
|
|
|
def get_outputs (self):
|
|
|
|
return self.outfiles
|
2000-05-26 22:25:16 -03:00
|
|
|
|
|
|
|
# class install_headers
|