def goal_options(): result = [] for name, doc, cmdline, extra in GOALS: optional = False if name.startswith('?'): optional = True name = name[1:] yesdoc = doc[0].upper() + doc[1:] + extra result.append(BoolOption(name, yesdoc, default=False, cmdline=cmdline, negation=False)) if not optional: result.append(BoolOption("no_%s" % name, "Don't " + doc, default=False, cmdline="--no-" + name, negation=False)) return result
def get_combined_translation_config(other_optdescr=None, existing_config=None, overrides=None, translating=False): if overrides is None: overrides = {} d = BoolOption("translating", "indicates whether we are translating currently", default=False, cmdline=None) if other_optdescr is None: children = [] newname = "" else: children = [other_optdescr] newname = other_optdescr._name if existing_config is None: children += [d, translation_optiondescription] else: children += [ child for child in existing_config._cfgimpl_descr._children if child._name != newname ] descr = OptionDescription("pypy", "all options", children) config = Config(descr, **overrides) if translating: config.translating = True if existing_config is not None: for child in existing_config._cfgimpl_descr._children: if child._name == newname: continue value = getattr(existing_config, child._name) config._cfgimpl_values[child._name] = value return config
def translation_options(): return OptionDescription( "rsqueak", "RSqueak Options", [ StrOption( "optional_plugins", "Which optional plugins should be enabled (a comma-separated "\ "list, e.g. 'RubyPlugin,DatabasePlugin,JitHooks')", default="", cmdline="--plugins" ), StrOption( "disabled_plugins", "Which default plugins should be disabled (a comma-separated "\ "list, e.g. 'LargeIntegers,SocketPlugin,SqueakSSL')", default="", cmdline="--disabled_plugins" ), BoolOption( "without_plugins", "Disable all plugins", default=False, cmdline="--without_plugins" ), ] )
#! /usr/bin/env python # -*- coding: utf-8 -*- from rpython.config.config import OptionDescription, BoolOption, IntOption, ArbitraryOption, FloatOption from rpython.config.translationoption import get_combined_translation_config pycketoption_descr = OptionDescription("pycket", "Pycket Options", [ BoolOption("two_state", "enable the two-state JIT driver", default=True, cmdline="--two-state"), BoolOption("callgraph", "enable dynamic callgraph reconstruction", default=True, cmdline="--callgraph"), BoolOption("log_callgraph", "log the callgraph decisions", default=False, cmdline="--log-callgraph", requires=[("pycket.callgraph", True)]), BoolOption("fuse_conts", "fuse the continuations", default=False, cmdline="--fuse-conts"), BoolOption("with_branch", "build the git branch name into the executable name", default=False, cmdline="--with-branch"), BoolOption( "strategies", "strategies for data structures (vectors, cells, hashmaps, etc)",
CACHE_DIR = os.path.realpath(os.path.join(MAINDIR, '_cache')) PLATFORMS = [ 'maemo', 'host', 'distutils', 'arm', ] translation_optiondescription = OptionDescription( "translation", "Translation Options", [ BoolOption("continuation", "enable single-shot continuations", default=False, cmdline="--continuation", requires=[("translation.type_system", "lltype")]), ChoiceOption("type_system", "Type system to use when RTyping", ["lltype"], cmdline=None, default="lltype"), ChoiceOption("backend", "Backend to use for code generation", ["c"], default="c", requires={ "c": [("translation.type_system", "lltype")], }, cmdline="-b --backend"), BoolOption("shared", "Build as a shared library",
import sys import time pypy_path = os.path.join(os.path.dirname(__file__), '..', '..') sys.path.insert(0, os.path.abspath(pypy_path)) from pypy.tool import option from pypy.interpreter import main, interactive, error, gateway from rpython.config.config import OptionDescription, BoolOption, StrOption from rpython.config.config import Config, to_optparse from pypy.config import pypyoption cmdline_optiondescr = OptionDescription( "interactive", "the options of pyinteractive.py", [ BoolOption("verbose", "show verbose interpreter-level traceback", default=os.getenv("PYPY_TB"), cmdline="-v"), BoolOption("interactive", "inspect interactively after running script", default=False, cmdline="-i"), BoolOption("completer", "use readline commandline completer", default=False, cmdline="-C"), BoolOption( "optimize", "skip assert statements and remove docstrings when importing modules" " (this is -OO in regular CPython)", default=False, cmdline="-O"),
return None pypy_optiondescription = OptionDescription( "objspace", "Object Space Options", [ OptionDescription( "usemodules", "Which Modules should be used", [ BoolOption( modname, "use module %s" % (modname, ), default=modname in default_modules, cmdline="--withmod-%s" % (modname, ), requires=module_dependencies.get(modname, []), suggests=module_suggests.get(modname, []), negation=modname not in essential_modules, ) #validator=get_module_validator(modname)) for modname in all_modules ]), BoolOption( "allworkingmodules", "use as many working modules as possible", # NB. defaults to True, but in py.py this is overridden by # a False suggestion because it takes a while to start up. # Actual module enabling only occurs if # enable_allworkingmodules() is called, and it depends # on the selected backend. default=True,
"_rawffi": [("objspace.usemodules.struct", True)], "cpyext": [("translation.secondaryentrypoints", "cpyext,main")], } if sys.platform == "win32": module_suggests["cpyext"].append(("translation.shared", True)) pypy_optiondescription = OptionDescription( "objspace", "Object Space Options", [ OptionDescription("usemodules", "Which Modules should be used", [ BoolOption( modname, "use module %s" % (modname, ), default=modname in default_modules, cmdline="--withmod-%s" % (modname, ), requires=module_dependencies.get(modname, []), suggests=module_suggests.get(modname, []), negation=modname not in essential_modules, ) for modname in all_modules ]), BoolOption( "allworkingmodules", "use as many working modules as possible", # NB. defaults to True, but in py.py this is overridden by # a False suggestion because it takes a while to start up. # Actual module enabling only occurs if # enable_allworkingmodules() is called, and it depends # on the selected backend. default=True, cmdline="--allworkingmodules",
from rpython.config.config import OptionDescription, BoolOption, Config from rpython.rlib.objectmodel import specialize class HippyOptionError(Exception): pass OPTIONAL_EXTS = ["mysql", "hash", "fastcgi", "xml", "mcrypt"] optexts_descriptions = [ BoolOption("allexts", "Enable all extensions", default=False, cmdline="--allexts", requires=[("optexts.%s" % e, True) for e in OPTIONAL_EXTS] )] + [ BoolOption(extname, "Enable %s extension" % extname, default=False, cmdline="--withext-%s" % extname ) for extname in OPTIONAL_EXTS] hippy_optiondescription = OptionDescription("optexts", "Optional extensions", optexts_descriptions) # You need this top-level container when calling Config ctor directly. # You don't need this is the target because the opt parser does this part. top_hippy_optiondescription = \ OptionDescription("hippy", "all options", [ BoolOption("translating", "Are we translating?", default=False), hippy_optiondescription]) OPTIONS = Config(top_hippy_optiondescription) # default config
#! /usr/bin/env python # -*- coding: utf-8 -*- from rpython.config.config import OptionDescription, BoolOption, IntOption, ArbitraryOption, FloatOption from rpython.config.translationoption import get_combined_translation_config pycketoption_descr = OptionDescription("pycket", "Pycket Options", [ BoolOption("two_state", "enable the two-state JIT driver", default=True, cmdline="--two-state"), BoolOption("callgraph", "enable dynamic callgraph reconstruction", default=True, cmdline="--callgraph"), BoolOption("log_callgraph", "log the callgraph decisions", default=False, cmdline="--log-callgraph", requires=[("pycket.callgraph", True)]), BoolOption("fuse_conts", "fuse the continuations", default=False, cmdline="--fuse-conts"), BoolOption("with_branch", "build the git branch name into the executable name", default=False, cmdline="--with-branch"), BoolOption("track_header", "track loops headers instead of last AST element", default=False,
return result translate_optiondescr = OptionDescription( "translate", "XXX", [ StrOption( "targetspec", "XXX", default='targetpypystandalone', cmdline=None), ChoiceOption("opt", "optimization level", OPT_LEVELS, default=DEFAULT_OPT_LEVEL, cmdline="--opt -O"), BoolOption("profile", "cProfile (to debug the speed of the translation process)", default=False, cmdline="--profile"), BoolOption("pdb", "Always run pdb even if the translation succeeds", default=False, cmdline="--pdb"), BoolOption("batch", "Don't run interactive helpers", default=False, cmdline="--batch", negation=False), IntOption("huge", "Threshold in the number of functions after which " "a local call graph and not a full one is displayed", default=100, cmdline="--huge"), BoolOption("view",