Index: distutils/command/install.py =================================================================== RCS file: /projects/cvsroot/distutils/distutils/command/install.py,v retrieving revision 1.21 diff -u -r1.21 install.py --- install.py 2000/03/31 02:52:02 1.21 +++ install.py 2000/04/25 09:21:08 @@ -11,6 +11,7 @@ from distutils.core import Command from distutils.util import write_file, native_path, subst_vars from distutils.errors import DistutilsOptionError +from glob import glob INSTALL_SCHEMES = { 'unix_prefix': { @@ -19,6 +20,12 @@ 'scripts': '$base/bin', 'data' : '$base/share', }, + 'unix_package_prefix': { + 'purelib': '$root/$base/lib/python$py_version_short/site-packages', + 'platlib': '$root/$platbase/lib/python$py_version_short/site-packages', + 'scripts': '$root/$base/bin', + 'data' : '$root/$base/share', + }, 'unix_home': { 'purelib': '$base/lib/python', 'platlib': '$base/lib/python', @@ -53,6 +60,11 @@ ('home=', None, "(Unix only) home directory to install under"), + # treats package prefix like root directory + ('package-prefix=', None, + "(For use by packaging systems) prefix is treated like " \ + "root directory"), + # Or, just set the base director(y|ies) ('install-base=', None, "base installation directory (instead of --prefix or --home)"), @@ -79,6 +91,9 @@ #('install-man=', None, "directory for Unix man pages"), #('install-html=', None, "directory for HTML documentation"), #('install-info=', None, "directory for GNU info files"), + + ('record-install', None, + "make a record of installation") ] @@ -113,6 +128,7 @@ self.install_lib = None # set to either purelib or platlib self.install_scripts = None self.install_data = None + self.package_prefix = None # will be prepended to any other dirs # These two are for putting non-packagized distributions into their # own directory and creating a .pth file if it makes sense. @@ -137,6 +153,7 @@ #self.install_html = None #self.install_info = None + self.record_install = None def finalize_options (self): @@ -166,6 +183,9 @@ raise DistutilsOptionError, \ ("must supply either home or prefix/exec-prefix -- " + "not both") + if self.home and self.package_prefix: + raise DistutilsOptionError, \ + ("cannot supply both home and package prefix") else: if self.exec_prefix: self.warn ("exec-prefix option ignored on this platform") @@ -173,6 +193,9 @@ if self.home: self.warn ("home option ignored on this platform") self.home = None + if self.package_prefix: # for now + self.warn ("package-prefix option ignored on this platform") + self.package_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 @@ -263,7 +286,10 @@ self.install_base = self.prefix self.install_platbase = self.exec_prefix - self.select_scheme ("unix_prefix") + if self.package_prefix: + self.select_scheme("unix_package_prefix") + else: + self.select_scheme ("unix_prefix") # finalize_unix () @@ -300,6 +326,7 @@ vars = { 'base': self.install_base, 'platbase': self.install_platbase, + 'root': self.package_prefix, 'py_version_short': sys.version[0:3], } @@ -379,6 +406,22 @@ "Python's module search path (sys.path) -- " + "you'll have to change the search path yourself") % self.install_lib) + + # write list of installed files, if requested. + if self.record_install: + outputs = self.get_outputs() + for counter in xrange (len (outputs)): # include ".pyc" and ".pyo" + if outputs[counter][-3:] == ".py": + byte_code = glob(outputs[counter] + '[co]') + outputs.extend(byte_code) + outputs.sort() # just makes it look nicer + if self.package_prefix: # strip any package prefix + prefix_len = len(self.package_prefix) + 1 + for counter in xrange (len (outputs)): + outputs[counter] = outputs[counter][prefix_len:] + self.execute(write_file, + ("INSTALLED_FILES", outputs), + "Writing list of installed files") # run ()