本文整理汇总了Python中mx.get_env函数的典型用法代码示例。如果您正苦于以下问题:Python get_env函数的具体用法?Python get_env怎么用?Python get_env使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_env函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
开发者ID:graalvm,项目名称:truffle,代码行数:32,代码来源:mx_graaltest.py
示例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.")
开发者ID:graalvm,项目名称:sulong,代码行数:7,代码来源:mx_sulong.py
示例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
开发者ID:anukat2015,项目名称:fastr,代码行数:25,代码来源:mx_fastr.py
示例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()
开发者ID:NeilBryant,项目名称:sulong,代码行数:28,代码来源:mx_sulong.py
示例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))
开发者ID:woess,项目名称:graal-core,代码行数:25,代码来源:sanitycheck.py
示例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
开发者ID:chumer,项目名称:fastr,代码行数:7,代码来源:mx_fastr.py
示例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)
开发者ID:graalvm,项目名称:mx,代码行数:25,代码来源:mx_downstream.py
示例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
开发者ID:gilles-duboscq,项目名称:graal-core,代码行数:8,代码来源:mx_graal_benchmark.py
示例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
开发者ID:Prototype1,项目名称:graal-core,代码行数:8,代码来源:mx_graal_benchmark.py
示例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="")
开发者ID:graalvm,项目名称:mx,代码行数:8,代码来源:mx_benchmark.py
示例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
开发者ID:gilles-duboscq,项目名称:graal-core,代码行数:10,代码来源:mx_graal_benchmark.py
示例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
开发者ID:gilles-duboscq,项目名称:graal-core,代码行数:10,代码来源:mx_graal_benchmark.py
示例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)
开发者ID:pombreda,项目名称:graal,代码行数:12,代码来源:sanitycheck.py
示例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)
开发者ID:pombreda,项目名称:graal,代码行数:12,代码来源:sanitycheck.py
示例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
开发者ID:anukat2015,项目名称:fastr,代码行数:12,代码来源:mx_fastr.py
示例16: getSPECjvm2008
def getSPECjvm2008(benchArgs=[]):
specjvm2008 = mx.get_env('SPECJVM2008')
if specjvm2008 is None or not exists(join(specjvm2008, 'SPECjvm2008.jar')):
mx.abort('Please set the SPECJVM2008 environment variable to a SPECjvm2008 directory')
score = re.compile(r"^(Score on|Noncompliant) (?P<benchmark>[a-zA-Z0-9\._]+)( result)?: (?P<score>[0-9]+((,|\.)[0-9]+)?)( SPECjvm2008 Base)? ops/m$", re.MULTILINE)
error = re.compile(r"^Errors in benchmark: ", re.MULTILINE)
# The ' ops/m' at the end of the success string is important : it's how you can tell valid and invalid runs apart
success = re.compile(r"^(Noncompliant c|C)omposite result: [0-9]+((,|\.)[0-9]+)?( SPECjvm2008 (Base|Peak))? ops/m$", re.MULTILINE)
matcher = ValuesMatcher(score, {'group' : 'SPECjvm2008', 'name' : '<benchmark>', 'score' : '<score>'})
return Test("SPECjvm2008", ['-jar', 'SPECjvm2008.jar'] + benchArgs, [success], [error], [matcher], vmOpts=['-Xms3g', '-XX:+'+gc, '-XX:-UseCompressedOops'], defaultCwd=specjvm2008)
开发者ID:pombreda,项目名称:graal,代码行数:13,代码来源:sanitycheck.py
示例17: build_number
def build_number():
"""
Get the current build number from the BUILD_NUMBER environment variable. If BUILD_NUMBER is not set or not a number,
a default of -1 is returned.
:return: the build number
:rtype: int
"""
build_num = mx.get_env("BUILD_NUMBER", default="-1")
try:
return int(build_num)
except ValueError:
mx.logv("Could not parse the build number from BUILD_NUMBER. Expected int, instead got: {0}".format(build_num))
return -1
开发者ID:graalvm,项目名称:mx,代码行数:14,代码来源:mx_benchmark.py
示例18: findbugs
def findbugs(args, fbArgs=None, suite=None, projects=None):
"""run FindBugs against non-test Java projects"""
findBugsHome = mx.get_env('FINDBUGS_HOME', None)
if suite is None:
suite = mx._primary_suite
if findBugsHome:
findbugsJar = join(findBugsHome, 'lib', 'findbugs.jar')
else:
findbugsLib = join(mx._mx_suite.get_output_root(), 'findbugs-3.0.0')
if not exists(findbugsLib):
tmp = tempfile.mkdtemp(prefix='findbugs-download-tmp', dir=mx._mx_suite.dir)
try:
findbugsDist = mx.library('FINDBUGS_DIST').get_path(resolve=True)
with zipfile.ZipFile(findbugsDist) as zf:
candidates = [e for e in zf.namelist() if e.endswith('/lib/findbugs.jar')]
assert len(candidates) == 1, candidates
libDirInZip = os.path.dirname(candidates[0])
zf.extractall(tmp)
shutil.copytree(join(tmp, libDirInZip), findbugsLib)
finally:
shutil.rmtree(tmp)
findbugsJar = join(findbugsLib, 'findbugs.jar')
assert exists(findbugsJar)
nonTestProjects = [p for p in mx.projects() if _should_test_project(p)]
if not nonTestProjects:
return 0
outputDirs = map(mx._cygpathU2W, [p.output_dir() for p in nonTestProjects])
javaCompliance = max([p.javaCompliance for p in nonTestProjects])
jdk = mx.get_jdk(javaCompliance)
if jdk.javaCompliance >= "1.9":
mx.log('FindBugs does not yet support JDK9 - skipping')
return 0
findbugsResults = join(suite.dir, 'findbugs.results')
if fbArgs is None:
fbArgs = defaultFindbugsArgs()
cmd = ['-jar', mx._cygpathU2W(findbugsJar)] + fbArgs
cmd = cmd + ['-auxclasspath', mx._separatedCygpathU2W(mx.classpath([p.name for p in nonTestProjects], jdk=jdk)), '-output', mx._cygpathU2W(findbugsResults), '-exitcode'] + args + outputDirs
exitcode = mx.run_java(cmd, nonZeroIsFatal=False, jdk=jdk)
if exitcode != 0:
with open(findbugsResults) as fp:
mx.log(fp.read())
os.unlink(findbugsResults)
return exitcode
开发者ID:graalvm,项目名称:mx,代码行数:45,代码来源:mx_findbugs.py
示例19: hsdis
def hsdis(args, copyToDir=None):
"""download the hsdis library
This is needed to support HotSpot's assembly dumping features.
By default it downloads the Intel syntax version, use the 'att' argument to install AT&T syntax."""
flavor = None
if mx.get_arch() == "amd64":
flavor = mx.get_env('HSDIS_SYNTAX')
if flavor is None:
flavor = 'intel'
if 'att' in args:
flavor = 'att'
libpattern = mx.add_lib_suffix('hsdis-' + mx.get_arch() + '-' + mx.get_os() + '-%s')
sha1s = {
'att/hsdis-amd64-windows-%s.dll' : 'bcbd535a9568b5075ab41e96205e26a2bac64f72',
'att/hsdis-amd64-linux-%s.so' : '36a0b8e30fc370727920cc089f104bfb9cd508a0',
'att/hsdis-amd64-darwin-%s.dylib' : 'c1865e9a58ca773fdc1c5eea0a4dfda213420ffb',
'intel/hsdis-amd64-windows-%s.dll' : '6a388372cdd5fe905c1a26ced614334e405d1f30',
'intel/hsdis-amd64-linux-%s.so' : '0d031013db9a80d6c88330c42c983fbfa7053193',
'intel/hsdis-amd64-darwin-%s.dylib' : '67f6d23cbebd8998450a88b5bef362171f66f11a',
'hsdis-sparcv9-solaris-%s.so': '970640a9af0bd63641f9063c11275b371a59ee60',
'hsdis-sparcv9-linux-%s.so': '0c375986d727651dee1819308fbbc0de4927d5d9',
}
if flavor:
flavoredLib = flavor + "/" + libpattern
else:
flavoredLib = libpattern
if flavoredLib not in sha1s:
mx.warn("hsdis with flavor '{}' not supported on this plattform or architecture".format(flavor))
return
sha1 = sha1s[flavoredLib]
lib = flavoredLib % (sha1)
path = join(_suite.get_output_root(), lib)
if not exists(path):
sha1path = path + '.sha1'
mx.download_file_with_sha1('hsdis', path, ['https://lafo.ssw.uni-linz.ac.at/pub/hsdis/' + lib], sha1, sha1path, True, True, sources=False)
if copyToDir is not None and exists(copyToDir):
destFileName = mx.add_lib_suffix('hsdis-' + mx.get_arch())
mx.logv('Copying {} to {}'.format(path, copyToDir + os.sep + destFileName))
shutil.copy(path, copyToDir + os.sep + destFileName)
开发者ID:JervenBolleman,项目名称:graal-core,代码行数:44,代码来源:mx_graal_tools.py
示例20: jackpot
def jackpot(args, suite=None, nonZeroIsFatal=False):
"""run Jackpot 3.0 against non-test Java projects"""
jackpotHome = mx.get_env('JACKPOT_HOME', None)
if jackpotHome:
jackpotJar = join(jackpotHome, 'jackpot.jar')
else:
jackpotJar = mx.library('JACKPOT').get_path(resolve=True)
assert exists(jackpotJar)
if suite is None:
suite = mx._primary_suite
nonTestProjects = [p for p in mx.projects() if _should_test_project(p)]
if not nonTestProjects:
return 0
groups = []
for p in nonTestProjects:
javacClasspath = []
deps = []
p.walk_deps(visit=lambda dep, edge: deps.append(dep) if dep.isLibrary() or dep.isJavaProject() else None)
annotationProcessorOnlyDeps = []
if len(p.annotation_processors()) > 0:
for apDep in p.annotation_processors():
if not apDep in deps:
deps.append(apDep)
annotationProcessorOnlyDeps.append(apDep)
for dep in deps:
if dep == p:
continue
if dep in annotationProcessorOnlyDeps:
continue
javacClasspath.append(dep.classpath_repr(resolve=True))
javaCompliance = p.javaCompliance
groups = groups + ['--group', "--classpath " + mx._separatedCygpathU2W(_escape_string(os.pathsep.join(javacClasspath))) + " --source " + str(p.javaCompliance) + " " + " ".join([_escape_string(d) for d in p.source_dirs()])]
cmd = ['-classpath', mx._cygpathU2W(jackpotJar), 'org.netbeans.modules.jackpot30.cmdline.Main']
cmd = cmd + ['--fail-on-warnings', '--progress'] + args + groups
return mx.run_java(cmd, nonZeroIsFatal=nonZeroIsFatal, jdk=mx.get_jdk(javaCompliance))
开发者ID:charig,项目名称:mx,代码行数:43,代码来源:mx_jackpot.py
注:本文中的mx.get_env函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论