summaryrefslogtreecommitdiffstats
path: root/Lib/distutils
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-09-16 15:06:57 (GMT)
committerGreg Ward <gward@python.net>2000-09-16 15:06:57 (GMT)
commitfadefedb8945751d21cabf8763b431630112a20d (patch)
tree895d5297617ec0eb33294f017ee08e11c6c395a9 /Lib/distutils
parent634fc574e1464a0ee4a53dbf134c073070610088 (diff)
downloadcpython-fadefedb8945751d21cabf8763b431630112a20d.zip
cpython-fadefedb8945751d21cabf8763b431630112a20d.tar.gz
cpython-fadefedb8945751d21cabf8763b431630112a20d.tar.bz2
Factored the "sub-command" machinery out to Command. Mainly, this
meant removing 'get_sub_commands()', and moving the 'sub_commands' class attribute to the end and restructuring it to conform to the new regime.
Diffstat (limited to 'Lib/distutils')
-rw-r--r--Lib/distutils/command/install.py35
1 files changed, 10 insertions, 25 deletions
diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py
index 7182857..04b325a 100644
--- a/Lib/distutils/command/install.py
+++ b/Lib/distutils/command/install.py
@@ -101,17 +101,6 @@ class install (Command):
"filename in which to record list of installed files"),
]
- # 'sub_commands': a list of commands this command might have to run to
- # get its work done. Each command is represented as a tuple (method,
- # command) where 'method' is the name of a method to call that returns
- # true if 'command' (the sub-command name, a string) needs to be run.
- # If 'method' is None, assume that 'command' must always be run.
- sub_commands = [('has_lib', 'install_lib'),
- ('has_headers', 'install_headers'),
- ('has_scripts', 'install_scripts'),
- ('has_data', 'install_data'),
- ]
-
def initialize_options (self):
@@ -444,20 +433,6 @@ class install (Command):
# handle_extra_path ()
- def get_sub_commands (self):
- """Return the list of subcommands that we need to run. This is
- based on the 'subcommands' class attribute: each tuple in that list
- can name a method that we call to determine if the subcommand needs
- to be run for the current distribution."""
- commands = []
- for (method, cmd_name) in self.sub_commands:
- if method is not None:
- method = getattr(self, method)
- if method is None or method():
- commands.append(cmd_name)
- return commands
-
-
def run (self):
# Obviously have to build before we can install
@@ -494,6 +469,8 @@ class install (Command):
# run ()
+ # -- Predicates for sub-command list -------------------------------
+
def has_lib (self):
"""Return true if the current distribution has any Python
modules to install."""
@@ -544,4 +521,12 @@ class install (Command):
"installations)") %
filename)
+ # '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),
+ ]
+
# class install