当前位置: 首页>>代码示例>>Python>>正文


Python mx.warn函数代码示例

本文整理汇总了Python中mx.warn函数的典型用法代码示例。如果您正苦于以下问题:Python warn函数的具体用法?Python warn怎么用?Python warn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了warn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: suite_native_image_root

def suite_native_image_root(suite=None):
    if not suite:
        suite = svm_suite()
    root_dir = join(svmbuild_dir(suite), 'native-image-root')
    rev_file_name = join(root_dir, 'rev')
    rev_value = suite.vc.parent(suite.vc_dir)
    def write_rev_file():
        mkpath(root_dir)
        with open(rev_file_name, 'w') as rev_file:
            rev_file.write(rev_value)
    if exists(root_dir):
        try:
            with open(rev_file_name, 'r') as rev_file:
                prev_rev_value = rev_file.readline()
        except:
            prev_rev_value = 'nothing'
        if prev_rev_value != rev_value:
            mx.warn('Rebuilding native-image-root as working directory revision changed from ' + prev_rev_value + ' to ' + rev_value)
            remove_tree(root_dir)
            layout_native_image_root(root_dir)
            write_rev_file()
    else:
        layout_native_image_root(root_dir)
        write_rev_file()
    return root_dir
开发者ID:charig,项目名称:truffle,代码行数:25,代码来源:mx_substratevm.py

示例2: microbench

    def microbench(self, args):
        """run JMH microbenchmark projects"""
        parser = ArgumentParser(prog='mx microbench', description=microbench.__doc__,
                                usage="%(prog)s [command options|VM options] [-- [JMH options]]")
        parser.add_argument('--jar', help='Explicitly specify micro-benchmark location')
        self.add_arguments(parser)

        mx.warn("`mx microbench` is deprecated! Consider moving to `mx_benchmark.JMHRunnerBenchmarkSuite`")

        known_args, args = parser.parse_known_args(args)

        vmArgs, jmhArgs = mx.extract_VM_args(args, useDoubleDash=True)
        vmArgs = self.parseVmArgs(vmArgs)

        # look for -f in JMH arguments
        forking = True
        for i in range(len(jmhArgs)):
            arg = jmhArgs[i]
            if arg.startswith('-f'):
                if arg == '-f' and (i+1) < len(jmhArgs):
                    arg += jmhArgs[i+1]
                try:
                    if int(arg[2:]) == 0:
                        forking = False
                except ValueError:
                    pass

        if known_args.jar:
            # use the specified jar
            args = ['-jar', known_args.jar]
            if not forking:
                args += vmArgs
            # we do not know the compliance level of the jar - assuming 1.8
            self.javaCompliance = mx.JavaCompliance('1.8')
        else:
            # find all projects with a direct JMH dependency
            projects_dict = mx_benchmark.JMHRunnerBenchmarkSuite.get_jmh_projects_dict()
            jmhProjects = projects_dict['JMH'] if 'JMH' in projects_dict else []
            # get java compliance - 1.8 is minimum since we build jmh-runner with java 8
            self.javaCompliance = max([p.javaCompliance for p in jmhProjects] + [mx.JavaCompliance('1.8')])
            cpArgs = mx.get_runtime_jvm_args([p.name for p in jmhProjects], jdk=mx.get_jdk(self.javaCompliance))

            # execute JMH runner
            if forking:
                args, cpVmArgs = self.filterVmArgs(cpArgs)
                vmArgs += cpVmArgs
            else:
                args = cpArgs + vmArgs
            args += ['org.openjdk.jmh.Main']

        if forking:
            def quoteSpace(s):
                if " " in s:
                    return '"' + s + '"'
                return s

            forkedVmArgs = map(quoteSpace, self.parseForkedVmArgs(vmArgs))
            args += ['--jvmArgsPrepend', ' '.join(forkedVmArgs)]
        self.run_java(args + jmhArgs)
开发者ID:charig,项目名称:mx,代码行数:59,代码来源:mx_microbench.py

示例3: repairDatapointsAndFail

 def repairDatapointsAndFail(self, benchmarks, bmSuiteArgs, partialResults, message):
     try:
         super(BaseDaCapoBenchmarkSuite, self).repairDatapointsAndFail(benchmarks, bmSuiteArgs, partialResults, message)
     finally:
         if self.workdir:
             # keep old workdir for investigation, create a new one for further benchmarking
             mx.warn("Keeping scratch directory after failed benchmark: {0}".format(self.workdir))
             self._create_tmp_workdir()
开发者ID:mur47x111,项目名称:graal-core,代码行数:8,代码来源:mx_graal_benchmark.py

示例4: getVariants

 def getVariants(self):
     if not hasattr(self, '_variants'):
         self._variants = []
         for v in self.variants:
             if 'gcc' in v and not SulongTestSuite.haveDragonegg():
                 mx.warn('Could not find dragonegg, not building test variant "%s"' % v)
                 continue
             self._variants.append(v)
     return self._variants
开发者ID:jakre,项目名称:sulong,代码行数:9,代码来源:mx_testsuites.py

示例5: before

 def before(self, bmSuiteArgs):
     parser = mx_benchmark.parsers["dacapo_benchmark_suite"].parser
     bmArgs, _ = parser.parse_known_args(bmSuiteArgs)
     self.keepScratchDir = bmArgs.keep_scratch
     if not bmArgs.no_scratch:
         self._create_tmp_workdir()
     else:
         mx.warn("NO scratch directory created! (--no-scratch)")
         self.workdir = None
开发者ID:mur47x111,项目名称:graal-core,代码行数:9,代码来源:mx_graal_benchmark.py

示例6: run_vm

def run_vm(*positionalargs, **kwargs):
    """run a Java program by executing the java executable in a Graal JDK"""

    # convert positional args to a list so the first element can be updated
    positionalargs = list(positionalargs)
    args = positionalargs[0]
    if '-G:+PrintFlags' in args and '-Xcomp' not in args:
        mx.warn('Using -G:+PrintFlags may have no effect without -Xcomp as Graal initialization is lazy')
    positionalargs[0] = _buildGOptionsArgs(args)
    return _jvmci_run_vm(*positionalargs, **kwargs)
开发者ID:axel22,项目名称:graal-core,代码行数:10,代码来源:mx_graal_8.py

示例7: _parseVmArgs

def _parseVmArgs(jdk, args, addDefaultArgs=True):
    args = mx.expand_project_in_args(args, insitu=False)
    jacocoArgs = mx_gate.get_jacoco_agent_args()
    if jacocoArgs:
        args = jacocoArgs + args

    # Support for -G: options
    def translateGOption(arg):
        if arg.startswith("-G:+"):
            if "=" in arg:
                mx.abort("Mixing + and = in -G: option specification: " + arg)
            arg = "-Dgraal." + arg[len("-G:+") :] + "=true"
        elif arg.startswith("-G:-"):
            if "=" in arg:
                mx.abort("Mixing - and = in -G: option specification: " + arg)
            arg = "-Dgraal." + arg[len("-G:+") :] + "=false"
        elif arg.startswith("-G:"):
            if "=" not in arg:
                mx.abort('Missing "=" in non-boolean -G: option specification: ' + arg)
            arg = "-Dgraal." + arg[len("-G:") :]
        return arg

    args = map(translateGOption, args)

    if "-G:+PrintFlags" in args and "-Xcomp" not in args:
        mx.warn("Using -G:+PrintFlags may have no effect without -Xcomp as Graal initialization is lazy")

    bcp = [mx.distribution("truffle:TRUFFLE_API").classpath_repr()]
    if _jvmciModes[_vm.jvmciMode]:
        bcp.extend([d.get_classpath_repr() for d in _bootClasspathDists])

    args = ["-Xbootclasspath/p:" + os.pathsep.join(bcp)] + args

    # Remove JVMCI from class path. It's only there to support compilation.
    cpIndex, cp = mx.find_classpath_arg(args)
    if cp:
        jvmciLib = mx.library("JVMCI").path
        cp = os.pathsep.join([e for e in cp.split(os.pathsep) if e != jvmciLib])
        args[cpIndex] = cp

    # Set the default JVMCI compiler
    jvmciCompiler = _compilers[-1]
    args = ["-Djvmci.compiler=" + jvmciCompiler] + args

    if "-version" in args:
        ignoredArgs = args[args.index("-version") + 1 :]
        if len(ignoredArgs) > 0:
            mx.log(
                "Warning: The following options will be ignored by the vm because they come after the '-version' argument: "
                + " ".join(ignoredArgs)
            )
    return jdk.processArgs(args, addDefaultArgs=addDefaultArgs)
开发者ID:sanzinger,项目名称:graal-core,代码行数:52,代码来源:mx_graal_9.py

示例8: _check_bootstrap_config

def _check_bootstrap_config(args):
    """
    Issues a warning if `args` denote -XX:+BootstrapJVMCI but -XX:-UseJVMCICompiler.
    """
    bootstrap = False
    useJVMCICompiler = False
    for arg in args:
        if arg == '-XX:+BootstrapJVMCI':
            bootstrap = True
        elif arg == '-XX:+UseJVMCICompiler':
            useJVMCICompiler = True
    if bootstrap and not useJVMCICompiler:
        mx.warn('-XX:+BootstrapJVMCI is ignored since -XX:+UseJVMCICompiler is not enabled')
开发者ID:emrul,项目名称:graal-core,代码行数:13,代码来源:mx_graal_core.py

示例9: native_image_on_jvm

def native_image_on_jvm(args, **kwargs):
    save_args = []
    for arg in args:
        if arg == '--no-server' or arg.startswith('--server'):
            mx.warn('Ignoring server-mode native-image argument ' + arg)
        else:
            save_args.append(arg)

    driver_cp = [join(suite_native_image_root(), 'lib', subdir, '*.jar') for subdir in ['boot', 'jvmci', 'graalvm']]
    driver_cp += [join(suite_native_image_root(), 'lib', 'svm', tail) for tail in ['*.jar', join('builder', '*.jar')]]
    driver_cp = list(itertools.chain.from_iterable(glob.glob(cp) for cp in driver_cp))
    run_java(['-Dnative-image.root=' + suite_native_image_root(), '-cp', ":".join(driver_cp),
        mx.dependency('substratevm:SVM_DRIVER').mainClass] + save_args, **kwargs)
开发者ID:charig,项目名称:truffle,代码行数:13,代码来源:mx_substratevm.py

示例10: _parseVmArgs

def _parseVmArgs(jdk, args, addDefaultArgs=True):
    args = mx.expand_project_in_args(args, insitu=False)
    jacocoArgs = mx_gate.get_jacoco_agent_args()
    if jacocoArgs:
        args = jacocoArgs + args

    # Support for -G: options
    def translateGOption(arg):
        if arg.startswith('-G:+'):
            if '=' in arg:
                mx.abort('Mixing + and = in -G: option specification: ' + arg)
            arg = '-Dgraal.' + arg[len('-G:+'):] + '=true'
        elif arg.startswith('-G:-'):
            if '=' in arg:
                mx.abort('Mixing - and = in -G: option specification: ' + arg)
            arg = '-Dgraal.' + arg[len('-G:+'):] + '=false'
        elif arg.startswith('-G:'):
            if '=' not in arg:
                mx.abort('Missing "=" in non-boolean -G: option specification: ' + arg)
            arg = '-Dgraal.' + arg[len('-G:'):]
        return arg
    # add default graal.options.file and translate -G: options
    options_file = join(mx.primary_suite().dir, 'graal.options')
    options_file_arg = ['-Dgraal.options.file=' + options_file] if exists(options_file) else []
    args = options_file_arg + map(translateGOption, args)

    if '-G:+PrintFlags' in args and '-Xcomp' not in args:
        mx.warn('Using -G:+PrintFlags may have no effect without -Xcomp as Graal initialization is lazy')

    bcp = [mx.distribution('truffle:TRUFFLE_API').classpath_repr()]
    if _jvmciModes[_vm.jvmciMode]:
        bcp.extend([d.get_classpath_repr() for d in _bootClasspathDists])

    args = ['-Xbootclasspath/p:' + os.pathsep.join(bcp)] + args

    # Remove JVMCI from class path. It's only there to support compilation.
    cpIndex, cp = mx.find_classpath_arg(args)
    if cp:
        jvmciLib = mx.library('JVMCI').path
        cp = os.pathsep.join([e for e in cp.split(os.pathsep) if e != jvmciLib])
        args[cpIndex] = cp

    # Set the default JVMCI compiler
    jvmciCompiler = _compilers[-1]
    args = ['-Djvmci.Compiler=' + jvmciCompiler] + args

    if '-version' in args:
        ignoredArgs = args[args.index('-version') + 1:]
        if  len(ignoredArgs) > 0:
            mx.log("Warning: The following options will be ignored by the vm because they come after the '-version' argument: " + ' '.join(ignoredArgs))
    return jdk.processArgs(args, addDefaultArgs=addDefaultArgs)
开发者ID:Prototype1,项目名称:graal-core,代码行数:51,代码来源:mx_graal_9.py

示例11: _write_cached_testclasses

def _write_cached_testclasses(cachesDir, jar, testclasses):
    """
    Writes `testclasses` to a cache file specific to `jar`.

    :param str cachesDir: directory containing files with cached test lists
    :param list testclasses: a list of test class names
    """
    cache = join(cachesDir, basename(jar) + '.testclasses')
    try:
        with open(cache, 'w') as fp:
            for classname in testclasses:
                print >> fp, classname
    except IOError as e:
        mx.warn('Error writing to ' + cache + ': ' + str(e))
开发者ID:charig,项目名称:mx,代码行数:14,代码来源:mx_unittest.py

示例12: checkLinks

def checkLinks(javadocDir):
    href = re.compile('(?<=href=").*?(?=")')
    filesToCheck = {}
    for root, _, files in os.walk(javadocDir):
        for f in files:
            if f.endswith('.html'):
                html = os.path.join(root, f)
                content = open(html, 'r').read()
                for url in href.findall(content):
                    full = urljoin(html, url)
                    sectionIndex = full.find('#')
                    questionIndex = full.find('?')
                    minIndex = sectionIndex
                    if minIndex < 0:
                        minIndex = len(full)
                    if questionIndex >= 0 and questionIndex < minIndex:
                        minIndex = questionIndex
                    path = full[0:minIndex]

                    sectionNames = filesToCheck.get(path, [])
                    if sectionIndex >= 0:
                        s = full[sectionIndex + 1:]
                        sectionNames = sectionNames + [(html, s)]
                    else:
                        sectionNames = sectionNames + [(html, None)]

                    filesToCheck[path] = sectionNames

    err = False
    for referencedfile, sections in filesToCheck.items():
        if referencedfile.startswith('javascript:') or referencedfile.startswith('http:') or referencedfile.startswith('https:') or referencedfile.startswith('mailto:'):
            continue
        if not exists(referencedfile):
            mx.warn('Referenced file ' + referencedfile + ' does not exist. Referenced from ' + sections[0][0])
            err = True
        else:
            content = open(referencedfile, 'r').read()
            for path, s in sections:
                if not s == None:
                    whereName = content.find('name="' + s + '"')
                    whereId = content.find('id="' + s + '"')
                    if whereName == -1 and whereId == -1:
                        mx.warn('There should be section ' + s + ' in ' + referencedfile + ". Referenced from " + path)
                        err = True

    if err:
        mx.abort('There are wrong references in Javadoc')
开发者ID:charig,项目名称:truffle,代码行数:47,代码来源:mx_tools.py

示例13: _read_cached_testclasses

def _read_cached_testclasses(cachesDir, jar):
    """
    Reads the cached list of test classes in `jar`.

    :param str cachesDir: directory containing files with cached test lists
    :return: the cached list of test classes in `jar` or None if the cache doesn't
             exist or is out of date
    """
    cache = join(cachesDir, basename(jar) + '.testclasses')
    if exists(cache) and mx.TimeStampFile(cache).isNewerThan(jar):
        # Only use the cached result if the source jar is older than the cache file
        try:
            with open(cache) as fp:
                return [line.strip() for line in fp.readlines()]
        except IOError as e:
            mx.warn('Error reading from ' + cache + ': ' + str(e))
    return None
开发者ID:charig,项目名称:mx,代码行数:17,代码来源:mx_unittest.py

示例14: checkGOption

 def checkGOption(arg):
     if arg.startswith('-G:+'):
         if '=' in arg:
             mx.abort('Mixing + and = in -G: option specification: ' + arg)
         translation = '-Dgraal.' + arg[len('-G:+'):] + '=true'
     elif arg.startswith('-G:-'):
         if '=' in arg:
             mx.abort('Mixing - and = in -G: option specification: ' + arg)
         translation = '-Dgraal.' + arg[len('-G:+'):] + '=false'
     elif arg.startswith('-G:'):
         if '=' not in arg:
             mx.abort('Missing "=" in non-boolean -G: option specification: ' + arg)
         translation = '-Dgraal.' + arg[len('-G:'):]
     else:
         return arg
     mx.warn('Support for -G options is deprecated and will soon be removed. Replace "' + arg + '" with "' + translation + '"')
     return translation
开发者ID:emrul,项目名称:graal-core,代码行数:17,代码来源:mx_graal_core.py

示例15: _replace

 def _replace(self, m):
     var = m.group(1)
     if var in self._subst:
         fn = self._subst[var]
         if self._hasArg[var]:
             arg = m.group(3)
             return fn(arg)
         else:
             if m.group(3) is not None:
                 mx.warn('Ignoring argument in substitution ' + m.group(0))
             if callable(fn):
                 return fn()
             else:
                 return fn
     elif self._chain is not None:
         return self._chain._replace(m)
     else:
         mx.abort('Unknown substitution: ' + m.group(0))
开发者ID:charig,项目名称:mx,代码行数:18,代码来源:mx_subst.py


注:本文中的mx.warn函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。