[Python-checkins] CVS: distutils/distutils/command install.py,1.22,1.23
Greg Ward
python-dev@python.org
2000年4月26日 21:56:42 -0400 (EDT)
Update of /projects/cvsroot/distutils/distutils/command
In directory newcnri:/tmp/cvs-serv1303
Modified Files:
install.py
Log Message:
Added the "--root" option as a sort of meta-install-base; if supplied,
it is forcibly prepended onto all installation directories, even if
they are already absolute.
Added 'dump_dirs()' to clean up the debug output a bit.
Index: install.py
===================================================================
RCS file: /projects/cvsroot/distutils/distutils/command/install.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** install.py 2000年04月26日 02:38:01 1.22
--- install.py 2000年04月27日 01:56:38 1.23
***************
*** 5,9 ****
# created 1999年03月13日, Greg Ward
! __revision__ = "$Id: install.py,v 1.22 2000年04月26日 02:38:01 gward Exp $"
import sys, os, string
--- 5,9 ----
# created 1999年03月13日, Greg Ward
! __revision__ = "$Id: install.py,v 1.23 2000年04月27日 01:56:38 gward Exp $"
import sys, os, string
***************
*** 11,15 ****
from distutils.core import Command
from distutils import sysconfig
! from distutils.util import write_file, native_path, subst_vars
from distutils.errors import DistutilsOptionError
--- 11,15 ----
from distutils.core import Command
from distutils import sysconfig
! from distutils.util import write_file, native_path, subst_vars, change_root
from distutils.errors import DistutilsOptionError
***************
*** 61,64 ****
--- 61,66 ----
"base installation directory for platform-specific files " +
"(instead of --exec-prefix or --home)"),
+ ('root=', None,
+ "install everything relative to this alternate root directory"),
# Or, explicitly set the installation scheme
***************
*** 105,108 ****
--- 107,111 ----
self.install_base = None
self.install_platbase = None
+ self.root = None
# These options are the actual installation directories; if not
***************
*** 184,190 ****
# INSTALL_SCHEME dictionary above. Phew!
! from pprint import pprint
! print "pre-finalize:"
! pprint (self.__dict__)
if os.name == 'posix':
--- 187,191 ----
# INSTALL_SCHEME dictionary above. Phew!
! self.dump_dirs ("pre-finalize_xxx")
if os.name == 'posix':
***************
*** 193,198 ****
self.finalize_other ()
! print "post-finalize:"
! pprint (self.__dict__)
# Expand configuration variables, tilde, etc. in self.install_base
--- 194,198 ----
self.finalize_other ()
! self.dump_dirs ("post-finalize_xxx()")
# Expand configuration variables, tilde, etc. in self.install_base
***************
*** 207,212 ****
self.expand_basedirs ()
! print "post-expand_basedirs:"
! pprint (self.__dict__)
# Now define config vars for the base directories so we can expand
--- 207,211 ----
self.expand_basedirs ()
! self.dump_dirs ("post-expand_basedirs()")
# Now define config vars for the base directories so we can expand
***************
*** 215,218 ****
--- 214,218 ----
self.config_vars['platbase'] = self.install_platbase
+ from pprint import pprint
print "config vars:"
pprint (self.config_vars)
***************
*** 222,227 ****
self.expand_dirs ()
! print "post-expand:"
! pprint (self.__dict__)
# Pick the actual directory to install all modules to: either
--- 222,226 ----
self.expand_dirs ()
! self.dump_dirs ("post-expand_dirs()")
# Pick the actual directory to install all modules to: either
***************
*** 243,246 ****
--- 242,255 ----
self.install_lib = os.path.join (self.install_lib, self.extra_dirs)
+ # If a new root directory was supplied, make all the installation
+ # dirs relative to it.
+ if self.root is not None:
+ for name in ('lib', 'purelib', 'platlib', 'scripts', 'data'):
+ attr = "install_" + name
+ new_val = change_root (self.root, getattr (self, attr))
+ setattr (self, attr, new_val)
+
+ self.dump_dirs ("after prepending root")
+
# Find out the build directories, ie. where to install from.
self.set_undefined_options ('build',
***************
*** 254,257 ****
--- 263,276 ----
+ # hack for debugging output
+ def dump_dirs (self, msg):
+ from distutils.fancy_getopt import longopt_xlate
+ print msg + ":"
+ for opt in self.user_options:
+ opt_name = string.translate (opt[0][0:-1], longopt_xlate)
+ val = getattr (self, opt_name)
+ print " %s: %s" % (opt_name, val)
+
+
def finalize_unix (self):
***************
*** 340,344 ****
def expand_basedirs (self):
self._expand_attrs (['install_base',
! 'install_platbase'])
def expand_dirs (self):
--- 359,364 ----
def expand_basedirs (self):
self._expand_attrs (['install_base',
! 'install_platbase',
! 'root'])
def expand_dirs (self):