コード例 #1
0
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
コード例 #2
0
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"
            ),
        ]
    )
コード例 #3
0
ファイル: config.py プロジェクト: fenildf/pycket
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)",
        default=True,
        cmdline="--strategies"),
    BoolOption(
        "type_size_specialization",
        "unbox small data structure fields and type specialize (environments, continuations, structs, cons cells, etc)",
        default=True,
        cmdline="--type-size-specialization"),
    BoolOption(
        "prune_env", "prune environment", default=True, cmdline="--prune-env"),
    BoolOption("immutable_boolean_field_elision",
               "elide immutable boolean fields from structs",
               default=False,
               cmdline="--ibfe"),
    BoolOption("hidden_classes",
               "use hidden classes to implement impersonators",
               default=True,
               cmdline="--hidden-classes")
])
コード例 #4
0
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",
                   default=False,
                   cmdline="--shared"),
        BoolOption("log",
                   "Include debug prints in the translation (PYPYLOG=...)",
                   default=True,
                   cmdline="--log"),

        # gc
        ChoiceOption(
            "gc",
            "Garbage Collection Strategy",
            [
                "boehm", "ref", "semispace", "statistics", "generation",
                "hybrid", "minimark", 'incminimark', "none"
            ],
            "ref",
            requires={
                "ref": [
                    ("translation.rweakref", False),  # XXX
                    ("translation.gctransformer", "ref")
                ],
                "none": [
                    ("translation.rweakref", False),  # XXX
                    ("translation.gctransformer", "none")
                ],
                "semispace": [("translation.gctransformer", "framework")],
                "statistics": [("translation.gctransformer", "framework")],
                "generation": [("translation.gctransformer", "framework")],
                "hybrid": [("translation.gctransformer", "framework")],
                "boehm": [
                    ("translation.continuation", False),  # breaks
                    ("translation.gctransformer", "boehm")
                ],
                "minimark": [("translation.gctransformer", "framework")],
                "incminimark": [("translation.gctransformer", "framework")],
            },
            cmdline="--gc"),
        ChoiceOption("gctransformer",
                     "GC transformer that is used - internal",
                     ["boehm", "ref", "framework", "none"],
                     default="ref",
                     cmdline=None,
                     requires={
                         "boehm": [("translation.gcrootfinder", "n/a"),
                                   ("translation.gcremovetypeptr", False)],
                         "ref": [("translation.gcrootfinder", "n/a"),
                                 ("translation.gcremovetypeptr", False)],
                         "none": [("translation.gcrootfinder", "n/a"),
                                  ("translation.gcremovetypeptr", False)],
                     }),
        BoolOption("gcremovetypeptr",
                   "Remove the typeptr from every object",
                   default=IS_64_BITS,
                   cmdline="--gcremovetypeptr"),
        ChoiceOption("gcrootfinder",
                     "Strategy for finding GC Roots (framework GCs only)",
                     ["n/a", "shadowstack", "asmgcc"],
                     "shadowstack",
                     cmdline="--gcrootfinder",
                     requires={
                         "shadowstack":
                         [("translation.gctransformer", "framework")],
                         "asmgcc": [("translation.gctransformer", "framework"),
                                    ("translation.backend", "c")],
                     }),

        # other noticeable options
        BoolOption("thread",
                   "enable use of threading primitives",
                   default=False,
                   cmdline="--thread"),
        BoolOption("sandbox",
                   "Produce a fully-sandboxed executable",
                   default=False,
                   cmdline="--sandbox",
                   requires=[("translation.thread", False)],
                   suggests=[("translation.gc", "generation"),
                             ("translation.gcrootfinder", "shadowstack")]),
        BoolOption("rweakref",
                   "The backend supports RPython-level weakrefs",
                   default=True),

        # JIT generation: use -Ojit to enable it
        BoolOption(
            "jit",
            "generate a JIT",
            default=False,
            suggests=[("translation.gc", DEFL_GC),
                      ("translation.gcrootfinder", DEFL_ROOTFINDER_WITHJIT),
                      ("translation.list_comprehension_operations", True)]),
        ChoiceOption("jit_backend",
                     "choose the backend for the JIT",
                     ["auto", "x86", "x86-without-sse2", 'arm'],
                     default="auto",
                     cmdline="--jit-backend"),
        ChoiceOption("jit_profiler",
                     "integrate profiler support into the JIT",
                     ["off", "oprofile"],
                     default="off"),
        ChoiceOption("jit_opencoder_model",
                     "the model limits the maximal length"
                     " of traces. Use big if you want to go bigger than "
                     "the default", ["big", "normal"],
                     default="normal"),
        BoolOption(
            "check_str_without_nul",
            "Forbid NUL chars in strings in some external function calls",
            default=False,
            cmdline=None),

        # misc
        BoolOption("verbose",
                   "Print extra information",
                   default=False,
                   cmdline="--verbose"),
        StrOption("cc",
                  "Specify compiler to use for compiling generated C",
                  cmdline="--cc"),
        StrOption("profopt",
                  "Specify profile based optimization script",
                  cmdline="--profopt"),
        BoolOption("noprofopt",
                   "Don't use profile based optimization",
                   default=False,
                   cmdline="--no-profopt",
                   negation=False),
        BoolOption("instrument",
                   "internal: turn instrumentation on",
                   default=False,
                   cmdline=None),
        BoolOption("countmallocs",
                   "Count mallocs and frees",
                   default=False,
                   cmdline=None),
        ChoiceOption("fork_before",
                     "(UNIX) Create restartable checkpoint before step", [
                         "annotate", "rtype", "backendopt", "database",
                         "source", "pyjitpl"
                     ],
                     default=None,
                     cmdline="--fork-before"),
        BoolOption(
            "dont_write_c_files",
            "Make the C backend write everyting to /dev/null. " +
            "Useful for benchmarking, so you don't actually involve the disk",
            default=False,
            cmdline="--dont-write-c-files"),
        ArbitraryOption("instrumentctl", "internal", default=None),
        StrOption("output", "Output file name", cmdline="--output"),
        StrOption(
            "secondaryentrypoints",
            "Comma separated list of keys choosing secondary entrypoints",
            cmdline="--entrypoints",
            default="main"),
        BoolOption("dump_static_data_info",
                   "Dump static data info",
                   cmdline="--dump_static_data_info",
                   default=False,
                   requires=[("translation.backend", "c")]),

        # portability options
        BoolOption("no__thread",
                   "don't use __thread for implementing TLS",
                   default=not SUPPORT__THREAD,
                   cmdline="--no__thread",
                   negation=False),
        IntOption("make_jobs", "Specify -j argument to make for compilation"
                  " (C backend only)",
                  cmdline="--make-jobs",
                  default=detect_number_of_processors()),

        # Flags of the TranslationContext:
        BoolOption("list_comprehension_operations",
                   "When true, look for and special-case the sequence of "
                   "operations that results from a list comprehension and "
                   "attempt to pre-allocate the list",
                   default=False,
                   cmdline='--listcompr'),
        IntOption(
            "withsmallfuncsets",
            "Represent groups of less funtions than this as indices into an array",
            default=0),
        BoolOption("taggedpointers",
                   "When true, enable the use of tagged pointers. "
                   "If false, use normal boxing",
                   default=False),
        BoolOption(
            "keepgoing",
            "Continue annotating when errors are encountered, and report "
            "them all at the end of the annotation phase",
            default=False,
            cmdline="--keepgoing"),
        BoolOption("lldebug",
                   "If true, makes an lldebug build",
                   default=False,
                   cmdline="--lldebug"),
        BoolOption("lldebug0",
                   "If true, makes an lldebug0 build",
                   default=False,
                   cmdline="--lldebug0"),
        StrOption("icon",
                  "Path to the (Windows) icon to use for the executable"),
        StrOption(
            "libname",
            "Windows: name and possibly location of the lib file to create"),
        OptionDescription(
            "backendopt",
            "Backend Optimization Options",
            [
                # control inlining
                BoolOption("inline",
                           "Do basic inlining and malloc removal",
                           default=True),
                FloatOption("inline_threshold",
                            "Threshold when to inline functions",
                            default=DEFL_INLINE_THRESHOLD,
                            cmdline="--inline-threshold"),
                StrOption(
                    "inline_heuristic", "Dotted name of an heuristic function "
                    "for inlining",
                    default=
                    "rpython.translator.backendopt.inline.inlining_heuristic",
                    cmdline="--inline-heuristic"),
                BoolOption("print_statistics",
                           "Print statistics while optimizing",
                           default=False),
                BoolOption("merge_if_blocks",
                           "Merge if ... elif chains",
                           cmdline="--if-block-merge",
                           default=True),
                BoolOption("mallocs", "Remove mallocs", default=True),
                BoolOption("constfold", "Constant propagation", default=True),
                # control profile based inlining
                StrOption(
                    "profile_based_inline",
                    "Use call count profiling to drive inlining"
                    ", specify arguments",
                    default=None),  # cmdline="--prof-based-inline" fix me
                FloatOption(
                    "profile_based_inline_threshold",
                    "Threshold when to inline functions "
                    "for profile based inlining",
                    default=DEFL_PROF_BASED_INLINE_THRESHOLD,
                ),  # cmdline="--prof-based-inline-threshold" fix me
                StrOption(
                    "profile_based_inline_heuristic",
                    "Dotted name of an heuristic function "
                    "for profile based inlining",
                    default=
                    "rpython.translator.backendopt.inline.inlining_heuristic",
                ),  # cmdline="--prof-based-inline-heuristic" fix me
                # control clever malloc removal
                BoolOption("clever_malloc_removal",
                           "Drives inlining to remove mallocs in a clever way",
                           default=False,
                           cmdline="--clever-malloc-removal"),
                FloatOption(
                    "clever_malloc_removal_threshold",
                    "Threshold when to inline functions in "
                    "clever malloc removal",
                    default=DEFL_CLEVER_MALLOC_REMOVAL_INLINE_THRESHOLD,
                    cmdline="--clever-malloc-removal-threshold"),
                StrOption(
                    "clever_malloc_removal_heuristic",
                    "Dotted name of an heuristic function "
                    "for inlining in clever malloc removal",
                    default=
                    "rpython.translator.backendopt.inline.inlining_heuristic",
                    cmdline="--clever-malloc-removal-heuristic"),
                BoolOption(
                    "remove_asserts",
                    "Remove operations that look like 'raise AssertionError', "
                    "which lets the C optimizer remove the asserts",
                    default=False),
                BoolOption(
                    "really_remove_asserts",
                    "Really remove operations that look like 'raise AssertionError', "
                    "without relying on the C compiler",
                    default=False),
                BoolOption(
                    "stack_optimization",
                    "Tranform graphs in SSI form into graphs tailored for "
                    "stack based virtual machines (only for backends that support it)",
                    default=True),
                BoolOption("storesink", "Perform store sinking", default=True),
                BoolOption("replace_we_are_jitted",
                           "Replace we_are_jitted() calls by False",
                           default=False,
                           cmdline=None),
                BoolOption(
                    "none",
                    "Do not run any backend optimizations",
                    requires=[
                        ('translation.backendopt.inline', False),
                        ('translation.backendopt.inline_threshold', 0),
                        ('translation.backendopt.merge_if_blocks', False),
                        ('translation.backendopt.mallocs', False),
                        ('translation.backendopt.constfold', False)
                    ])
            ]),
        ChoiceOption("platform",
                     "target platform", ['host'] + PLATFORMS,
                     default='host',
                     cmdline='--platform',
                     suggests={
                         "arm": [("translation.gcrootfinder", "shadowstack"),
                                 ("translation.jit_backend", "arm")]
                     }),
    ])
コード例 #5
0
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"),
        BoolOption("no_site_import",
                   "do not 'import site' on initialization",
                   default=False,
                   cmdline="-S"),
        BoolOption(
            "runmodule",
            "library module to be run as a script (terminates option list)",
            default=False,
            cmdline="-m"),
        BoolOption("runcommand",
                   "program passed in as CMD (terminates option list)",
                   default=False,
                   cmdline="-c"),
        StrOption(
            "warn",
            "warning control (arg is action:message:category:module:lineno)",
            default=None,
            cmdline="-W"),
    ])
コード例 #6
0
ファイル: pypyoption.py プロジェクト: weijiwei/pypy
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,
            cmdline="--allworkingmodules",
            negation=True),
        StrOption("extmodules",
                  "Comma-separated list of third-party builtin modules",
                  cmdline="--ext",
                  default=None),
        BoolOption(
            "translationmodules",
            "use only those modules that are needed to run translate.py on pypy",
            default=False,
            cmdline="--translationmodules",
            suggests=[("objspace.allworkingmodules", False)]),
        BoolOption("usepycfiles",
                   "Write and read pyc files when importing",
                   default=True),
        BoolOption("lonepycfiles",
                   "Import pyc files with no matching py file",
                   default=False,
                   requires=[("objspace.usepycfiles", True)]),
        StrOption(
            "soabi",
            "Tag to differentiate extension modules built for different Python interpreters",
            cmdline="--soabi",
            default=None),
        BoolOption("honor__builtins__",
                   "Honor the __builtins__ key of a module dictionary",
                   default=False),
        BoolOption("disable_call_speedhacks",
                   "make sure that all calls go through space.call_args",
                   default=False),
        OptionDescription(
            "std",
            "Standard Object Space Options",
            [
                BoolOption(
                    "withtproxy", "support transparent proxies", default=True),
                BoolOption("withprebuiltint",
                           "prebuild commonly used int objects",
                           default=False),
                IntOption("prebuiltintfrom",
                          "lowest integer which is prebuilt",
                          default=-5,
                          cmdline="--prebuiltintfrom"),
                IntOption("prebuiltintto",
                          "highest integer which is prebuilt",
                          default=100,
                          cmdline="--prebuiltintto"),
                BoolOption("withsmalllong",
                           "use a version of 'long' in a C long long",
                           default=False),
                BoolOption("withstrbuf",
                           "use strings optimized for addition (ver 2)",
                           default=False),
                BoolOption("withprebuiltchar",
                           "use prebuilt single-character string objects",
                           default=False),
                BoolOption(
                    "sharesmallstr",
                    "always reuse the prebuilt string objects "
                    "(the empty string and potentially single-char strings)",
                    default=False),
                BoolOption("withspecialisedtuple",
                           "use specialised tuples",
                           default=False),
                BoolOption(
                    "withcelldict",
                    "use dictionaries that are optimized for being used as module dicts",
                    default=False,
                    requires=[("objspace.honor__builtins__", False)]),
                BoolOption(
                    "withmapdict",
                    "make instances really small but slow without the JIT",
                    default=False,
                    requires=[
                        ("objspace.std.getattributeshortcut", True),
                        ("objspace.std.withtypeversion", True),
                    ]),
                BoolOption(
                    "withrangelist",
                    "enable special range list implementation that does not "
                    "actually create the full list until the resulting "
                    "list is mutated",
                    default=False),
                BoolOption(
                    "withliststrategies",
                    "enable optimized ways to store lists of primitives ",
                    default=True),
                BoolOption(
                    "withtypeversion",
                    "version type objects when changing them",
                    cmdline=None,
                    default=False,
                    # weakrefs needed, because of get_subclasses()
                    requires=[("translation.rweakref", True)]),
                BoolOption("withmethodcache",
                           "try to cache method lookups",
                           default=False,
                           requires=[("objspace.std.withtypeversion", True),
                                     ("translation.rweakref", True)]),
                BoolOption(
                    "withmethodcachecounter",
                    "try to cache methods and provide a counter in __pypy__. "
                    "for testing purposes only.",
                    default=False,
                    requires=[("objspace.std.withmethodcache", True)]),
                IntOption(
                    "methodcachesizeexp",
                    " 2 ** methodcachesizeexp is the size of the of the method cache ",
                    default=11),
                BoolOption(
                    "intshortcut",
                    "special case addition and subtraction of two integers in BINARY_ADD/"
                    "/BINARY_SUBTRACT and their inplace counterparts",
                    default=False),
                BoolOption("optimized_list_getitem",
                           "special case the 'list[integer]' expressions",
                           default=False),
                BoolOption(
                    "getattributeshortcut",
                    "track types that override __getattribute__",
                    default=False,
                    # weakrefs needed, because of get_subclasses()
                    requires=[("translation.rweakref", True)]),
                BoolOption(
                    "newshortcut",
                    "cache and shortcut calling __new__ from builtin types",
                    default=False,
                    # weakrefs needed, because of get_subclasses()
                    requires=[("translation.rweakref", True)]),
                BoolOption(
                    "withidentitydict",
                    "track types that override __hash__, __eq__ or __cmp__ and use a special dict strategy for those which do not",
                    default=False,
                    # weakrefs needed, because of get_subclasses()
                    requires=[("translation.rweakref", True)]),
            ]),
    ])
コード例 #7
0
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",
            negation=True),
        StrOption("extmodules",
                  "Comma-separated list of third-party builtin modules",
                  cmdline="--ext",
                  default=None),
        BoolOption(
            "translationmodules",
            "use only those modules that are needed to run translate.py on pypy",
            default=False,
            cmdline="--translationmodules",
            suggests=[("objspace.allworkingmodules", False)]),
        BoolOption("lonepycfiles",
                   "Import pyc files with no matching py file",
                   default=False),
        StrOption(
            "soabi",
            "Tag to differentiate extension modules built for different Python interpreters",
            cmdline="--soabi",
            default=None),
        BoolOption("honor__builtins__",
                   "Honor the __builtins__ key of a module dictionary",
                   default=False),
        BoolOption("disable_call_speedhacks",
                   "make sure that all calls go through space.call_args",
                   default=False),
        BoolOption("disable_entrypoints",
                   "Disable external entry points, notably the"
                   " cpyext module and cffi's embedding mode.",
                   default=False,
                   requires=[("objspace.usemodules.cpyext", False)]),
        ChoiceOption(
            "hash",
            "The hash function to use for strings: fnv from CPython 2.7"
            " or siphash24 from CPython >= 3.4", ["fnv", "siphash24"],
            default="fnv",
            cmdline="--hash"),
        OptionDescription("std", "Standard Object Space Options", [
            BoolOption(
                "withtproxy", "support transparent proxies", default=True),
            BoolOption("withprebuiltint",
                       "prebuild commonly used int objects",
                       default=False),
            IntOption("prebuiltintfrom",
                      "lowest integer which is prebuilt",
                      default=-5,
                      cmdline="--prebuiltintfrom"),
            IntOption("prebuiltintto",
                      "highest integer which is prebuilt",
                      default=100,
                      cmdline="--prebuiltintto"),
            BoolOption("withsmalllong",
                       "use a version of 'long' in a C long long",
                       default=False),
            BoolOption("withspecialisedtuple",
                       "use specialised tuples",
                       default=False),
            BoolOption("withliststrategies",
                       "enable optimized ways to store lists of primitives ",
                       default=True),
            BoolOption(
                "withmethodcachecounter",
                "try to cache methods and provide a counter in __pypy__. "
                "for testing purposes only.",
                default=False),
            IntOption(
                "methodcachesizeexp",
                " 2 ** methodcachesizeexp is the size of the of the method cache ",
                default=11),
            BoolOption(
                "intshortcut",
                "special case addition and subtraction of two integers in BINARY_ADD/"
                "/BINARY_SUBTRACT and their inplace counterparts",
                default=False),
            BoolOption("optimized_list_getitem",
                       "special case the 'list[integer]' expressions",
                       default=False),
            BoolOption("newshortcut",
                       "cache and shortcut calling __new__ from builtin types",
                       default=False),
            BoolOption("reinterpretasserts",
                       "Perform reinterpretation when an assert fails "
                       "(only relevant for tests)",
                       default=False),
        ]),
    ])
コード例 #8
0
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


def set_options(config):
    import sys
    thismod = sys.modules[__name__]
コード例 #9
0
ファイル: config.py プロジェクト: 8l/pycket
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,
               cmdline="--track-header"),
    BoolOption(
        "strategies",
        "strategies for data structures (vectors, cells, hashmaps, etc)",
        default=True,
        cmdline="--strategies"),
    BoolOption(
        "type_size_specialization",
        "unbox small data structure fields and type specialize (environments, continuations, structs, cons cells, etc)",
        default=True,
        cmdline="--type-size-specialization"),
    BoolOption(
        "prune_env", "prune environment", default=True, cmdline="--prune-env"),
])
コード例 #10
0
ファイル: translate.py プロジェクト: sbw111/lab4
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",
                   "Start the pygame viewer",
                   default=False,
                   cmdline="--view",
                   negation=False),
        BoolOption("help",
                   "show this help message and exit",
                   default=False,
                   cmdline="-h --help",
                   negation=False),
        BoolOption("fullhelp",
                   "show full help message and exit",
                   default=False,
                   cmdline="--full-help",
                   negation=False),
        ArbitraryOption("goals", "XXX", defaultfactory=list),
        # xxx default goals ['annotate', 'rtype', 'backendopt', 'source', 'compile']
        ArbitraryOption("skipped_goals", "XXX", defaultfactory=list),
        OptionDescription("goal_options",
                          "Goals that should be reached during translation",
                          goal_options()),
    ])