summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2000-05-13 01:58:19 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2000-05-13 01:58:19 (GMT)
commit8cb676195b899a4d84980ebf3dc34c8082303b96 (patch)
tree424f5119c7257f5f3c894bf178211787e8598225
parenta190268bf6c993f623c0af6ccde43602d36291da (diff)
downloadcpython-8cb676195b899a4d84980ebf3dc34c8082303b96.zip
cpython-8cb676195b899a4d84980ebf3dc34c8082303b96.tar.gz
cpython-8cb676195b899a4d84980ebf3dc34c8082303b96.tar.bz2
Harry Henry Gebel: add the "--record" option to write the list of
installed files to INSTALLED_FILES.
-rw-r--r--Lib/distutils/command/install.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py
index ba4110c..e6ed984 100644
--- a/Lib/distutils/command/install.py
+++ b/Lib/distutils/command/install.py
@@ -12,6 +12,7 @@ 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
+from glob import glob
INSTALL_SCHEMES = {
'unix_prefix': {
@@ -87,8 +88,10 @@ class install (Command):
#('install-man=', None, "directory for Unix man pages"),
#('install-html=', None, "directory for HTML documentation"),
#('install-info=', None, "directory for GNU info files"),
- ]
+ ('record', None,
+ "make a record of installation"),
+ ]
# 'sub_commands': a list of commands this command might have to run
# to get its work done. Each command is represented as a tuple
@@ -151,6 +154,7 @@ class install (Command):
#self.install_html = None
#self.install_info = None
+ self.record = None
def finalize_options (self):
@@ -441,6 +445,22 @@ class install (Command):
"you'll have to change the search path yourself") %
self.install_lib)
+ # write list of installed files, if requested.
+ if self.record:
+ 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.root: # strip any package prefix
+ root_len = len(self.root)
+ for counter in xrange (len (outputs)):
+ outputs[counter] = outputs[counter][root_len:]
+ self.execute(write_file,
+ ("INSTALLED_FILES", outputs),
+ "Writing list of installed files")
+
# run ()