Support for the "install_headers" command:

* 'headers' entry added to all the install schemes
  * '--install-headers' option added
  * 'install_headers' added to 'sub_commands'
  * added 'dist_name' to configuration variables (along with a few
    others that seem handy: 'dist_version', 'dist_fullname', and
    'py_version'
  * in 'finalize_unix()', make sure 'install_headers' defined if
    user specified 'install_base' and/or 'install_platbase'
  * added 'has_headers()'
  * a few other small changes
This commit is contained in:
Greg Ward 2000-05-27 01:33:12 +00:00
parent aa0e77115f
commit cae5a1f444
1 changed files with 22 additions and 5 deletions

View File

@ -18,24 +18,28 @@ INSTALL_SCHEMES = {
'unix_prefix': { 'unix_prefix': {
'purelib': '$base/lib/python$py_version_short/site-packages', 'purelib': '$base/lib/python$py_version_short/site-packages',
'platlib': '$platbase/lib/python$py_version_short/site-packages', 'platlib': '$platbase/lib/python$py_version_short/site-packages',
'headers': '$base/include/python/$py_version_short/$dist_name',
'scripts': '$base/bin', 'scripts': '$base/bin',
'data' : '$base/share', 'data' : '$base/share',
}, },
'unix_home': { 'unix_home': {
'purelib': '$base/lib/python', 'purelib': '$base/lib/python',
'platlib': '$base/lib/python', 'platlib': '$base/lib/python',
'headers': '$base/include/python/$dist_name',
'scripts': '$base/bin', 'scripts': '$base/bin',
'data' : '$base/share', 'data' : '$base/share',
}, },
'nt': { 'nt': {
'purelib': '$base', 'purelib': '$base',
'platlib': '$base', 'platlib': '$base',
'headers': '$base\\Include\\$dist_name',
'scripts': '$base\\Scripts', 'scripts': '$base\\Scripts',
'data' : '$base\\Data', 'data' : '$base\\Data',
}, },
'mac': { 'mac': {
'purelib': '$base:Lib', 'purelib': '$base:Lib',
'platlib': '$base:Mac:PlugIns', 'platlib': '$base:Mac:PlugIns',
'headers': '$base:Include:$dist_name',
'scripts': '$base:Scripts', 'scripts': '$base:Scripts',
'data' : '$base:Data', 'data' : '$base:Data',
} }
@ -73,6 +77,8 @@ class install (Command):
"installation directory for all module distributions " + "installation directory for all module distributions " +
"(overrides --install-purelib and --install-platlib)"), "(overrides --install-purelib and --install-platlib)"),
('install-headers=', None,
"installation directory for C/C++ headers"),
('install-scripts=', None, ('install-scripts=', None,
"installation directory for Python scripts"), "installation directory for Python scripts"),
('install-data=', None, ('install-data=', None,
@ -99,6 +105,7 @@ class install (Command):
# true if 'command' (the sub-command name, a string) needs to be run. # true if 'command' (the sub-command name, a string) needs to be run.
# If 'method' is None, assume that 'command' must always be run. # If 'method' is None, assume that 'command' must always be run.
sub_commands = [('has_lib', 'install_lib'), sub_commands = [('has_lib', 'install_lib'),
('has_headers', 'install_headers'),
('has_scripts', 'install_scripts'), ('has_scripts', 'install_scripts'),
('has_data', 'install_data'), ('has_data', 'install_data'),
] ]
@ -125,6 +132,7 @@ class install (Command):
# that installation scheme. # that installation scheme.
self.install_purelib = None # for pure module distributions self.install_purelib = None # for pure module distributions
self.install_platlib = None # non-pure (dists w/ extensions) self.install_platlib = None # non-pure (dists w/ extensions)
self.install_headers = None # for C/C++ headers
self.install_lib = None # set to either purelib or platlib self.install_lib = None # set to either purelib or platlib
self.install_scripts = None self.install_scripts = None
self.install_data = None self.install_data = None
@ -200,21 +208,26 @@ class install (Command):
# install_{purelib,platlib,lib,scripts,data,...}, and the # install_{purelib,platlib,lib,scripts,data,...}, and the
# INSTALL_SCHEME dictionary above. Phew! # INSTALL_SCHEME dictionary above. Phew!
self.dump_dirs ("pre-finalize_xxx") self.dump_dirs ("pre-finalize_{unix,other}")
if os.name == 'posix': if os.name == 'posix':
self.finalize_unix () self.finalize_unix ()
else: else:
self.finalize_other () self.finalize_other ()
self.dump_dirs ("post-finalize_xxx()") self.dump_dirs ("post-finalize_{unix,other}()")
# Expand configuration variables, tilde, etc. in self.install_base # Expand configuration variables, tilde, etc. in self.install_base
# and self.install_platbase -- that way, we can use $base or # and self.install_platbase -- that way, we can use $base or
# $platbase in the other installation directories and not worry # $platbase in the other installation directories and not worry
# about needing recursive variable expansion (shudder). # about needing recursive variable expansion (shudder).
self.config_vars = {'py_version_short': sys.version[0:3], py_version = (string.split(sys.version))[0]
self.config_vars = {'dist_name': self.distribution.get_name(),
'dist_version': self.distribution.get_version(),
'dist_fullname': self.distribution.get_fullname(),
'py_version': py_version,
'py_version_short': py_version[0:3],
'sys_prefix': sysconfig.PREFIX, 'sys_prefix': sysconfig.PREFIX,
'sys_exec_prefix': sysconfig.EXEC_PREFIX, 'sys_exec_prefix': sysconfig.EXEC_PREFIX,
} }
@ -295,12 +308,12 @@ class install (Command):
if ((self.install_lib is None and if ((self.install_lib is None and
self.install_purelib is None and self.install_purelib is None and
self.install_platlib is None) or self.install_platlib is None) or
self.install_headers is None or
self.install_scripts is None or self.install_scripts is None or
self.install_data is None): self.install_data is None):
raise DistutilsOptionError, \ raise DistutilsOptionError, \
"install-base or install-platbase supplied, but " + \ "install-base or install-platbase supplied, but " + \
"installation scheme is incomplete" "installation scheme is incomplete"
return return
if self.home is not None: if self.home is not None:
@ -359,7 +372,7 @@ class install (Command):
def select_scheme (self, name): def select_scheme (self, name):
# it's the caller's problem if they supply a bad name! # it's the caller's problem if they supply a bad name!
scheme = INSTALL_SCHEMES[name] scheme = INSTALL_SCHEMES[name]
for key in ('purelib', 'platlib', 'scripts', 'data'): for key in ('purelib', 'platlib', 'headers', 'scripts', 'data'):
attrname = 'install_' + key attrname = 'install_' + key
if getattr(self, attrname) is None: if getattr(self, attrname) is None:
setattr(self, attrname, scheme[key]) setattr(self, attrname, scheme[key])
@ -384,6 +397,7 @@ class install (Command):
self._expand_attrs (['install_purelib', self._expand_attrs (['install_purelib',
'install_platlib', 'install_platlib',
'install_lib', 'install_lib',
'install_headers',
'install_scripts', 'install_scripts',
'install_data',]) 'install_data',])
@ -478,6 +492,9 @@ class install (Command):
return (self.distribution.has_pure_modules() or return (self.distribution.has_pure_modules() or
self.distribution.has_ext_modules()) self.distribution.has_ext_modules())
def has_headers (self):
return self.distribution.has_headers()
def has_scripts (self): def has_scripts (self):
return self.distribution.has_scripts() return self.distribution.has_scripts()