Project

General

Profile

Statistics
| Branch: | Revision:

root / env / lib / python2.7 / site-packages / distribute-0.6.19-py2.7.egg / setuptools / command / saveopts.py @ 1a305335

History | View | Annotate | Download (740 Bytes)

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