summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-03-29 02:15:57 (GMT)
committerGreg Ward <gward@python.net>2000-03-29 02:15:57 (GMT)
commitee94c57fe960b5a986721fdb813caae1dfb2144e (patch)
tree8fe3fda12b10316b0d2bc4afa56b1906011d6ac3 /Lib
parentae45b16157cad4b6d3fd844b4684bc538549ddc5 (diff)
downloadcpython-ee94c57fe960b5a986721fdb813caae1dfb2144e.zip
cpython-ee94c57fe960b5a986721fdb813caae1dfb2144e.tar.gz
cpython-ee94c57fe960b5a986721fdb813caae1dfb2144e.tar.bz2
Changed so the sub-commands we rely on to do the real work is specified
in a class attribute 'sub_commands', rather than hard-coded in 'run()'. This should make it easier to subclass 'install', and also makes it easier to keep 'run()' and the new 'get_outputs()' consistent. Added 'get_outputs()' in preparation for the 'bdist' command.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/command/install.py28
1 files changed, 24 insertions, 4 deletions
diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py
index ed74971..ac9ec86 100644
--- a/Lib/distutils/command/install.py
+++ b/Lib/distutils/command/install.py
@@ -82,6 +82,14 @@ class install (Command):
]
+ # 'sub_commands': a list of commands this command might have to run
+ # to get its work done. Each command is represented as a tuple
+ # (func, command) where 'func' is a function to call that returns
+ # true if 'command' (the sub-command name, a string) needs to be
+ # run. If 'func' is None, assume that 'command' must always be run.
+ sub_commands = [(None, 'install_lib')]
+
+
def initialize_options (self):
# High-level options: these select both an installation base
@@ -355,10 +363,11 @@ class install (Command):
# Obviously have to build before we can install
self.run_peer ('build')
- # Now install all Python modules -- don't bother to make this
- # conditional; why would someone distribute a Python module
- # distribution without Python modules?
- self.run_peer ('install_lib')
+ # Run all sub-commands: currently this just means install all
+ # Python modules using 'install_lib'.
+ for (func, cmd) in self.sub_commands:
+ if func is None or func():
+ self.run_peer (cmd)
if self.path_file:
self.create_path_file ()
@@ -374,6 +383,17 @@ class install (Command):
# run ()
+ def get_outputs (self):
+ # This command doesn't have any outputs of its own, so just
+ # get the outputs of all its sub-commands.
+ outputs = []
+ for (func, cmd) in self.sub_commands:
+ if func is None or func():
+ outputs.extend (self.run_peer (cmd))
+
+ return outputs
+
+
def create_path_file (self):
filename = os.path.join (self.install_libbase,
self.path_file + ".pth")