本文整理汇总了Python中mx.distribution函数的典型用法代码示例。如果您正苦于以下问题:Python distribution函数的具体用法?Python distribution怎么用?Python distribution使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了distribution函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test
def test(args):
"""run some or all of the Maxine tests
The Maxine sources include a variety of tests that can be run by a
special launcher. These include JUnit tests, VM micro tests, certain
benchmark suites and output comparison tests, amongst others.
Use "mx test -help" to see what other options this command accepts."""
maxineTesterDir = join(_maxine_home, 'maxine-tester')
if isdir(maxineTesterDir):
for root, _, files in os.walk(maxineTesterDir):
for name in files:
if name.rsplit(', ', 1) in ['stdout', 'stderr', 'passed', 'failed', 'command']:
os.remove(join(root, name))
else:
os.mkdir(maxineTesterDir)
class Tee:
def __init__(self, f):
self.f = f
def eat(self, line):
mx.log(line.rstrip())
self.f.write(line)
console = join(maxineTesterDir, 'console')
with open(console, 'w', 0) as f:
tee = Tee(f)
java = mx.java()
mx.run_java(['-cp', sanitized_classpath(), 'test.com.sun.max.vm.MaxineTester', '-output-dir=maxine-tester',
'-graal-jar=' + mx.distribution('GRAAL').path,
'-refvm=' + java.java, '-refvm-args=' + ' '.join(java.java_args)] + args, out=tee.eat, err=subprocess.STDOUT)
开发者ID:arshcaria,项目名称:maxine-aarch64,代码行数:31,代码来源:commands.py
示例2: dist
def dist(self):
"""
Gets the `JARDistribution` that creates the Graal module jar.
:rtype: `JARDistribution
"""
return mx.distribution(self._name)
开发者ID:gilles-duboscq,项目名称:graal-core,代码行数:7,代码来源:mx_graal_core.py
示例3: _unittest_config_participant
def _unittest_config_participant(config):
vmArgs, mainClass, mainClassArgs = config
cpIndex, cp = mx.find_classpath_arg(vmArgs)
if cp:
cp = _uniqify(cp.split(os.pathsep))
if isJDK8:
# Remove entries from class path that are in Graal or on the boot class path
redundantClasspathEntries = set()
for dist in [entry.dist() for entry in _jvmci_classpath]:
redundantClasspathEntries.update((d.output_dir() for d in dist.archived_deps() if d.isJavaProject()))
redundantClasspathEntries.add(dist.path)
cp = os.pathsep.join([e for e in cp if e not in redundantClasspathEntries])
vmArgs[cpIndex] = cp
else:
redundantClasspathEntries = set()
for dist in [entry.dist() for entry in _jvmci_classpath] + _bootclasspath_appends:
redundantClasspathEntries.update(mx.classpath(dist, preferProjects=False, jdk=jdk).split(os.pathsep))
redundantClasspathEntries.update(mx.classpath(dist, preferProjects=True, jdk=jdk).split(os.pathsep))
if hasattr(dist, 'overlaps'):
for o in dist.overlaps:
path = mx.distribution(o).classpath_repr()
if path:
redundantClasspathEntries.add(path)
# Remove entries from the class path that are in the deployed modules
cp = [classpathEntry for classpathEntry in cp if classpathEntry not in redundantClasspathEntries]
vmArgs[cpIndex] = os.pathsep.join(cp)
if isJDK8:
# Run the VM in a mode where application/test classes can
# access JVMCI loaded classes.
vmArgs.append('-XX:-UseJVMCIClassLoader')
return (vmArgs, mainClass, mainClassArgs)
开发者ID:mur47x111,项目名称:graal-core,代码行数:34,代码来源:mx_graal_core.py
示例4: mx_post_parse_cmd_line
def mx_post_parse_cmd_line(opts):
mx.add_ide_envvar('JVMCI_VERSION_CHECK')
for dist in _suite.dists:
dist.set_archiveparticipant(GraalArchiveParticipant(dist, isTest=dist.name.endswith('_TEST')))
add_bootclasspath_append(mx.distribution('truffle:TRUFFLE_API'))
global _vm_prefix
_vm_prefix = opts.vm_prefix
开发者ID:emrul,项目名称:graal-core,代码行数:7,代码来源:mx_graal_core.py
示例5: _unittest_config_participant
def _unittest_config_participant(config):
"""modifies the classpath to use the Sulong distribution jars instead of the classfiles to enable the use of Java's ServiceLoader"""
(vmArgs, mainClass, mainClassArgs) = config
cpIndex, _ = mx.find_classpath_arg(vmArgs)
junitCp = mx.classpath("com.oracle.mxtool.junit")
sulongCp = ':'.join([mx.classpath(mx.distribution(distr), jdk=mx.get_jdk(tag='jvmci')) for distr in sulongDistributions])
vmArgs[cpIndex] = junitCp + ":" + sulongCp
return (vmArgs, mainClass, mainClassArgs)
开发者ID:lxp,项目名称:sulong,代码行数:8,代码来源:mx_sulong.py
示例6: unittest_use_distribution_jars
def unittest_use_distribution_jars(config):
"""use the distribution jars instead of the class files"""
vmArgs, mainClass, mainClassArgs = config
cpIndex, _ = mx.find_classpath_arg(vmArgs)
junitCP = [mx.classpath("com.oracle.mxtool.junit")]
rubyCP = [mx.classpath(mx.distribution(distr)) for distr in rubyDists]
vmArgs[cpIndex] = ":".join(junitCP + rubyCP)
return (vmArgs, mainClass, mainClassArgs)
开发者ID:graalvm,项目名称:jrubytruffle,代码行数:8,代码来源:mx_jruby.py
示例7: getRemoteClasspathOption
def getRemoteClasspathOption():
return (
"-Dsulong.TestRemoteBootPath=-Xbootclasspath/p:"
+ mx.distribution("truffle:TRUFFLE_API").path
+ " "
+ getLLVMRootOption()
+ " "
+ compilationSucceedsOption()
+ " -XX:-UseJVMCIClassLoader -Dsulong.Debug=false -Djvmci.Compiler=graal"
)
开发者ID:graalvm,项目名称:sulong,代码行数:10,代码来源:mx_sulong.py
示例8: native_image_distributions
def native_image_distributions():
deps = [mx.distribution('GRAAL_MANAGEMENT')]
for d in svm_suite().dists:
if isinstance(d, str):
name = d
else:
name = d.name
if name.startswith("NATIVE_IMAGE"):
deps.append(d)
return deps
开发者ID:charig,项目名称:truffle,代码行数:10,代码来源:mx_substratevm.py
示例9: setup_jruby_home
def setup_jruby_home():
rubyZip = mx.distribution('RUBY-ZIP').path
assert exists(rubyZip)
extractPath = join(_suite.dir, 'mxbuild', 'ruby-zip-extracted')
if TimeStampFile(extractPath).isOlderThan(rubyZip):
if exists(extractPath):
shutil.rmtree(extractPath)
extractTarball(rubyZip, extractPath)
env = os.environ.copy()
env['JRUBY_HOME'] = extractPath
return env
开发者ID:grddev,项目名称:jruby,代码行数:11,代码来源:mx_jruby.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
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
示例11: _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
示例12: load
def load(dist, jdk):
"""
Unpickles the module descriptor corresponding to a given distribution.
:param str dist: the distribution for which to read the pickled object
:param JDKConfig jdk: used to resolve pickled references to JDK modules
"""
_, moduleDir, _ = get_java_module_info(dist, fatalIfNotModule=True) # pylint: disable=unpacking-non-sequence
path = moduleDir + '.pickled'
if not exists(path):
mx.abort(path + ' does not exist')
with open(path, 'rb') as fp:
jmd = pickle.load(fp)
jdkmodules = {m.name: m for m in jdk.get_modules()}
resolved = []
for name in jmd.modulepath:
if name.startswith('dist:'):
distName = name[len('dist:'):]
resolved.append(as_java_module(mx.distribution(distName), jdk))
else:
resolved.append(jdkmodules[name])
jmd.modulepath = resolved
jmd.dist = mx.distribution(jmd.dist)
return jmd
开发者ID:graalvm,项目名称:mx,代码行数:24,代码来源:mx_javamodules.py
示例13: _alldeps
def _alldeps(args):
parser = ArgumentParser(prog='mx mxt-alldeps')
parser.add_argument('--kind', action='store', help='project, dist or library', default='project')
parser.add_argument('--name', action='store', help='name of entity', required=True)
parser.add_argument('--includeLibs', action='store_true', help='includeLibs')
parser.add_argument('--ignoreSelf', action='store_true', help='ignoreSelf')
args = parser.parse_args(args)
entity = None
if args.kind == 'project':
entity = mx.project(args.name)
elif args.kind == 'library':
entity = mx.library(args.name)
elif args.kind == 'dist':
entity = mx.distribution(args.name)
else:
mx.abort('illegal kind: ' + args.kind)
in_deps = []
deps = entity.all_deps(in_deps, includeLibs=args.includeLibs, includeSelf=not args.ignoreSelf)
print 'alldeps:'
for d in deps:
print d.__class__.__name__, ":", d.name
开发者ID:axel22,项目名称:mx,代码行数:22,代码来源:mx_mxtests.py
示例14: _unittest_config_participant
def _unittest_config_participant(config):
vmArgs, mainClass, mainClassArgs = config
cpIndex, cp = mx.find_classpath_arg(vmArgs)
if cp:
cp = _uniqify(cp.split(os.pathsep))
if isJDK8:
# Remove entries from class path that are in Graal or on the boot class path
redundantClasspathEntries = set()
for dist in [entry.dist() for entry in _jvmci_classpath]:
redundantClasspathEntries.update((d.output_dir() for d in dist.archived_deps() if d.isJavaProject()))
redundantClasspathEntries.add(dist.path)
cp = os.pathsep.join([e for e in cp if e not in redundantClasspathEntries])
vmArgs[cpIndex] = cp
else:
deployedModules = []
redundantClasspathEntries = set()
for dist in [entry.dist() for entry in _jvmci_classpath] + _bootclasspath_appends:
deployedModule = as_java_module(dist, jdk)
deployedModules.append(deployedModule)
redundantClasspathEntries.update(mx.classpath(dist, preferProjects=False, jdk=jdk).split(os.pathsep))
redundantClasspathEntries.update(mx.classpath(dist, preferProjects=True, jdk=jdk).split(os.pathsep))
if hasattr(dist, 'overlaps'):
for o in dist.overlaps:
path = mx.distribution(o).classpath_repr()
if path:
redundantClasspathEntries.add(path)
# Remove entries from the class path that are in the deployed modules
cp = [classpathEntry for classpathEntry in cp if classpathEntry not in redundantClasspathEntries]
vmArgs[cpIndex] = os.pathsep.join(cp)
# Junit libraries are made into automatic modules so that they are visible to tests
# patched into modules. These automatic modules must be declared to be read by
# Graal which means they must also be made root modules (i.e., ``--add-modules``)
# since ``--add-reads`` can only be applied to root modules.
junitCp = [e.classpath_repr() for e in mx.classpath_entries(['JUNIT'])]
junitModules = [_automatic_module_name(e) for e in junitCp]
vmArgs.append('--module-path=' + os.pathsep.join(junitCp))
vmArgs.append('--add-modules=' + ','.join(junitModules + [m.name for m in deployedModules]))
for deployedModule in deployedModules:
vmArgs.append('--add-reads=' + deployedModule.name + '=' + ','.join(junitModules))
# Explicitly export concealed JVMCI packages required by Graal. Even though
# normally exported via jdk.vm.ci.services.Services.exportJVMCITo(), the
# Junit harness wants to access JVMCI classes (e.g., when loading classes
# to find test methods) without going through that entry point.
addedExports = {}
for deployedModule in deployedModules:
for concealingModule, packages in deployedModule.concealedRequires.iteritems():
if concealingModule == 'jdk.vm.ci':
for package in packages:
addedExports.setdefault(concealingModule + '/' + package, set()).add(deployedModule.name)
pathToDep = {p.output_dir() if p.isJavaProject() else p.path: p for p in mx.dependencies() if p.isJavaProject() or p.isJARDistribution()}
for classpathEntry in cp:
# Export concealed packages used by the class path entry
_add_exports_for_concealed_packages(classpathEntry, pathToDep, addedExports, 'ALL-UNNAMED', deployedModules)
for deployedModule in deployedModules:
assert deployedModule.dist.path != classpathEntry, deployedModule.dist.path + ' should no longer be on the class path'
# Ensure the class path entry does not define packages already defined by the module.
# Packages definitions cannot be split between modules.
classpathEntryPackages = frozenset(_defined_packages(classpathEntry))
intersection = classpathEntryPackages.intersection(deployedModule.packages)
if intersection:
mx.abort(classpathEntry + ' cannot extend package(s) defined in the module ' + deployedModule.name + ': ' + ', '.join(intersection))
vmArgs.extend(['--add-exports=' + export + '=' + ','.join(sorted(targets)) for export, targets in addedExports.iteritems()])
if isJDK8:
# Run the VM in a mode where application/test classes can
# access JVMCI loaded classes.
vmArgs.append('-XX:-UseJVMCIClassLoader')
return (vmArgs, mainClass, mainClassArgs)
开发者ID:graalvm,项目名称:graal-core,代码行数:75,代码来源:mx_graal_core.py
示例15: dist
def dist(self):
return mx.distribution(self._name)
开发者ID:Prototype1,项目名称:graal-core,代码行数:2,代码来源:mx_graal_9.py
示例16: inspect
def inspect(args):
"""launch a given program under the Inspector
Run Maxine under the Inspector. The arguments accepted by this command
are those accepted by the 'mx vm' command plus the Inspector specific
options. To debug a program in the Inspector, simply replace 'vm' on the
command line that launches the program with 'inspect'.
Use "mx inspect --help" to see what the Inspector options are. These options
must be specified with a '--' prefix so that they can be distinguished from
the VM options.
The inspect command also accepts the same system property related options
as the 'image' command except that a '--' prefix must be used (e.g.
'--os Darwin --bits 32'). Use "mx help image" for more detail.
Use "mx vm -help" to see what the VM options are."""
saveClassDir = join(_vmdir, 'inspected_classes')
maxvmOptions = os.getenv('MAXVM_OPTIONS', '').split()
vmArgs = ['-XX:SaveClassDir=' + saveClassDir, '-XX:+TrapOnError'] + maxvmOptions
insArgs = ['-vmdir=' + _vmdir]
if not isdir(saveClassDir):
os.makedirs(saveClassDir)
sysProps = []
sysProps += ['-Xbootclasspath/a:' + mx.distribution('GRAAL').path]
insCP = []
cwdArgs = check_cwd_change(args)
cwd = cwdArgs[0]
args = cwdArgs[1]
i = 0
remote = False
while i < len(args):
arg = args[i]
if arg.startswith('-XX:LogFile='):
logFile = arg.split('=', 1)[1]
vmArgs += [arg]
os.environ['TELE_LOG_FILE'] = 'tele-' + logFile
elif arg in ['-cp', '-classpath']:
vmArgs += [arg, args[i + 1]]
insCP += [mx.expand_project_in_class_path_arg(args[i + 1])]
i += 1
elif arg == '-jar':
vmArgs += ['-jar', args[i + 1]]
insCP += [args[i + 1]]
i += 1
elif arg == '--remote':
remote = True
elif arg in ['--platform', '--cpu', '--isa', '--os', '--endianness', '--bits', '--page', '--nsig']:
name = arg.lstrip('-')
i += 1
value = args[i]
sysProps += ['-Dmax.' + name + '=' + value]
elif arg.startswith('--cp='):
insCP += [arg[len('--cp='):]]
elif arg.startswith('--'):
# chomp leading '-'
insArgs += [arg[1:]]
elif arg.startswith('-XX:SaveClassDir='):
vmArgs += [arg]
saveClassDir = arg.split('=', 1)[1]
if not isdir(saveClassDir):
os.makedirs(saveClassDir)
elif arg.startswith('-'):
vmArgs += [arg]
else:
# This is the main class argument; copy it and any following
# arguments to the VM verbatim
vmArgs += args[i:]
break
i += 1
insCP += [saveClassDir]
insCP = pathsep.join(insCP)
insArgs += ['-cp=' + insCP]
mx.expand_project_in_args(vmArgs)
cmd = mx.java().format_cmd(sysProps + ['-cp', sanitized_classpath() + pathsep + insCP, 'com.sun.max.ins.MaxineInspector'] +
insArgs + ['-a=' + ' '.join(vmArgs)])
if mx.get_os() == 'darwin' and not remote:
# The -E option propagates the environment variables into the sudo process
mx.run(['sudo', '-E', '-p', 'Debugging is a privileged operation on Mac OS X.\nPlease enter your "sudo" password:'] + cmd, cwd=cwd)
else:
mx.run(cmd, cwd=cwd)
开发者ID:arshcaria,项目名称:maxine-aarch64,代码行数:88,代码来源:commands.py
示例17: getClasspathOptions
def getClasspathOptions():
"""gets the classpath of the Sulong distributions"""
return [
"-cp",
":".join([mx.classpath(mx.distribution(distr), jdk=mx.get_jdk(tag="jvmci")) for distr in sulongDistributions]),
]
开发者ID:graalvm,项目名称:sulong,代码行数:6,代码来源:mx_sulong.py
示例18: dist
def dist(self):
"""
Gets the `JARDistribution` deployed on the JVMCI class path.
"""
return mx.distribution(self._name)
开发者ID:emrul,项目名称:graal-core,代码行数:5,代码来源:mx_graal_core.py
示例19: mx_post_parse_cmd_line
def mx_post_parse_cmd_line(opts):
add_bootclasspath_prepend(mx.distribution('truffle:TRUFFLE_API'))
开发者ID:axel22,项目名称:graal-core,代码行数:2,代码来源:mx_graal_8.py
示例20: mx_post_parse_cmd_line
def mx_post_parse_cmd_line(opts):
for dist in _suite.dists:
dist.set_archiveparticipant(GraalArchiveParticipant(dist, isTest=dist.name.endswith('_TEST')))
add_bootclasspath_append(mx.distribution('truffle:TRUFFLE_API'))
开发者ID:gilles-duboscq,项目名称:graal-core,代码行数:4,代码来源:mx_graal_core.py
注:本文中的mx.distribution函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论