pypy / pypy / tool /

# This is where the options for are defined.

import os
from pypy.config.pypyoption import get_pypy_config
from pypy.config.config import Config, OptionDescription, to_optparse
import optparse

extra_useage = """For detailed descriptions of all the options see"""

def get_standard_options():
    config = get_pypy_config()
    parser = to_optparse(config, useoptions=["objspace.*"],
    return config, parser

def process_options(parser, argv=None):
    options, args = parser.parse_args(argv)
    return args

def make_config(cmdlineopt, **kwds):
    """ make a config from cmdline options (which overrides everything)
    and kwds """

    config = get_pypy_config(translating=False)
    for modname in kwds.pop("usemodules", []):
        setattr(config.objspace.usemodules, modname, True)
    return config

def make_objspace(config):
    mod = __import__('pypy.objspace.std',
                     None, None, ['Space'])
    Space = mod.Space
    return Space(config)