本文整理汇总了Python中mx.ensure_dir_exists函数的典型用法代码示例。如果您正苦于以下问题:Python ensure_dir_exists函数的具体用法?Python ensure_dir_exists怎么用?Python ensure_dir_exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ensure_dir_exists函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pullInstallDragonEgg
def pullInstallDragonEgg(args=None):
"""downloads and installs dragonegg (assumes that compatible GCC and G++ versions are installed)"""
toolDir = join(_toolDir, "tools/dragonegg")
mx.ensure_dir_exists(toolDir)
url = "https://lafo.ssw.uni-linz.ac.at/pub/sulong-deps/dragonegg-3.2.src.tar.gz"
localPath = pullsuite(toolDir, [url])
tar(localPath, toolDir)
os.remove(localPath)
if mx.get_os() == "darwin":
gccToolDir = join(_toolDir, "tools/gcc")
url = "https://lafo.ssw.uni-linz.ac.at/pub/sulong-deps/gcc-4.6.4.tar.gz"
localPath = pullsuite(gccToolDir, [url])
tar(localPath, gccToolDir)
os.remove(localPath)
mx.run(
["patch", "-p1", _toolDir + "tools/dragonegg/dragonegg-3.2.src/Makefile", "mx.sulong/dragonegg-mac.patch"]
)
os.environ["GCC"] = getGCC()
os.environ["CXX"] = getGPP()
os.environ["CC"] = getGCC()
pullLLVMBinaries()
os.environ["LLVM_CONFIG"] = findLLVMProgram("llvm-config")
print os.environ["LLVM_CONFIG"]
compileCommand = ["make"]
return mx.run(compileCommand, cwd=_toolDir + "tools/dragonegg/dragonegg-3.2.src")
示例2: get_java_module_info
def get_java_module_info(dist, fatalIfNotModule=False):
"""
Gets the metadata for the module derived from `dist`.
:param JARDistribution dist: a distribution possibly defining a module
:param bool fatalIfNotModule: specifies whether to abort if `dist` does not define a module
:return: None if `dist` does not define a module otherwise a tuple containing
the name of the module, the directory in which the class files
(including module-info.class) for the module are staged and finally
the path to the jar file containing the built module
"""
if dist.suite.getMxCompatibility().moduleDepsEqualDistDeps():
moduleName = getattr(dist, 'moduleName', None)
if not moduleName:
if fatalIfNotModule:
mx.abort('Distribution ' + dist.name + ' does not define a module')
return None
assert len(moduleName) > 0, '"moduleName" attribute of distribution ' + dist.name + ' cannot be empty'
else:
if not get_module_deps(dist):
if fatalIfNotModule:
mx.abort('Module for distribution ' + dist.name + ' would be empty')
return None
moduleName = dist.name.replace('_', '.').lower()
modulesDir = mx.ensure_dir_exists(join(dist.suite.get_output_root(), 'modules'))
moduleDir = mx.ensure_dir_exists(join(modulesDir, moduleName))
moduleJar = join(modulesDir, moduleName + '.jar')
return moduleName, moduleDir, moduleJar
示例3: 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)
示例4: pullLLVMSuite
def pullLLVMSuite(args=None):
"""downloads the official (non Truffle) LLVM test suite"""
mx.ensure_dir_exists(_llvmSuiteDir)
urls = ["https://lafo.ssw.uni-linz.ac.at/pub/sulong-deps/test-suite-3.2.src.tar.gz"]
localPath = pullsuite(_llvmSuiteDir, urls)
tar(localPath, _llvmSuiteDir)
os.remove(localPath)
示例5: pullLifetime
def pullLifetime(args=None):
"""downloads the lifetime reference outputs"""
mx.ensure_dir_exists(_lifetimeReferenceDir)
urls = ["https://lafo.ssw.uni-linz.ac.at/pub/sulong-deps/lifetime-analysis-ref.tar.gz"]
localPath = pullsuite(_lifetimeReferenceDir, urls)
tar(localPath, _lifetimeReferenceDir)
os.remove(localPath)
示例6: pullArgon2
def pullArgon2(args=None):
"""downloads Argon2"""
mx.ensure_dir_exists(_argon2Dir)
urls = ["https://lafo.ssw.uni-linz.ac.at/pub/sulong-deps/20160406.tar.gz"]
localPath = pullsuite(_argon2Dir, urls)
tar(localPath, _argon2Dir, ['phc-winner-argon2-20160406/'], stripLevels=1)
os.remove(localPath)
示例7: pullNWCCSuite
def pullNWCCSuite(args=None):
"""downloads the NWCC test suite"""
mx.ensure_dir_exists(_nwccSuiteDir)
urls = ["https://lafo.ssw.uni-linz.ac.at/pub/sulong-deps/nwcc_0.8.3.tar.gz"]
localPath = pullsuite(_nwccSuiteDir, urls)
tar(localPath, _nwccSuiteDir, ['nwcc_0.8.3/tests/', 'nwcc_0.8.3/test2/'], stripLevels=1)
os.remove(localPath)
示例8: pullLLVMBinaries
def pullLLVMBinaries(args=None):
"""downloads the LLVM binaries"""
toolDir = join(_toolDir, "tools/llvm")
mx.ensure_dir_exists(toolDir)
osStr = mx.get_os()
arch = mx.get_arch()
if osStr == 'windows':
print 'windows currently only supported with cygwin!'
return
elif osStr == 'linux':
if arch == 'amd64':
urls = ['http://lafo.ssw.uni-linz.ac.at/sulong-deps/clang+llvm-3.2-x86_64-linux-ubuntu-12.04.tar.gz',
'http://llvm.org/releases/3.2/clang+llvm-3.2-x86_64-linux-ubuntu-12.04.tar.gz']
else:
urls = ['http://lafo.ssw.uni-linz.ac.at/sulong-deps/clang+llvm-3.2-x86-linux-ubuntu-12.04.tar.gz',
'http://llvm.org/releases/3.2/clang+llvm-3.2-x86-linux-ubuntu-12.04.tar.gz']
elif osStr == 'darwin':
urls = ['http://lafo.ssw.uni-linz.ac.at/sulong-deps/clang+llvm-3.2-x86_64-apple-darwin11.tar.gz',
'http://llvm.org/releases/3.2/clang+llvm-3.2-x86_64-apple-darwin11.tar.gz']
elif osStr == 'cygwin':
urls = ['http://lafo.ssw.uni-linz.ac.at/sulong-deps/clang+llvm-3.2-x86-mingw32-EXPERIMENTAL.tar.gz',
'http://llvm.org/releases/3.2/clang+llvm-3.2-x86-mingw32-EXPERIMENTAL.tar.gz']
else:
print osStr, arch, "not supported!"
localPath = pullsuite(toolDir, urls)
tar(localPath, toolDir, stripLevels=1)
os.remove(localPath)
示例9: _update_JDK9_STUBS_library
def _update_JDK9_STUBS_library():
"""
Sets the "path" and "sha1" attributes of the "JDK9_STUBS" library.
"""
jdk9InternalLib = _suite.suiteDict['libraries']['JDK9_STUBS']
jarInputDir = join(_suite.get_output_root(), 'jdk9-stubs')
jarPath = join(_suite.get_output_root(), 'jdk9-stubs.jar')
stubs = [
('jdk.internal.misc', 'VM', """package jdk.internal.misc;
public class VM {
public static String getSavedProperty(String key) {
throw new InternalError("should not reach here");
}
}
""")
]
if not exists(jarPath):
sourceFiles = []
for (package, className, source) in stubs:
sourceFile = join(jarInputDir, package.replace('.', os.sep), className + '.java')
mx.ensure_dir_exists(os.path.dirname(sourceFile))
with open(sourceFile, 'w') as fp:
fp.write(source)
sourceFiles.append(sourceFile)
jdk = mx.get_jdk(tag='default')
mx.run([jdk.javac, '-d', jarInputDir] + sourceFiles)
mx.run([jdk.jar, 'cf', jarPath, '.'], cwd=jarInputDir)
jdk9InternalLib['path'] = jarPath
jdk9InternalLib['sha1'] = mx.sha1OfFile(jarPath)
示例10: _get_java_module_info
def _get_java_module_info(dist):
assert len(get_module_deps(dist)) != 0
modulesDir = mx.ensure_dir_exists(join(dist.suite.get_output_root(), 'modules'))
moduleName = dist.name.replace('_', '.').lower()
moduleDir = mx.ensure_dir_exists(join(modulesDir, moduleName))
moduleJar = join(modulesDir, moduleName + '.jar')
return moduleName, moduleDir, moduleJar
示例11: jacocoreport
def jacocoreport(args):
"""create a JaCoCo coverage report
Creates the report from the 'jacoco.exec' file in the current directory.
Default output directory is 'coverage', but an alternative can be provided as an argument."""
jacocoreport = mx.library("JACOCOREPORT", True)
out = 'coverage'
if len(args) == 1:
out = args[0]
elif len(args) > 1:
mx.abort('jacocoreport takes only one argument : an output directory')
includes = list(_jacoco_includes)
for p in mx.projects():
projsetting = getattr(p, 'jacoco', '')
if projsetting == 'include' or projsetting == '':
includes.append(p.name)
includedirs = set()
for p in mx.projects():
projsetting = getattr(p, 'jacoco', '')
if projsetting == 'exclude':
continue
for include in includes:
if include in p.dir:
includedirs.add(p.dir)
for i in includedirs:
bindir = i + '/bin'
mx.ensure_dir_exists(bindir)
mx.run_java(['-jar', jacocoreport.get_path(True), '--in', 'jacoco.exec', '--out', out] + sorted(includedirs))
示例12: pullBenchmarkGame
def pullBenchmarkGame(args=None):
"""downloads the benchmarks"""
mx.ensure_dir_exists(_benchGameSuiteDir)
urls = ["https://lafo.ssw.uni-linz.ac.at/pub/sulong-deps/benchmarksgame-scm-latest.tar.gz"]
localPath = pullsuite(_benchGameSuiteDir, urls)
tar(localPath, _benchGameSuiteDir, ['benchmarksgame-2014-08-31/benchmarksgame/bench/'], stripLevels=3)
os.remove(localPath)
renameBenchmarkFiles()
示例13: pullGCCSuite
def pullGCCSuite(args=None):
"""downloads the GCC test suite"""
suiteDir = _gccSuiteDir
mx.ensure_dir_exists(suiteDir)
urls = ["https://lafo.ssw.uni-linz.ac.at/pub/sulong-deps/gcc-5.2.0.tar.gz"]
localPath = pullsuite(suiteDir, urls)
tar(localPath, suiteDir, ['gcc-5.2.0/gcc/testsuite/'])
os.remove(localPath)
示例14: pullNWCCSuite
def pullNWCCSuite(args=None):
"""downloads the NWCC test suite"""
mx.ensure_dir_exists(_nwccSuiteDir)
urls = ["http://lafo.ssw.uni-linz.ac.at/sulong-deps/nwcc_0.8.3.tar.gz",
"http://sourceforge.net/projects/nwcc/files/nwcc/nwcc%200.8.3/nwcc_0.8.3.tar.gz/download"]
localPath = pullsuite(_nwccSuiteDir, urls)
tar(localPath, _nwccSuiteDir, ['nwcc_0.8.3/tests/', 'nwcc_0.8.3/test2/'], stripLevels=1)
os.remove(localPath)
示例15: pullTestSuite
def pullTestSuite(library, destDir, **kwargs):
"""downloads and unpacks a test suite"""
mx.ensure_dir_exists(destDir)
localPath = mx.library(library).get_path(True)
mx_sulong.tar(localPath, destDir, **kwargs)
os.remove(localPath)
sha1Path = localPath + '.sha1'
if os.path.exists(sha1Path):
os.remove(sha1Path)