diff options
author | PJ Eby <distutils-sig@python.org> | 2005-07-08 05:09:23 +0000 |
---|---|---|
committer | PJ Eby <distutils-sig@python.org> | 2005-07-08 05:09:23 +0000 |
commit | 6050f5361738831a12debd373b9016a077e930df (patch) | |
tree | 25e82b1ab87651a118c178191776e19575dd4bab /setuptools/dist.py | |
parent | 592269afeaa4f96bddbaa8b6fbe8dddcea2445a4 (diff) | |
download | external_python_setuptools-6050f5361738831a12debd373b9016a077e930df.tar.gz external_python_setuptools-6050f5361738831a12debd373b9016a077e930df.tar.bz2 external_python_setuptools-6050f5361738831a12debd373b9016a077e930df.zip |
Added support for defining command aliases in distutils configuration
files, under the "[aliases]" section. To prevent recursion and to allow
aliases to call the command of the same name, a given alias can be expanded
only once per command-line invocation. You can define new aliases with the
"alias" command, either for the local, global, or per-user configuration.
--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041094
Diffstat (limited to 'setuptools/dist.py')
-rw-r--r-- | setuptools/dist.py | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/setuptools/dist.py b/setuptools/dist.py index fc0f3eba..8fcd19ea 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -372,10 +372,19 @@ class Distribution(_Distribution): self.global_options = self.__class__.global_options self.negative_opt = self.__class__.negative_opt - # Handle commands that want to consume all remaining arguments + # First, expand any aliases command = args[0] + aliases = self.get_option_dict('aliases') + while command in aliases: + src,alias = aliases[command] + del aliases[command] # ensure each alias can expand only once! + import shlex + args[:1] = shlex.split(alias,True) + command = args[0] + nargs = _Distribution._parse_command_opts(self, parser, args) + # Handle commands that want to consume all remaining arguments cmd_class = self.get_command_class(command) if getattr(cmd_class,'command_consumes_arguments',None): self.get_option_dict(command)['args'] = ("command line", nargs) @@ -384,6 +393,21 @@ class Distribution(_Distribution): return nargs + + + + + + + + + + + + + + + def has_dependencies(self): return not not self.requires @@ -408,6 +432,23 @@ class Distribution(_Distribution): self.have_run['install'] = 1 setuptools.bootstrap_install_from = None + + + + + + + + + + + + + + + + + def get_cmdline_options(self): """Return a '{cmd: {opt:val}}' map of all command-line options |