| 1 |
|
| 2 |
|
| 3 |
from pypy.config.pypyoption import get_pypy_config |
| 4 |
from rpython.config.config import to_optparse |
| 5 |
import optparse |
| 6 |
|
| 7 |
extra_useage = """For detailed descriptions of all the options see |
| 8 |
https://doc.pypy.org/config/commandline.html""" |
| 9 |
|
| 10 |
def get_standard_options(): |
| 11 |
config = get_pypy_config() |
| 12 |
parser = to_optparse(config, useoptions=["objspace.*"], |
| 13 |
extra_useage=extra_useage) |
| 14 |
return config, parser |
| 15 |
|
| 16 |
def process_options(parser, argv=None): |
| 17 |
parser.disable_interspersed_args() |
| 18 |
options, args = parser.parse_args(argv) |
| 19 |
return args |
| 20 |
|
| 21 |
def make_config(cmdlineopt, **kwds): |
| 22 |
""" make a config from cmdline options (which overrides everything) |
| 23 |
and kwds """ |
| 24 |
|
| 25 |
config = get_pypy_config(translating=False) |
| 26 |
for modname in kwds.pop("usemodules", []): |
| 27 |
setattr(config.objspace.usemodules, modname, True) |
| 28 |
config.set(**kwds) |
| 29 |
return config |
| 30 |
|
| 31 |
def make_objspace(config): |
| 32 |
from pypy.objspace.std.objspace import StdObjSpace |
| 33 |
return StdObjSpace(config) |