diff options
author | PJ Eby <distutils-sig@python.org> | 2005-07-08 04:48:20 +0000 |
---|---|---|
committer | PJ Eby <distutils-sig@python.org> | 2005-07-08 04:48:20 +0000 |
commit | 592269afeaa4f96bddbaa8b6fbe8dddcea2445a4 (patch) | |
tree | 5fe55dced4503fdbb70eb5ec692d86003c444fe3 /setuptools/command/saveopts.py | |
parent | 56fcb8fdcc377acf0d74430a3d2d4dbffe306d44 (diff) | |
download | external_python_setuptools-592269afeaa4f96bddbaa8b6fbe8dddcea2445a4.tar.gz external_python_setuptools-592269afeaa4f96bddbaa8b6fbe8dddcea2445a4.tar.bz2 external_python_setuptools-592269afeaa4f96bddbaa8b6fbe8dddcea2445a4.zip |
* Added "rotate" command to delete old distribution files, given a set of
patterns to match and the number of files to keep. (Keeps the most
recently-modified distribution files matching each pattern.)
* Added "saveopts" command that saves all command-line options for the
current invocation to the local, global, or per-user configuration file.
Useful for setting defaults without having to hand-edit a configuration
file.
* Added a "setopt" command that sets a single option in a specified
distutils configuration file.
--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041093
Diffstat (limited to 'setuptools/command/saveopts.py')
-rwxr-xr-x | setuptools/command/saveopts.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/setuptools/command/saveopts.py b/setuptools/command/saveopts.py new file mode 100755 index 00000000..ad3cf193 --- /dev/null +++ b/setuptools/command/saveopts.py @@ -0,0 +1,27 @@ +import distutils, os +from setuptools import Command +from setuptools.command.setopt import edit_config, option_base + +class saveopts(option_base): + """Save command-line options to a file""" + + description = "save supplied options to setup.cfg or other config file" + + user_options = option_base.user_options + [ + ] + + boolean_options = option_base.boolean_options + [ + ] + + def run(self): + dist = self.distribution + commands = dist.command_options.keys() + settings = {} + for cmd in commands: + if cmd=='saveopts': + continue + for opt,(src,val) in dist.get_option_dict(cmd).items(): + if src=="command line": + settings.setdefault(cmd,{})[opt] = val + edit_config(self.filename, settings, self.dry_run) + |