1999-03-22 10:55:25 -04:00
|
|
|
"""distutils.command.install
|
|
|
|
|
|
|
|
Implements the Distutils 'install' command."""
|
|
|
|
|
2009-06-04 04:39:50 -03:00
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
|
|
|
|
from distutils import log
|
2002-09-11 13:31:53 -03:00
|
|
|
from distutils.core import Command
|
|
|
|
from distutils.debug import DEBUG
|
2010-07-22 09:50:05 -03:00
|
|
|
from distutils.sysconfig import get_config_vars
|
2001-08-10 15:59:59 -03:00
|
|
|
from distutils.errors import DistutilsPlatformError
|
2000-08-04 22:31:54 -03:00
|
|
|
from distutils.file_util import write_file
|
2010-07-22 09:50:05 -03:00
|
|
|
from distutils.util import convert_path, subst_vars, change_root
|
|
|
|
from distutils.util import get_platform
|
2000-02-25 20:49:04 -04:00
|
|
|
from distutils.errors import DistutilsOptionError
|
2008-05-06 20:45:46 -03:00
|
|
|
|
2010-07-22 09:50:05 -03:00
|
|
|
# this keeps compatibility from 2.3 to 2.5
|
|
|
|
if sys.version < "2.6":
|
|
|
|
USER_BASE = None
|
|
|
|
USER_SITE = None
|
|
|
|
HAS_USER_SITE = False
|
|
|
|
else:
|
|
|
|
from site import USER_BASE
|
|
|
|
from site import USER_SITE
|
|
|
|
HAS_USER_SITE = True
|
|
|
|
|
2010-02-03 12:10:34 -04:00
|
|
|
if sys.version < "2.2":
|
|
|
|
WINDOWS_SCHEME = {
|
|
|
|
'purelib': '$base',
|
|
|
|
'platlib': '$base',
|
|
|
|
'headers': '$base/Include/$dist_name',
|
|
|
|
'scripts': '$base/Scripts',
|
|
|
|
'data' : '$base',
|
|
|
|
}
|
|
|
|
else:
|
|
|
|
WINDOWS_SCHEME = {
|
|
|
|
'purelib': '$base/Lib/site-packages',
|
|
|
|
'platlib': '$base/Lib/site-packages',
|
|
|
|
'headers': '$base/Include/$dist_name',
|
|
|
|
'scripts': '$base/Scripts',
|
|
|
|
'data' : '$base',
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTALL_SCHEMES = {
|
|
|
|
'unix_prefix': {
|
|
|
|
'purelib': '$base/lib/python$py_version_short/site-packages',
|
|
|
|
'platlib': '$platbase/lib/python$py_version_short/site-packages',
|
2010-11-24 15:43:47 -04:00
|
|
|
'headers': '$base/include/python$py_version_short$abiflags/$dist_name',
|
2010-02-03 12:10:34 -04:00
|
|
|
'scripts': '$base/bin',
|
|
|
|
'data' : '$base',
|
|
|
|
},
|
|
|
|
'unix_home': {
|
|
|
|
'purelib': '$base/lib/python',
|
|
|
|
'platlib': '$base/lib/python',
|
|
|
|
'headers': '$base/include/python/$dist_name',
|
|
|
|
'scripts': '$base/bin',
|
|
|
|
'data' : '$base',
|
|
|
|
},
|
|
|
|
'nt': WINDOWS_SCHEME,
|
2010-07-22 09:50:05 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
# user site schemes
|
|
|
|
if HAS_USER_SITE:
|
|
|
|
INSTALL_SCHEMES['nt_user'] = {
|
|
|
|
'purelib': '$usersite',
|
|
|
|
'platlib': '$usersite',
|
|
|
|
'headers': '$userbase/Python$py_version_nodot/Include/$dist_name',
|
|
|
|
'scripts': '$userbase/Scripts',
|
|
|
|
'data' : '$userbase',
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTALL_SCHEMES['unix_user'] = {
|
2010-02-03 12:10:34 -04:00
|
|
|
'purelib': '$usersite',
|
|
|
|
'platlib': '$usersite',
|
2010-11-24 15:43:47 -04:00
|
|
|
'headers':
|
|
|
|
'$userbase/include/python$py_version_short$abiflags/$dist_name',
|
2010-02-03 12:10:34 -04:00
|
|
|
'scripts': '$userbase/bin',
|
|
|
|
'data' : '$userbase',
|
2010-07-22 09:50:05 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
# The keys to an installation scheme; if any new types of files are to be
|
|
|
|
# installed, be sure to add an entry to every installation scheme above,
|
|
|
|
# and to SCHEME_KEYS here.
|
2010-02-03 12:10:34 -04:00
|
|
|
SCHEME_KEYS = ('purelib', 'platlib', 'headers', 'scripts', 'data')
|
|
|
|
|
2000-03-21 20:15:45 -04:00
|
|
|
|
2009-06-04 04:39:50 -03:00
|
|
|
class install(Command):
|
1999-03-22 10:55:25 -04:00
|
|
|
|
2000-01-30 14:34:15 -04:00
|
|
|
description = "install everything from build directory"
|
|
|
|
|
2000-02-17 20:25:39 -04:00
|
|
|
user_options = [
|
2000-03-21 20:15:45 -04:00
|
|
|
# Select installation scheme and set base director(y|ies)
|
|
|
|
('prefix=', None,
|
|
|
|
"installation prefix"),
|
2000-02-17 20:25:39 -04:00
|
|
|
('exec-prefix=', None,
|
2000-03-21 20:15:45 -04:00
|
|
|
"(Unix only) prefix for platform-specific files"),
|
|
|
|
('home=', None,
|
|
|
|
"(Unix only) home directory to install under"),
|
|
|
|
|
|
|
|
# Or, just set the base director(y|ies)
|
|
|
|
('install-base=', None,
|
|
|
|
"base installation directory (instead of --prefix or --home)"),
|
|
|
|
('install-platbase=', None,
|
|
|
|
"base installation directory for platform-specific files " +
|
|
|
|
"(instead of --exec-prefix or --home)"),
|
2000-04-26 22:56:38 -03:00
|
|
|
('root=', None,
|
|
|
|
"install everything relative to this alternate root directory"),
|
2000-03-21 20:15:45 -04:00
|
|
|
|
|
|
|
# Or, explicitly set the installation scheme
|
|
|
|
('install-purelib=', None,
|
|
|
|
"installation directory for pure Python module distributions"),
|
2000-02-17 20:25:39 -04:00
|
|
|
('install-platlib=', None,
|
2000-03-21 20:15:45 -04:00
|
|
|
"installation directory for non-pure module distributions"),
|
|
|
|
('install-lib=', None,
|
|
|
|
"installation directory for all module distributions " +
|
|
|
|
"(overrides --install-purelib and --install-platlib)"),
|
|
|
|
|
2000-05-26 22:33:12 -03:00
|
|
|
('install-headers=', None,
|
|
|
|
"installation directory for C/C++ headers"),
|
2000-03-21 20:15:45 -04:00
|
|
|
('install-scripts=', None,
|
|
|
|
"installation directory for Python scripts"),
|
|
|
|
('install-data=', None,
|
|
|
|
"installation directory for data files"),
|
2000-02-17 20:25:39 -04:00
|
|
|
|
2000-10-01 23:16:04 -03:00
|
|
|
# Byte-compilation options -- see install_lib.py for details, as
|
|
|
|
# these are duplicated from there (but only install_lib does
|
|
|
|
# anything with them).
|
|
|
|
('compile', 'c', "compile .py to .pyc [default]"),
|
|
|
|
('no-compile', None, "don't compile .py files"),
|
|
|
|
('optimize=', 'O',
|
|
|
|
"also compile with optimization: -O1 for \"python -O\", "
|
|
|
|
"-O2 for \"python -OO\", and -O0 to disable [default: -O0]"),
|
2001-12-06 17:01:19 -04:00
|
|
|
|
2000-09-12 22:02:25 -03:00
|
|
|
# Miscellaneous control options
|
|
|
|
('force', 'f',
|
|
|
|
"force installation (overwrite any existing files)"),
|
2000-05-11 22:46:47 -03:00
|
|
|
('skip-build', None,
|
|
|
|
"skip rebuilding everything (for testing/debugging)"),
|
|
|
|
|
2000-02-17 20:25:39 -04:00
|
|
|
# Where to install documentation (eventually!)
|
2000-02-25 20:49:04 -04:00
|
|
|
#('doc-format=', None, "format of documentation to generate"),
|
|
|
|
#('install-man=', None, "directory for Unix man pages"),
|
|
|
|
#('install-html=', None, "directory for HTML documentation"),
|
|
|
|
#('install-info=', None, "directory for GNU info files"),
|
1999-03-22 10:55:25 -04:00
|
|
|
|
2000-05-12 23:16:45 -03:00
|
|
|
('record=', None,
|
|
|
|
"filename in which to record list of installed files"),
|
2000-05-12 22:58:19 -03:00
|
|
|
]
|
1999-06-07 23:04:36 -03:00
|
|
|
|
2009-02-27 08:58:56 -04:00
|
|
|
boolean_options = ['compile', 'force', 'skip-build']
|
|
|
|
|
2010-07-22 09:50:05 -03:00
|
|
|
if HAS_USER_SITE:
|
|
|
|
user_options.append(('user', None,
|
|
|
|
"install in user site-package '%s'" % USER_SITE))
|
|
|
|
boolean_options.append('user')
|
|
|
|
|
2000-10-03 00:31:52 -03:00
|
|
|
negative_opt = {'no-compile' : 'compile'}
|
2000-09-24 22:41:15 -03:00
|
|
|
|
2000-03-28 22:15:57 -04:00
|
|
|
|
2007-08-30 00:52:21 -03:00
|
|
|
def initialize_options(self):
|
2009-06-04 04:39:50 -03:00
|
|
|
"""Initializes options."""
|
2000-03-21 20:51:18 -04:00
|
|
|
# High-level options: these select both an installation base
|
|
|
|
# and scheme.
|
1999-03-22 10:55:25 -04:00
|
|
|
self.prefix = None
|
|
|
|
self.exec_prefix = None
|
2000-03-21 20:15:45 -04:00
|
|
|
self.home = None
|
2008-05-06 20:45:46 -03:00
|
|
|
self.user = 0
|
2000-03-21 20:15:45 -04:00
|
|
|
|
2000-03-21 20:51:18 -04:00
|
|
|
# These select only the installation base; it's up to the user to
|
|
|
|
# specify the installation scheme (currently, that means supplying
|
|
|
|
# the --install-{platlib,purelib,scripts,data} options).
|
2000-03-21 20:15:45 -04:00
|
|
|
self.install_base = None
|
|
|
|
self.install_platbase = None
|
2000-04-26 22:56:38 -03:00
|
|
|
self.root = None
|
1999-03-22 10:55:25 -04:00
|
|
|
|
2000-03-21 20:51:18 -04:00
|
|
|
# These options are the actual installation directories; if not
|
|
|
|
# supplied by the user, they are filled in using the installation
|
|
|
|
# scheme implied by prefix/exec-prefix/home and the contents of
|
|
|
|
# that installation scheme.
|
|
|
|
self.install_purelib = None # for pure module distributions
|
|
|
|
self.install_platlib = None # non-pure (dists w/ extensions)
|
2000-05-26 22:33:12 -03:00
|
|
|
self.install_headers = None # for C/C++ headers
|
2000-03-21 20:51:18 -04:00
|
|
|
self.install_lib = None # set to either purelib or platlib
|
2000-03-21 20:15:45 -04:00
|
|
|
self.install_scripts = None
|
|
|
|
self.install_data = None
|
2010-07-22 09:50:05 -03:00
|
|
|
self.install_userbase = USER_BASE
|
|
|
|
self.install_usersite = USER_SITE
|
1999-03-22 10:55:25 -04:00
|
|
|
|
2002-03-22 11:35:17 -04:00
|
|
|
self.compile = None
|
2000-10-01 23:16:04 -03:00
|
|
|
self.optimize = None
|
|
|
|
|
2000-03-21 20:51:18 -04:00
|
|
|
# These two are for putting non-packagized distributions into their
|
|
|
|
# own directory and creating a .pth file if it makes sense.
|
2000-09-21 22:31:08 -03:00
|
|
|
# 'extra_path' comes from the setup file; 'install_path_file' can
|
|
|
|
# be turned off if it makes no sense to install a .pth file. (But
|
|
|
|
# better to install it uselessly than to guess wrong and not
|
|
|
|
# install it when it's necessary and would be used!) Currently,
|
|
|
|
# 'install_path_file' is always true unless some outsider meddles
|
|
|
|
# with it.
|
2000-03-21 20:15:45 -04:00
|
|
|
self.extra_path = None
|
2000-09-21 22:31:08 -03:00
|
|
|
self.install_path_file = 1
|
|
|
|
|
|
|
|
# 'force' forces installation, even if target files are not
|
|
|
|
# out-of-date. 'skip_build' skips running the "build" command,
|
2004-10-13 09:35:28 -03:00
|
|
|
# handy if you know it's not necessary. 'warn_dir' (which is *not*
|
2000-09-21 22:31:08 -03:00
|
|
|
# a user option, it's just there so the bdist_* commands can turn
|
|
|
|
# it off) determines whether we warn about installing to a
|
|
|
|
# directory not in sys.path.
|
2000-09-12 22:02:25 -03:00
|
|
|
self.force = 0
|
2000-05-11 22:46:47 -03:00
|
|
|
self.skip_build = 0
|
2000-09-21 22:31:08 -03:00
|
|
|
self.warn_dir = 1
|
2000-05-11 22:46:47 -03:00
|
|
|
|
2000-03-21 20:30:54 -04:00
|
|
|
# These are only here as a conduit from the 'build' command to the
|
|
|
|
# 'install_*' commands that do the real work. ('build_base' isn't
|
|
|
|
# actually used anywhere, but it might be useful in future.) They
|
|
|
|
# are not user options, because if the user told the install
|
|
|
|
# command where the build directory is, that wouldn't affect the
|
|
|
|
# build command.
|
|
|
|
self.build_base = None
|
|
|
|
self.build_lib = None
|
|
|
|
|
2000-03-21 20:51:18 -04:00
|
|
|
# Not defined yet because we don't know anything about
|
|
|
|
# documentation yet.
|
2000-03-21 20:15:45 -04:00
|
|
|
#self.install_man = None
|
|
|
|
#self.install_html = None
|
|
|
|
#self.install_info = None
|
1999-03-22 10:55:25 -04:00
|
|
|
|
2000-05-12 22:58:19 -03:00
|
|
|
self.record = None
|
1999-03-22 10:55:25 -04:00
|
|
|
|
2000-09-30 14:05:37 -03:00
|
|
|
|
|
|
|
# -- Option finalizing methods -------------------------------------
|
|
|
|
# (This is rather more involved than for most commands,
|
|
|
|
# because this is where the policy for installing third-
|
|
|
|
# party Python modules on various platforms given a wide
|
|
|
|
# array of user input is decided. Yes, it's quite complex!)
|
|
|
|
|
2007-08-30 00:52:21 -03:00
|
|
|
def finalize_options(self):
|
2009-06-04 04:39:50 -03:00
|
|
|
"""Finalizes options."""
|
2000-03-21 20:51:18 -04:00
|
|
|
# This method (and its pliant slaves, like 'finalize_unix()',
|
|
|
|
# 'finalize_other()', and 'select_scheme()') is where the default
|
|
|
|
# installation directories for modules, extension modules, and
|
|
|
|
# anything else we care to install from a Python module
|
|
|
|
# distribution. Thus, this code makes a pretty important policy
|
|
|
|
# statement about how third-party stuff is added to a Python
|
|
|
|
# installation! Note that the actual work of installation is done
|
|
|
|
# by the relatively simple 'install_*' commands; they just take
|
|
|
|
# their orders from the installation directory options determined
|
|
|
|
# here.
|
2000-03-21 20:15:45 -04:00
|
|
|
|
2000-03-21 20:51:18 -04:00
|
|
|
# Check for errors/inconsistencies in the options; first, stuff
|
|
|
|
# that's wrong on any platform.
|
2000-03-21 20:15:45 -04:00
|
|
|
|
|
|
|
if ((self.prefix or self.exec_prefix or self.home) and
|
|
|
|
(self.install_base or self.install_platbase)):
|
2007-08-30 00:52:21 -03:00
|
|
|
raise DistutilsOptionError(
|
|
|
|
"must supply either prefix/exec-prefix/home or " +
|
2000-03-21 20:15:45 -04:00
|
|
|
"install-base/install-platbase -- not both")
|
|
|
|
|
2004-06-25 20:02:59 -03:00
|
|
|
if self.home and (self.prefix or self.exec_prefix):
|
2007-08-30 00:52:21 -03:00
|
|
|
raise DistutilsOptionError(
|
|
|
|
"must supply either home or prefix/exec-prefix -- not both")
|
2004-06-25 20:02:59 -03:00
|
|
|
|
2008-05-06 20:45:46 -03:00
|
|
|
if self.user and (self.prefix or self.exec_prefix or self.home or
|
|
|
|
self.install_base or self.install_platbase):
|
2013-03-11 18:57:08 -03:00
|
|
|
raise DistutilsOptionError("can't combine user with prefix, "
|
|
|
|
"exec_prefix/home, or install_(plat)base")
|
2008-05-06 20:45:46 -03:00
|
|
|
|
2000-03-21 20:51:18 -04:00
|
|
|
# Next, stuff that's wrong (or dubious) only on certain platforms.
|
2004-06-25 20:02:59 -03:00
|
|
|
if os.name != "posix":
|
2000-03-21 20:15:45 -04:00
|
|
|
if self.exec_prefix:
|
2000-09-30 15:27:54 -03:00
|
|
|
self.warn("exec-prefix option ignored on this platform")
|
2000-03-21 20:15:45 -04:00
|
|
|
self.exec_prefix = None
|
|
|
|
|
|
|
|
# Now the interesting logic -- so interesting that we farm it out
|
|
|
|
# to other methods. The goal of these methods is to set the final
|
|
|
|
# values for the install_{lib,scripts,data,...} options, using as
|
|
|
|
# input a heady brew of prefix, exec_prefix, home, install_base,
|
|
|
|
# install_platbase, user-supplied versions of
|
|
|
|
# install_{purelib,platlib,lib,scripts,data,...}, and the
|
|
|
|
# INSTALL_SCHEME dictionary above. Phew!
|
2000-02-25 20:49:04 -04:00
|
|
|
|
2000-09-30 15:27:54 -03:00
|
|
|
self.dump_dirs("pre-finalize_{unix,other}")
|
2000-04-25 23:38:01 -03:00
|
|
|
|
2000-03-21 20:15:45 -04:00
|
|
|
if os.name == 'posix':
|
2000-09-30 15:27:54 -03:00
|
|
|
self.finalize_unix()
|
2000-02-25 20:49:04 -04:00
|
|
|
else:
|
2000-09-30 15:27:54 -03:00
|
|
|
self.finalize_other()
|
2000-03-21 20:15:45 -04:00
|
|
|
|
2000-09-30 15:27:54 -03:00
|
|
|
self.dump_dirs("post-finalize_{unix,other}()")
|
2000-04-25 23:38:01 -03:00
|
|
|
|
|
|
|
# Expand configuration variables, tilde, etc. in self.install_base
|
|
|
|
# and self.install_platbase -- that way, we can use $base or
|
|
|
|
# $platbase in the other installation directories and not worry
|
|
|
|
# about needing recursive variable expansion (shudder).
|
|
|
|
|
2007-04-17 05:48:32 -03:00
|
|
|
py_version = sys.version.split()[0]
|
2010-07-22 09:50:05 -03:00
|
|
|
(prefix, exec_prefix) = get_config_vars('prefix', 'exec_prefix')
|
2010-11-24 23:46:44 -04:00
|
|
|
try:
|
|
|
|
abiflags = sys.abiflags
|
|
|
|
except AttributeError:
|
|
|
|
# sys.abiflags may not be defined on all platforms.
|
|
|
|
abiflags = ''
|
2000-05-26 22:33:12 -03:00
|
|
|
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],
|
2008-05-06 20:45:46 -03:00
|
|
|
'py_version_nodot': py_version[0] + py_version[2],
|
2000-09-14 22:20:10 -03:00
|
|
|
'sys_prefix': prefix,
|
|
|
|
'prefix': prefix,
|
|
|
|
'sys_exec_prefix': exec_prefix,
|
|
|
|
'exec_prefix': exec_prefix,
|
2010-11-24 23:46:44 -04:00
|
|
|
'abiflags': abiflags,
|
2000-04-25 23:38:01 -03:00
|
|
|
}
|
2009-02-27 08:58:56 -04:00
|
|
|
|
2010-07-22 09:50:05 -03:00
|
|
|
if HAS_USER_SITE:
|
|
|
|
self.config_vars['userbase'] = self.install_userbase
|
|
|
|
self.config_vars['usersite'] = self.install_usersite
|
|
|
|
|
2000-09-30 15:27:54 -03:00
|
|
|
self.expand_basedirs()
|
2000-04-25 23:38:01 -03:00
|
|
|
|
2000-09-30 15:27:54 -03:00
|
|
|
self.dump_dirs("post-expand_basedirs()")
|
2000-04-25 23:38:01 -03:00
|
|
|
|
|
|
|
# Now define config vars for the base directories so we can expand
|
|
|
|
# everything else.
|
|
|
|
self.config_vars['base'] = self.install_base
|
|
|
|
self.config_vars['platbase'] = self.install_platbase
|
|
|
|
|
2000-05-28 20:47:31 -03:00
|
|
|
if DEBUG:
|
|
|
|
from pprint import pprint
|
2007-02-09 01:37:30 -04:00
|
|
|
print("config vars:")
|
2000-09-30 15:27:54 -03:00
|
|
|
pprint(self.config_vars)
|
2000-04-25 23:38:01 -03:00
|
|
|
|
2000-03-21 20:15:45 -04:00
|
|
|
# Expand "~" and configuration variables in the installation
|
|
|
|
# directories.
|
2000-09-30 15:27:54 -03:00
|
|
|
self.expand_dirs()
|
2000-03-21 20:15:45 -04:00
|
|
|
|
2000-09-30 15:27:54 -03:00
|
|
|
self.dump_dirs("post-expand_dirs()")
|
2000-04-25 23:38:01 -03:00
|
|
|
|
2008-05-06 20:45:46 -03:00
|
|
|
# Create directories in the home dir:
|
|
|
|
if self.user:
|
|
|
|
self.create_home_path()
|
|
|
|
|
2000-03-21 20:15:45 -04:00
|
|
|
# Pick the actual directory to install all modules to: either
|
|
|
|
# install_purelib or install_platlib, depending on whether this
|
|
|
|
# module distribution is pure or not. Of course, if the user
|
|
|
|
# already specified install_lib, use their selection.
|
|
|
|
if self.install_lib is None:
|
|
|
|
if self.distribution.ext_modules: # has extensions: non-pure
|
|
|
|
self.install_lib = self.install_platlib
|
|
|
|
else:
|
|
|
|
self.install_lib = self.install_purelib
|
2001-12-06 17:01:19 -04:00
|
|
|
|
2000-09-21 22:31:08 -03:00
|
|
|
|
|
|
|
# Convert directories from Unix /-separated syntax to the local
|
|
|
|
# convention.
|
|
|
|
self.convert_paths('lib', 'purelib', 'platlib',
|
2008-05-06 20:45:46 -03:00
|
|
|
'scripts', 'data', 'headers',
|
|
|
|
'userbase', 'usersite')
|
2000-09-21 22:31:08 -03:00
|
|
|
|
2000-03-21 20:15:45 -04:00
|
|
|
# Well, we're not actually fully completely finalized yet: we still
|
|
|
|
# have to deal with 'extra_path', which is the hack for allowing
|
|
|
|
# non-packagized module distributions (hello, Numerical Python!) to
|
|
|
|
# get their own directories.
|
2000-09-30 15:27:54 -03:00
|
|
|
self.handle_extra_path()
|
2000-03-21 20:15:45 -04:00
|
|
|
self.install_libbase = self.install_lib # needed for .pth file
|
2000-09-30 15:27:54 -03:00
|
|
|
self.install_lib = os.path.join(self.install_lib, self.extra_dirs)
|
2000-02-25 20:49:04 -04:00
|
|
|
|
2000-04-26 22:56:38 -03:00
|
|
|
# If a new root directory was supplied, make all the installation
|
|
|
|
# dirs relative to it.
|
|
|
|
if self.root is not None:
|
2000-09-21 22:31:08 -03:00
|
|
|
self.change_roots('libbase', 'lib', 'purelib', 'platlib',
|
|
|
|
'scripts', 'data', 'headers')
|
2000-04-26 22:56:38 -03:00
|
|
|
|
2000-09-30 15:27:54 -03:00
|
|
|
self.dump_dirs("after prepending root")
|
2000-04-26 22:56:38 -03:00
|
|
|
|
2000-03-21 20:51:18 -04:00
|
|
|
# Find out the build directories, ie. where to install from.
|
2000-09-30 15:27:54 -03:00
|
|
|
self.set_undefined_options('build',
|
|
|
|
('build_base', 'build_base'),
|
|
|
|
('build_lib', 'build_lib'))
|
2000-03-21 20:15:45 -04:00
|
|
|
|
|
|
|
# Punt on doc directories for now -- after all, we're punting on
|
|
|
|
# documentation completely!
|
2000-02-25 20:49:04 -04:00
|
|
|
|
2007-08-30 00:52:21 -03:00
|
|
|
def dump_dirs(self, msg):
|
2009-06-04 04:39:50 -03:00
|
|
|
"""Dumps the list of user options."""
|
|
|
|
if not DEBUG:
|
|
|
|
return
|
|
|
|
from distutils.fancy_getopt import longopt_xlate
|
|
|
|
log.debug(msg + ":")
|
|
|
|
for opt in self.user_options:
|
|
|
|
opt_name = opt[0]
|
|
|
|
if opt_name[-1] == "=":
|
|
|
|
opt_name = opt_name[0:-1]
|
|
|
|
if opt_name in self.negative_opt:
|
|
|
|
opt_name = self.negative_opt[opt_name]
|
|
|
|
opt_name = opt_name.translate(longopt_xlate)
|
|
|
|
val = not getattr(self, opt_name)
|
|
|
|
else:
|
|
|
|
opt_name = opt_name.translate(longopt_xlate)
|
|
|
|
val = getattr(self, opt_name)
|
|
|
|
log.debug(" %s: %s" % (opt_name, val))
|
2000-04-26 22:56:38 -03:00
|
|
|
|
2007-08-30 00:52:21 -03:00
|
|
|
def finalize_unix(self):
|
2009-06-04 04:39:50 -03:00
|
|
|
"""Finalizes options for posix platforms."""
|
2000-03-21 20:15:45 -04:00
|
|
|
if self.install_base is not None or self.install_platbase is not None:
|
|
|
|
if ((self.install_lib is None and
|
|
|
|
self.install_purelib is None and
|
|
|
|
self.install_platlib is None) or
|
2000-05-26 22:33:12 -03:00
|
|
|
self.install_headers is None or
|
2000-03-21 20:15:45 -04:00
|
|
|
self.install_scripts is None or
|
|
|
|
self.install_data is None):
|
2007-08-30 00:52:21 -03:00
|
|
|
raise DistutilsOptionError(
|
|
|
|
"install-base or install-platbase supplied, but "
|
2002-06-04 18:20:08 -03:00
|
|
|
"installation scheme is incomplete")
|
2000-03-21 20:15:45 -04:00
|
|
|
return
|
|
|
|
|
2008-05-06 20:45:46 -03:00
|
|
|
if self.user:
|
|
|
|
if self.install_userbase is None:
|
|
|
|
raise DistutilsPlatformError(
|
|
|
|
"User base directory is not specified")
|
|
|
|
self.install_base = self.install_platbase = self.install_userbase
|
2010-07-22 09:50:05 -03:00
|
|
|
self.select_scheme("unix_user")
|
2008-05-06 20:45:46 -03:00
|
|
|
elif self.home is not None:
|
2000-03-21 20:15:45 -04:00
|
|
|
self.install_base = self.install_platbase = self.home
|
2010-07-22 09:50:05 -03:00
|
|
|
self.select_scheme("unix_home")
|
1999-09-21 15:31:14 -03:00
|
|
|
else:
|
2000-03-21 20:15:45 -04:00
|
|
|
if self.prefix is None:
|
|
|
|
if self.exec_prefix is not None:
|
2007-08-30 00:52:21 -03:00
|
|
|
raise DistutilsOptionError(
|
|
|
|
"must not supply exec-prefix without prefix")
|
2000-03-21 20:15:45 -04:00
|
|
|
|
2000-09-30 15:27:54 -03:00
|
|
|
self.prefix = os.path.normpath(sys.prefix)
|
|
|
|
self.exec_prefix = os.path.normpath(sys.exec_prefix)
|
2000-03-21 20:15:45 -04:00
|
|
|
|
|
|
|
else:
|
|
|
|
if self.exec_prefix is None:
|
|
|
|
self.exec_prefix = self.prefix
|
|
|
|
|
|
|
|
self.install_base = self.prefix
|
|
|
|
self.install_platbase = self.exec_prefix
|
2010-07-22 09:50:05 -03:00
|
|
|
self.select_scheme("unix_prefix")
|
2000-03-21 20:15:45 -04:00
|
|
|
|
2009-06-04 04:39:50 -03:00
|
|
|
def finalize_other(self):
|
|
|
|
"""Finalizes options for non-posix platforms"""
|
2008-05-06 20:45:46 -03:00
|
|
|
if self.user:
|
|
|
|
if self.install_userbase is None:
|
|
|
|
raise DistutilsPlatformError(
|
|
|
|
"User base directory is not specified")
|
|
|
|
self.install_base = self.install_platbase = self.install_userbase
|
|
|
|
self.select_scheme(os.name + "_user")
|
|
|
|
elif self.home is not None:
|
2004-06-25 20:02:59 -03:00
|
|
|
self.install_base = self.install_platbase = self.home
|
2010-07-22 09:50:05 -03:00
|
|
|
self.select_scheme("unix_home")
|
2004-06-25 20:02:59 -03:00
|
|
|
else:
|
|
|
|
if self.prefix is None:
|
|
|
|
self.prefix = os.path.normpath(sys.prefix)
|
2000-03-21 20:15:45 -04:00
|
|
|
|
2004-06-25 20:02:59 -03:00
|
|
|
self.install_base = self.install_platbase = self.prefix
|
|
|
|
try:
|
|
|
|
self.select_scheme(os.name)
|
|
|
|
except KeyError:
|
2007-08-30 00:52:21 -03:00
|
|
|
raise DistutilsPlatformError(
|
|
|
|
"I don't know how to install stuff on '%s'" % os.name)
|
2000-03-21 20:15:45 -04:00
|
|
|
|
2007-08-30 00:52:21 -03:00
|
|
|
def select_scheme(self, name):
|
2009-06-04 04:39:50 -03:00
|
|
|
"""Sets the install directories by applying the install schemes."""
|
2000-03-21 20:15:45 -04:00
|
|
|
# it's the caller's problem if they supply a bad name!
|
2010-07-22 09:50:05 -03:00
|
|
|
scheme = INSTALL_SCHEMES[name]
|
|
|
|
for key in SCHEME_KEYS:
|
2000-05-11 22:54:50 -03:00
|
|
|
attrname = 'install_' + key
|
2010-07-22 09:50:05 -03:00
|
|
|
if getattr(self, attrname) is None:
|
|
|
|
setattr(self, attrname, scheme[key])
|
2000-03-21 20:15:45 -04:00
|
|
|
|
2007-08-30 00:52:21 -03:00
|
|
|
def _expand_attrs(self, attrs):
|
2000-04-25 23:38:01 -03:00
|
|
|
for attr in attrs:
|
2000-09-30 15:27:54 -03:00
|
|
|
val = getattr(self, attr)
|
2000-04-25 23:38:01 -03:00
|
|
|
if val is not None:
|
2008-05-06 20:45:46 -03:00
|
|
|
if os.name == 'posix' or os.name == 'nt':
|
2000-09-30 15:27:54 -03:00
|
|
|
val = os.path.expanduser(val)
|
2010-07-22 09:50:05 -03:00
|
|
|
val = subst_vars(val, self.config_vars)
|
2000-09-30 15:27:54 -03:00
|
|
|
setattr(self, attr, val)
|
2000-03-21 20:15:45 -04:00
|
|
|
|
2007-08-30 00:52:21 -03:00
|
|
|
def expand_basedirs(self):
|
2009-06-04 04:39:50 -03:00
|
|
|
"""Calls `os.path.expanduser` on install_base, install_platbase and
|
|
|
|
root."""
|
|
|
|
self._expand_attrs(['install_base', 'install_platbase', 'root'])
|
2000-04-25 23:38:01 -03:00
|
|
|
|
2007-08-30 00:52:21 -03:00
|
|
|
def expand_dirs(self):
|
2009-06-04 04:39:50 -03:00
|
|
|
"""Calls `os.path.expanduser` on install dirs."""
|
|
|
|
self._expand_attrs(['install_purelib', 'install_platlib',
|
|
|
|
'install_lib', 'install_headers',
|
|
|
|
'install_scripts', 'install_data',])
|
2000-03-21 20:15:45 -04:00
|
|
|
|
2007-08-30 00:52:21 -03:00
|
|
|
def convert_paths(self, *names):
|
2009-06-04 04:39:50 -03:00
|
|
|
"""Call `convert_path` over `names`."""
|
2000-09-21 22:31:08 -03:00
|
|
|
for name in names:
|
|
|
|
attr = "install_" + name
|
|
|
|
setattr(self, attr, convert_path(getattr(self, attr)))
|
|
|
|
|
2007-08-30 00:52:21 -03:00
|
|
|
def handle_extra_path(self):
|
2009-06-04 04:39:50 -03:00
|
|
|
"""Set `path_file` and `extra_dirs` using `extra_path`."""
|
2000-03-21 20:15:45 -04:00
|
|
|
if self.extra_path is None:
|
|
|
|
self.extra_path = self.distribution.extra_path
|
|
|
|
|
|
|
|
if self.extra_path is not None:
|
2007-10-16 15:12:55 -03:00
|
|
|
if isinstance(self.extra_path, str):
|
2007-04-17 05:48:32 -03:00
|
|
|
self.extra_path = self.extra_path.split(',')
|
2000-03-21 20:15:45 -04:00
|
|
|
|
2000-09-30 15:27:54 -03:00
|
|
|
if len(self.extra_path) == 1:
|
2000-03-21 20:15:45 -04:00
|
|
|
path_file = extra_dirs = self.extra_path[0]
|
2000-09-30 15:27:54 -03:00
|
|
|
elif len(self.extra_path) == 2:
|
2009-06-04 04:39:50 -03:00
|
|
|
path_file, extra_dirs = self.extra_path
|
1999-06-07 23:04:36 -03:00
|
|
|
else:
|
2007-08-30 00:52:21 -03:00
|
|
|
raise DistutilsOptionError(
|
|
|
|
"'extra_path' option must be a list, tuple, or "
|
2002-06-04 18:20:08 -03:00
|
|
|
"comma-separated string with 1 or 2 elements")
|
1999-09-21 15:31:14 -03:00
|
|
|
|
2000-03-21 20:15:45 -04:00
|
|
|
# convert to local form in case Unix notation used (as it
|
|
|
|
# should be in setup scripts)
|
2000-09-30 15:27:54 -03:00
|
|
|
extra_dirs = convert_path(extra_dirs)
|
1999-09-21 15:31:14 -03:00
|
|
|
else:
|
|
|
|
path_file = None
|
|
|
|
extra_dirs = ''
|
|
|
|
|
2000-03-21 20:15:45 -04:00
|
|
|
# XXX should we warn if path_file and not extra_dirs? (in which
|
|
|
|
# case the path file would be harmless but pointless)
|
1999-09-21 15:31:14 -03:00
|
|
|
self.path_file = path_file
|
|
|
|
self.extra_dirs = extra_dirs
|
|
|
|
|
2007-08-30 00:52:21 -03:00
|
|
|
def change_roots(self, *names):
|
2009-06-04 04:39:50 -03:00
|
|
|
"""Change the install direcories pointed by name using root."""
|
2000-09-21 22:31:08 -03:00
|
|
|
for name in names:
|
|
|
|
attr = "install_" + name
|
|
|
|
setattr(self, attr, change_root(self.root, getattr(self, attr)))
|
|
|
|
|
2008-05-06 20:45:46 -03:00
|
|
|
def create_home_path(self):
|
2009-06-04 04:39:50 -03:00
|
|
|
"""Create directories under ~."""
|
2008-05-06 20:45:46 -03:00
|
|
|
if not self.user:
|
|
|
|
return
|
|
|
|
home = convert_path(os.path.expanduser("~"))
|
2008-11-08 11:15:57 -04:00
|
|
|
for name, path in self.config_vars.items():
|
2008-05-06 20:45:46 -03:00
|
|
|
if path.startswith(home) and not os.path.isdir(path):
|
|
|
|
self.debug_print("os.makedirs('%s', 0o700)" % path)
|
|
|
|
os.makedirs(path, 0o700)
|
2000-09-21 22:31:08 -03:00
|
|
|
|
2000-09-30 14:05:37 -03:00
|
|
|
# -- Command execution methods -------------------------------------
|
|
|
|
|
2007-08-30 00:52:21 -03:00
|
|
|
def run(self):
|
2009-06-04 04:39:50 -03:00
|
|
|
"""Runs the command."""
|
1999-06-07 23:04:36 -03:00
|
|
|
# Obviously have to build before we can install
|
2000-05-11 22:46:47 -03:00
|
|
|
if not self.skip_build:
|
2000-09-30 15:27:54 -03:00
|
|
|
self.run_command('build')
|
Merged revisions 62194,62197-62198,62204-62205,62214,62219-62221,62227,62229-62231,62233-62235,62237-62239 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62194 | jeffrey.yasskin | 2008-04-07 01:04:28 +0200 (Mon, 07 Apr 2008) | 7 lines
Add enough debugging information to diagnose failures where the
HandlerBException is ignored, and fix one such problem, where it was thrown
during the __del__ method of the previous Popen object.
We may want to find a better way of printing verbose information so it's not
spammy when the test passes.
........
r62197 | mark.hammond | 2008-04-07 03:53:39 +0200 (Mon, 07 Apr 2008) | 2 lines
Issue #2513: enable 64bit cross compilation on windows.
........
r62198 | mark.hammond | 2008-04-07 03:59:40 +0200 (Mon, 07 Apr 2008) | 2 lines
correct heading underline for new "Cross-compiling on Windows" section
........
r62204 | gregory.p.smith | 2008-04-07 08:33:21 +0200 (Mon, 07 Apr 2008) | 4 lines
Use the new PyFile_IncUseCount & PyFile_DecUseCount calls appropriatly
within the standard library. These modules use PyFile_AsFile and later
release the GIL while operating on the previously returned FILE*.
........
r62205 | mark.summerfield | 2008-04-07 09:39:23 +0200 (Mon, 07 Apr 2008) | 4 lines
changed "2500 components" to "several thousand" since the number keeps
growning:-)
........
r62214 | georg.brandl | 2008-04-07 20:51:59 +0200 (Mon, 07 Apr 2008) | 2 lines
#2525: update timezone info examples in the docs.
........
r62219 | andrew.kuchling | 2008-04-08 01:57:07 +0200 (Tue, 08 Apr 2008) | 1 line
Write PEP 3127 section; add items
........
r62220 | andrew.kuchling | 2008-04-08 01:57:21 +0200 (Tue, 08 Apr 2008) | 1 line
Typo fix
........
r62221 | andrew.kuchling | 2008-04-08 03:33:10 +0200 (Tue, 08 Apr 2008) | 1 line
Typographical fix: 32bit -> 32-bit, 64bit -> 64-bit
........
r62227 | andrew.kuchling | 2008-04-08 23:22:53 +0200 (Tue, 08 Apr 2008) | 1 line
Add items
........
r62229 | amaury.forgeotdarc | 2008-04-08 23:27:42 +0200 (Tue, 08 Apr 2008) | 7 lines
Issue2564: Prevent a hang in "import test.autotest", which runs the entire test
suite as a side-effect of importing the module.
- in test_capi, a thread tried to import other modules
- re.compile() imported sre_parse again on every call.
........
r62230 | amaury.forgeotdarc | 2008-04-08 23:51:57 +0200 (Tue, 08 Apr 2008) | 2 lines
Prevent an error when inspect.isabstract() is called with something else than a new-style class.
........
r62231 | amaury.forgeotdarc | 2008-04-09 00:07:05 +0200 (Wed, 09 Apr 2008) | 8 lines
Issue 2408: remove the _types module
It was only used as a helper in types.py to access types (GetSetDescriptorType and MemberDescriptorType),
when they can easily be obtained with python code.
These expressions even work with Jython.
I don't know what the future of the types module is; (cf. discussion in http://bugs.python.org/issue1605 )
at least this change makes it simpler.
........
r62233 | amaury.forgeotdarc | 2008-04-09 01:10:07 +0200 (Wed, 09 Apr 2008) | 2 lines
Add a NEWS entry for previous checkin
........
r62234 | trent.nelson | 2008-04-09 01:47:30 +0200 (Wed, 09 Apr 2008) | 37 lines
- Issue #2550: The approach used by client/server code for obtaining ports
to listen on in network-oriented tests has been refined in an effort to
facilitate running multiple instances of the entire regression test suite
in parallel without issue. test_support.bind_port() has been fixed such
that it will always return a unique port -- which wasn't always the case
with the previous implementation, especially if socket options had been
set that affected address reuse (i.e. SO_REUSEADDR, SO_REUSEPORT). The
new implementation of bind_port() will actually raise an exception if it
is passed an AF_INET/SOCK_STREAM socket with either the SO_REUSEADDR or
SO_REUSEPORT socket option set. Furthermore, if available, bind_port()
will set the SO_EXCLUSIVEADDRUSE option on the socket it's been passed.
This currently only applies to Windows. This option prevents any other
sockets from binding to the host/port we've bound to, thus removing the
possibility of the 'non-deterministic' behaviour, as Microsoft puts it,
that occurs when a second SOCK_STREAM socket binds and accepts to a
host/port that's already been bound by another socket. The optional
preferred port parameter to bind_port() has been removed. Under no
circumstances should tests be hard coding ports!
test_support.find_unused_port() has also been introduced, which will pass
a temporary socket object to bind_port() in order to obtain an unused port.
The temporary socket object is then closed and deleted, and the port is
returned. This method should only be used for obtaining an unused port
in order to pass to an external program (i.e. the -accept [port] argument
to openssl's s_server mode) or as a parameter to a server-oriented class
that doesn't give you direct access to the underlying socket used.
Finally, test_support.HOST has been introduced, which should be used for
the host argument of any relevant socket calls (i.e. bind and connect).
The following tests were updated to following the new conventions:
test_socket, test_smtplib, test_asyncore, test_ssl, test_httplib,
test_poplib, test_ftplib, test_telnetlib, test_socketserver,
test_asynchat and test_socket_ssl.
It is now possible for multiple instances of the regression test suite to
run in parallel without issue.
........
r62235 | gregory.p.smith | 2008-04-09 02:25:17 +0200 (Wed, 09 Apr 2008) | 3 lines
Fix zlib crash from zlib.decompressobj().flush(val) when val was not positive.
It tried to allocate negative or zero memory. That fails.
........
r62237 | trent.nelson | 2008-04-09 02:34:53 +0200 (Wed, 09 Apr 2008) | 1 line
Fix typo with regards to self.PORT shadowing class variables with the same name.
........
r62238 | andrew.kuchling | 2008-04-09 03:08:32 +0200 (Wed, 09 Apr 2008) | 1 line
Add items
........
r62239 | jerry.seutter | 2008-04-09 07:07:58 +0200 (Wed, 09 Apr 2008) | 1 line
Changed test so it no longer runs as a side effect of importing.
........
2008-04-09 05:37:03 -03:00
|
|
|
# If we built for any other platform, we can't install.
|
|
|
|
build_plat = self.distribution.get_command_obj('build').plat_name
|
|
|
|
# check warn_dir - it is a clue that the 'install' is happening
|
|
|
|
# internally, and not to sys.path, so we don't check the platform
|
|
|
|
# matches what we are running.
|
|
|
|
if self.warn_dir and build_plat != get_platform():
|
|
|
|
raise DistutilsPlatformError("Can't install when "
|
|
|
|
"cross-compiling")
|
1999-06-07 23:04:36 -03:00
|
|
|
|
2000-05-20 12:17:09 -03:00
|
|
|
# Run all sub-commands (at least those that need to be run)
|
|
|
|
for cmd_name in self.get_sub_commands():
|
2000-09-30 15:27:54 -03:00
|
|
|
self.run_command(cmd_name)
|
1999-09-21 15:31:14 -03:00
|
|
|
|
|
|
|
if self.path_file:
|
2000-09-30 15:27:54 -03:00
|
|
|
self.create_path_file()
|
1999-03-22 10:55:25 -04:00
|
|
|
|
2000-05-12 22:58:19 -03:00
|
|
|
# write list of installed files, if requested.
|
|
|
|
if self.record:
|
|
|
|
outputs = self.get_outputs()
|
2000-05-12 23:13:53 -03:00
|
|
|
if self.root: # strip any package prefix
|
2000-05-12 22:58:19 -03:00
|
|
|
root_len = len(self.root)
|
2007-05-07 19:24:25 -03:00
|
|
|
for counter in range(len(outputs)):
|
2000-05-12 22:58:19 -03:00
|
|
|
outputs[counter] = outputs[counter][root_len:]
|
|
|
|
self.execute(write_file,
|
2000-05-12 23:16:45 -03:00
|
|
|
(self.record, outputs),
|
|
|
|
"writing list of installed files to '%s'" %
|
|
|
|
self.record)
|
2000-05-12 23:01:22 -03:00
|
|
|
|
2000-10-14 00:47:07 -03:00
|
|
|
sys_path = map(os.path.normpath, sys.path)
|
2000-10-14 01:06:40 -03:00
|
|
|
sys_path = map(os.path.normcase, sys_path)
|
2000-10-14 00:47:07 -03:00
|
|
|
install_lib = os.path.normcase(os.path.normpath(self.install_lib))
|
2000-09-21 22:31:08 -03:00
|
|
|
if (self.warn_dir and
|
|
|
|
not (self.path_file and self.install_path_file) and
|
2000-10-14 00:47:07 -03:00
|
|
|
install_lib not in sys_path):
|
2002-06-04 18:20:08 -03:00
|
|
|
log.debug(("modules installed to '%s', which is not in "
|
2004-07-18 03:16:08 -03:00
|
|
|
"Python's module search path (sys.path) -- "
|
2002-06-04 18:20:08 -03:00
|
|
|
"you'll have to change the search path yourself"),
|
|
|
|
self.install_lib)
|
2000-05-12 22:58:19 -03:00
|
|
|
|
2007-08-30 00:52:21 -03:00
|
|
|
def create_path_file(self):
|
2009-06-04 04:39:50 -03:00
|
|
|
"""Creates the .pth file"""
|
2000-09-30 15:27:54 -03:00
|
|
|
filename = os.path.join(self.install_libbase,
|
|
|
|
self.path_file + ".pth")
|
2000-09-30 14:05:37 -03:00
|
|
|
if self.install_path_file:
|
2000-09-30 15:27:54 -03:00
|
|
|
self.execute(write_file,
|
|
|
|
(filename, [self.extra_dirs]),
|
|
|
|
"creating %s" % filename)
|
2000-09-30 14:05:37 -03:00
|
|
|
else:
|
|
|
|
self.warn("path file '%s' not created" % filename)
|
1999-09-21 15:31:14 -03:00
|
|
|
|
2000-05-20 12:17:09 -03:00
|
|
|
|
2000-09-30 14:05:37 -03:00
|
|
|
# -- Reporting methods ---------------------------------------------
|
2000-05-20 12:17:09 -03:00
|
|
|
|
2007-08-30 00:52:21 -03:00
|
|
|
def get_outputs(self):
|
2009-06-04 04:39:50 -03:00
|
|
|
"""Assembles the outputs of all the sub-commands."""
|
2000-03-28 22:15:57 -04:00
|
|
|
outputs = []
|
2000-05-20 12:17:09 -03:00
|
|
|
for cmd_name in self.get_sub_commands():
|
2000-09-30 15:27:54 -03:00
|
|
|
cmd = self.get_finalized_command(cmd_name)
|
2001-01-16 12:16:03 -04:00
|
|
|
# Add the contents of cmd.get_outputs(), ensuring
|
|
|
|
# that outputs doesn't contain duplicate entries
|
|
|
|
for filename in cmd.get_outputs():
|
|
|
|
if filename not in outputs:
|
|
|
|
outputs.append(filename)
|
2000-03-28 22:15:57 -04:00
|
|
|
|
2001-09-04 17:06:43 -03:00
|
|
|
if self.path_file and self.install_path_file:
|
|
|
|
outputs.append(os.path.join(self.install_libbase,
|
|
|
|
self.path_file + ".pth"))
|
2001-12-06 17:01:19 -04:00
|
|
|
|
2000-03-28 22:15:57 -04:00
|
|
|
return outputs
|
|
|
|
|
2007-08-30 00:52:21 -03:00
|
|
|
def get_inputs(self):
|
2009-06-04 04:39:50 -03:00
|
|
|
"""Returns the inputs of all the sub-commands"""
|
2000-03-30 22:52:02 -04:00
|
|
|
# XXX gee, this looks familiar ;-(
|
|
|
|
inputs = []
|
2000-05-20 12:17:09 -03:00
|
|
|
for cmd_name in self.get_sub_commands():
|
2000-09-30 15:27:54 -03:00
|
|
|
cmd = self.get_finalized_command(cmd_name)
|
|
|
|
inputs.extend(cmd.get_inputs())
|
2000-03-30 22:52:02 -04:00
|
|
|
|
|
|
|
return inputs
|
|
|
|
|
2000-09-30 14:05:37 -03:00
|
|
|
# -- Predicates for sub-command list -------------------------------
|
|
|
|
|
2007-08-30 00:52:21 -03:00
|
|
|
def has_lib(self):
|
2009-06-04 04:39:50 -03:00
|
|
|
"""Returns true if the current distribution has any Python
|
2000-09-30 14:05:37 -03:00
|
|
|
modules to install."""
|
|
|
|
return (self.distribution.has_pure_modules() or
|
|
|
|
self.distribution.has_ext_modules())
|
|
|
|
|
2007-08-30 00:52:21 -03:00
|
|
|
def has_headers(self):
|
2009-06-04 04:39:50 -03:00
|
|
|
"""Returns true if the current distribution has any headers to
|
|
|
|
install."""
|
2000-09-30 14:05:37 -03:00
|
|
|
return self.distribution.has_headers()
|
|
|
|
|
2007-08-30 00:52:21 -03:00
|
|
|
def has_scripts(self):
|
2009-06-04 04:39:50 -03:00
|
|
|
"""Returns true if the current distribution has any scripts to.
|
|
|
|
install."""
|
2000-09-30 14:05:37 -03:00
|
|
|
return self.distribution.has_scripts()
|
|
|
|
|
2007-08-30 00:52:21 -03:00
|
|
|
def has_data(self):
|
2009-06-04 04:39:50 -03:00
|
|
|
"""Returns true if the current distribution has any data to.
|
|
|
|
install."""
|
2000-09-30 14:05:37 -03:00
|
|
|
return self.distribution.has_data_files()
|
|
|
|
|
2000-09-16 12:06:57 -03:00
|
|
|
# 'sub_commands': a list of commands this command might have to run to
|
|
|
|
# get its work done. See cmd.py for more info.
|
|
|
|
sub_commands = [('install_lib', has_lib),
|
|
|
|
('install_headers', has_headers),
|
|
|
|
('install_scripts', has_scripts),
|
|
|
|
('install_data', has_data),
|
2006-04-21 07:40:58 -03:00
|
|
|
('install_egg_info', lambda self:True),
|
2000-09-16 12:06:57 -03:00
|
|
|
]
|