本文整理汇总了Python中mx.distribution函数的典型用法代码示例。如果您正苦于以下问题:Python distribution函数的具体用法?Python distribution怎么用?Python distribution使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了distribution函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例2: dist
def dist(self):
"""
Gets the `JARDistribution` that creates the Graal module jar.
:rtype: `JARDistribution
"""
return mx.distribution(self._name)
示例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)
示例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
示例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)
示例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)
示例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"
)
示例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
示例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
示例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)
示例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)
示例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
示例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
示例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)
示例15: dist
def dist(self):
return mx.distribution(self._name)