2 from setuptools import Command
3 from setuptools.command.setopt import edit_config, option_base
5 class saveopts(option_base):
6 """Save command-line options to a file"""
8 description = "save supplied options to setup.cfg or other config file"
11 dist = self.distribution
12 commands = dist.command_options.keys()
18 continue # don't save our own options!
20 for opt,(src,val) in dist.get_option_dict(cmd).items():
21 if src=="command line":
22 settings.setdefault(cmd,{})[opt] = val
24 edit_config(self.filename, settings, self.dry_run)