diff options
author | PJ Eby <distutils-sig@python.org> | 2004-03-22 01:12:31 +0000 |
---|---|---|
committer | PJ Eby <distutils-sig@python.org> | 2004-03-22 01:12:31 +0000 |
commit | 2e83526e517ecb61170f061af4cbc213dfa1ef0b (patch) | |
tree | 8a1a1a73f267c64a4566c5eedc03b19f644bb992 /setuptools/dist.py | |
parent | 7ce55cabc53fe2c1378446ba0557e5f716c0cd31 (diff) | |
download | external_python_setuptools-2e83526e517ecb61170f061af4cbc213dfa1ef0b.tar.gz external_python_setuptools-2e83526e517ecb61170f061af4cbc213dfa1ef0b.tar.bz2 external_python_setuptools-2e83526e517ecb61170f061af4cbc213dfa1ef0b.zip |
Compute command line that should be passed to child setup scripts.
Warn user if unsupported options are supplied, and cancel unless
'depends -i' (aka '--ignore-extra-args') was used.
--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4040880
Diffstat (limited to 'setuptools/dist.py')
-rw-r--r-- | setuptools/dist.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/setuptools/dist.py b/setuptools/dist.py index cd3af266..cb5a906b 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -285,6 +285,47 @@ class Distribution(_Distribution): + def get_cmdline_options(self): + """Return a '{cmd: {opt:val}}' map of all command-line options + + Option names are all long, but do not include the leading '--', and + contain dashes rather than underscores. If the option doesn't take + an argument (e.g. '--quiet'), the 'val' is 'None'. + + Note that options provided by config files are intentionally excluded. + """ + + d = {} + + for cmd,opts in self.command_options.items(): + + for opt,(src,val) in opts.items(): + + if src != "command line": + continue + + opt = opt.replace('_','-') + + if val==0: + cmdobj = self.get_command_obj(cmd) + neg_opt = self.negative_opt.copy() + neg_opt.update(getattr(cmdobj,'negative_opt',{})) + for neg,pos in neg_opt.items(): + if pos==opt: + opt=neg + val=None + break + else: + raise AssertionError("Shouldn't be able to get here") + + elif val==1: + val = None + + d.setdefault(cmd,{})[opt] = val + + return d + + class Feature: """A subset of the distribution that can be excluded if unneeded/wanted |