You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

23 lines
658 B

  1. from setuptools.command.setopt import edit_config, option_base
  2. class saveopts(option_base):
  3. """Save command-line options to a file"""
  4. description = "save supplied options to setup.cfg or other config file"
  5. def run(self):
  6. dist = self.distribution
  7. settings = {}
  8. for cmd in dist.command_options:
  9. if cmd == 'saveopts':
  10. continue # don't save our own options!
  11. for opt, (src, val) in dist.get_option_dict(cmd).items():
  12. if src == "command line":
  13. settings.setdefault(cmd, {})[opt] = val
  14. edit_config(self.filename, settings, self.dry_run)