本文整理汇总了Python中mx.get_env函数的典型用法代码示例。如果您正苦于以下问题:Python get_env函数的具体用法?Python get_env怎么用?Python get_env使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_env函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testgraal
def testgraal(args):
cloneFrom = mx.get_env("GRAAL_URL")
if not cloneFrom:
cloneFrom = "http://github.com/graalvm/graal-core"
graalSuiteSubDir = mx.get_env("GRAAL_SUITE_SUBDIR")
suite = mx.suite('truffle')
suiteDir = suite.dir
workDir = join(suite.get_output_root(), 'sanitycheck')
mx.ensure_dir_exists(join(workDir, suite.name))
for f in os.listdir(suiteDir):
subDir = os.path.join(suiteDir, f)
if subDir == suite.get_output_root():
continue
src = join(suiteDir, f)
tgt = join(workDir, suite.name, f)
if isdir(src):
if exists(tgt):
shutil.rmtree(tgt)
shutil.copytree(src, tgt)
else:
shutil.copy(src, tgt)
sanityDir = join(workDir, 'sanity')
git = mx.GitConfig()
if exists(sanityDir):
git.pull(sanityDir)
else:
git.clone(cloneFrom, sanityDir)
sanitySuiteDir = sanityDir if graalSuiteSubDir is None else join(sanityDir, graalSuiteSubDir)
return mx.run_mx(['--java-home=' + mx.get_jdk().home, 'gate', '-B--force-deprecation-as-warning', '--tags', 'build,test'], sanitySuiteDir)
示例2: compileWithEcjStrict
def compileWithEcjStrict(args=None):
"""build project with the option --warning-as-error"""
if mx.get_env("JDT"):
mx.clean([])
mx.command_function("build")(["-p", "--warning-as-error"])
else:
exit("JDT environment variable not set. Cannot execute BuildJavaWithEcj task.")
示例3: _test_harness_body_install_new
def _test_harness_body_install_new(args, vmArgs):
'''the callback from mx.test'''
libinstall = abspath("lib.install.cran")
# make sure its empty
shutil.rmtree(libinstall, ignore_errors=True)
os.mkdir(libinstall)
install_tmp = "install.tmp"
shutil.rmtree(install_tmp, ignore_errors=True)
os.mkdir(install_tmp)
os.environ["TMPDIR"] = install_tmp
os.environ['R_LIBS_USER'] = libinstall
stack_args = ['--J', '@-DR:-PrintErrorStacktracesToFile -DR:+PrintErrorStacktraces']
cran_args = []
local_cran = mx.get_env('MX_HG_BASE')
if local_cran:
cran_args = ['--cran-mirror', join(dirname(local_cran), 'cran')]
# the following is used to test the installation of packages that are not in the
# --ok-pkg-filelist file, i.e. those that have never been successfully installed
# extra_args = ['--ok-pkg-filelist', join(_cran_test_project(), 'ok.packages')]
# the following line is used to test packages that have been successfully installed
extra_args = ['--pkg-filelist', join(_cran_test_project(), 'ok.packages'), '--run-tests']
rc = installcran(stack_args + cran_args + ['--testcount', '100'] + extra_args)
shutil.rmtree(install_tmp, ignore_errors=True)
return rc
示例4: travis1
def travis1(args=None):
tasks = []
with Task('BuildJavaWithEcj', tasks) as t:
if t:
if mx.get_env('JDT'):
mx.command_function('build')(['-p', '--no-native', '--warning-as-error'])
gate_clean([], tasks, name='CleanAfterEcjBuild')
else:
mx._warn_or_abort('JDT environment variable not set. Cannot execute BuildJavaWithEcj task.', args.strict_mode)
with Task('BuildJavaWithJavac', tasks) as t:
if t: mx.command_function('build')(['-p', '--warning-as-error', '--no-native', '--force-javac'])
with Task('Findbugs', tasks) as t:
if t and mx_findbugs.findbugs([]) != 0:
t.abort('FindBugs warnings were found')
with Task('TestBenchmarks', tasks) as t:
if t: runBenchmarkTestCases()
with Task('TestPolglot', tasks) as t:
if t: runPolyglotTestCases()
with Task('TestInterop', tasks) as t:
if t: runInteropTestCases()
with Task('TestAsm', tasks) as t:
if t: runAsmTestCases()
with Task('TestTypes', tasks) as t:
if t: runTypeTestCases()
with Task('TestSulong', tasks) as t:
if t: runTruffleTestCases()
with Task('TestLLVM', tasks) as t:
if t: runLLVMTestCases()
示例5: getDacapo
def getDacapo(name, dacapoArgs=None, extraVmArguments=None):
dacapo = mx.get_env('DACAPO_CP')
if dacapo is None:
l = mx.library('DACAPO', False)
if l is not None:
dacapo = l.get_path(True)
else:
mx.abort('DaCapo 9.12 jar file must be specified with DACAPO_CP environment variable or as DACAPO library')
if not isfile(dacapo) or not dacapo.endswith('.jar'):
mx.abort('Specified DaCapo jar file does not exist or is not a jar file: ' + dacapo)
dacapoSuccess = re.compile(r"^===== DaCapo 9\.12 ([a-zA-Z0-9_]+) PASSED in ([0-9]+) msec =====", re.MULTILINE)
dacapoFail = re.compile(r"^===== DaCapo 9\.12 ([a-zA-Z0-9_]+) FAILED (warmup|) =====", re.MULTILINE)
dacapoTime = re.compile(r"===== DaCapo 9\.12 (?P<benchmark>[a-zA-Z0-9_]+) PASSED in (?P<time>[0-9]+) msec =====")
dacapoTime1 = re.compile(r"===== DaCapo 9\.12 (?P<benchmark>[a-zA-Z0-9_]+) completed warmup 1 in (?P<time>[0-9]+) msec =====")
dacapoMatcher = ValuesMatcher(dacapoTime, {'group' : 'DaCapo', 'name' : '<benchmark>', 'score' : '<time>'})
dacapoMatcher1 = ValuesMatcher(dacapoTime1, {'group' : 'DaCapo-1stRun', 'name' : '<benchmark>', 'score' : '<time>'})
# Use ipv4 stack for dacapos; tomcat+solaris+ipv6_interface fails (see also: JDK-8072384)
return Test("DaCapo-" + name, ['-jar', mx._cygpathU2W(dacapo), name] + _noneAsEmptyList(dacapoArgs), [dacapoSuccess], [dacapoFail],
[dacapoMatcher, dacapoMatcher1],
['-Xms2g', '-XX:+' + gc, '-XX:-UseCompressedOops', "-Djava.net.preferIPv4Stack=true", '-G:+ExitVMOnException'] +
_noneAsEmptyList(extraVmArguments))
示例6: load_optional_suite
def load_optional_suite(name, rev):
hg_base = mx.get_env('MX_HG_BASE')
urlinfos = None if hg_base is None else [mx.SuiteImportURLInfo(join(hg_base, name), 'hg', mx.vc_system('hg'))]
opt_suite = _fastr_suite.import_suite(name, version=rev, urlinfos=urlinfos)
if opt_suite:
mx.build_suite(opt_suite)
return opt_suite
示例7: testdownstream_cli
def testdownstream_cli(args):
"""tests a downstream repo against the current working directory state of the primary suite
Multiple repos can be specified with multiple instances of the -R/--repo option. The
first specified repo is the one being tested. Further repos can be specified to either
override where suites are cloned from or to satisfy --dynamicimports.
"""
parser = ArgumentParser(prog='mx testdownstream')
parser.add_argument('-R', '--repo', dest='repos', action='append', help='URL of downstream repo to clone. First specified repo is the primary repo being tested', required=True, metavar='<url>', default=[])
parser.add_argument('--suitedir', action='store', help='relative directory of suite to test in primary repo (default: . )', default='.', metavar='<path>')
parser.add_argument('--downstream-branch', action='store', help='name of branch to look for in downstream repo(s). '
'Can be specified by DOWNSTREAM_BRANCH environment variable. If not specified, current branch of the primary suite is used.', metavar='<name>')
parser.add_argument('-C', '--mx-command', dest='mxCommands', action='append', help='arguments to an mx command run in primary repo suite (e.g., -C "-v --strict-compliance gate")', default=[], metavar='<args>')
parser.add_argument('-E', '--encoded-space', help='character used to encode a space in an mx command argument. Each instance of this character in an argument will be replaced with a space.', metavar='<char>')
args = parser.parse_args(args)
mxCommands = []
for command in [e.split() for e in args.mxCommands]:
if args.encoded_space:
command = [arg.replace(args.encoded_space, ' ') for arg in command]
mxCommands.append(command)
branch = args.downstream_branch or mx.get_env('DOWNSTREAM_BRANCH', None)
return testdownstream(mx.primary_suite(), args.repos, args.suitedir, mxCommands, branch)
示例8: daCapoPath
def daCapoPath(self):
dacapo = mx.get_env(self.daCapoClasspathEnvVarName())
if dacapo:
return dacapo
lib = mx.library(self.daCapoLibraryName(), False)
if lib:
return lib.get_path(True)
return None
示例9: dacapoPath
def dacapoPath(self):
dacapo = mx.get_env("DACAPO_CP")
if dacapo:
return dacapo
lib = mx.library("DACAPO", False)
if lib:
return lib.get_path(True)
return None
示例10: builder_url
def builder_url():
"""
Get the builders url from the BUILD_URL environment variable, or an empty string otherwise.
:return: the builders url
:rtype: basestring
"""
return mx.get_env("BUILD_URL", default="")
示例11: specJbbClassPath
def specJbbClassPath(self):
specjbb2015 = mx.get_env("SPECJBB2015")
if specjbb2015 is None:
mx.abort("Please set the SPECJBB2015 environment variable to a " +
"SPECjbb2015 directory.")
jbbpath = join(specjbb2015, "specjbb2015.jar")
if not exists(jbbpath):
mx.abort("The SPECJBB2015 environment variable points to a directory " +
"without the specjbb2015.jar file.")
return jbbpath
示例12: specJvmPath
def specJvmPath(self):
specjvm2008 = mx.get_env("SPECJVM2008")
if specjvm2008 is None:
mx.abort("Please set the SPECJVM2008 environment variable to a " +
"SPECjvm2008 directory.")
jarpath = join(specjvm2008, "SPECjvm2008.jar")
if not exists(jarpath):
mx.abort("The SPECJVM2008 environment variable points to a directory " +
"without the SPECjvm2008.jar file.")
return jarpath
示例13: getSPECjbb2005
def getSPECjbb2005(benchArgs = []):
specjbb2005 = mx.get_env('SPECJBB2005')
if specjbb2005 is None or not exists(join(specjbb2005, 'jbb.jar')):
mx.abort('Please set the SPECJBB2005 environment variable to a SPECjbb2005 directory')
score = re.compile(r"^Valid run, Score is (?P<score>[0-9]+)$", re.MULTILINE)
error = re.compile(r"VALIDATION ERROR")
success = re.compile(r"^Valid run, Score is [0-9]+$", re.MULTILINE)
matcher = ValuesMatcher(score, {'group' : 'SPECjbb2005', 'name' : 'score', 'score' : '<score>'})
classpath = ['jbb.jar', 'check.jar']
return Test("SPECjbb2005", ['spec.jbb.JBBmain', '-propfile', 'SPECjbb.props'] + benchArgs, [success], [error], [matcher], vmOpts=['-Xms3g', '-XX:+'+gc, '-XX:-UseCompressedOops', '-cp', os.pathsep.join(classpath)], defaultCwd=specjbb2005)
示例14: getSPECjbb2013
def getSPECjbb2013(benchArgs = []):
specjbb2013 = mx.get_env('SPECJBB2013')
if specjbb2013 is None or not exists(join(specjbb2013, 'specjbb2013.jar')):
mx.abort('Please set the SPECJBB2013 environment variable to a SPECjbb2013 directory')
jops = re.compile(r"^RUN RESULT: hbIR \(max attempted\) = [0-9]+, hbIR \(settled\) = [0-9]+, max-jOPS = (?P<max>[0-9]+), critical-jOPS = (?P<critical>[0-9]+)$", re.MULTILINE)
#error?
success = re.compile(r"org.spec.jbb.controller: Run finished", re.MULTILINE)
matcherMax = ValuesMatcher(jops, {'group' : 'SPECjbb2013', 'name' : 'max', 'score' : '<max>'})
matcherCritical = ValuesMatcher(jops, {'group' : 'SPECjbb2013', 'name' : 'critical', 'score' : '<critical>'})
return Test("SPECjbb2013", ['-jar', 'specjbb2013.jar', '-m', 'composite'] + benchArgs, [success], [], [matcherCritical, matcherMax], vmOpts=['-Xmx6g', '-Xms6g', '-Xmn3g', '-XX:+UseParallelOldGC', '-XX:-UseAdaptiveSizePolicy', '-XX:-UseBiasedLocking', '-XX:-UseCompressedOops'], defaultCwd=specjbb2013)
示例15: load_optional_suite
def load_optional_suite(name, rev, kind='hg', build=True, url=None):
if not url:
hg_base = mx.get_env('MX_' + kind.upper() + '_BASE')
if hg_base is None:
url = None
else:
url = join(hg_base, name)
urlinfos = None if url is None else [mx.SuiteImportURLInfo(url, kind, mx.vc_system(kind))]
opt_suite = _fastr_suite.import_suite(name, version=rev, urlinfos=urlinfos)
if opt_suite and build:
mx.build_suite(opt_suite)
return opt_suite