当前位置: 首页>>代码示例>>Python>>正文


Python mx.ensure_dir_exists函数代码示例

本文整理汇总了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")
开发者ID:graalvm,项目名称:sulong,代码行数:25,代码来源:mx_sulong.py

示例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
开发者ID:graalvm,项目名称:mx,代码行数:29,代码来源:mx_javamodules.py

示例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)
开发者ID:graalvm,项目名称:truffle,代码行数:32,代码来源:mx_graaltest.py

示例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)
开发者ID:lxp,项目名称:sulong,代码行数:7,代码来源:mx_sulong.py

示例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)
开发者ID:lxp,项目名称:sulong,代码行数:7,代码来源:mx_sulong.py

示例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)
开发者ID:dailypips,项目名称:sulong,代码行数:7,代码来源:mx_sulong.py

示例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)
开发者ID:lxp,项目名称:sulong,代码行数:7,代码来源:mx_sulong.py

示例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)
开发者ID:bjfish,项目名称:sulong,代码行数:27,代码来源:mx_sulong.py

示例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)
开发者ID:campolake,项目名称:openjdk9,代码行数:32,代码来源:mx_jvmci.py

示例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
开发者ID:christhalinger,项目名称:mx,代码行数:7,代码来源:mx_javamodules.py

示例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))
开发者ID:christianwimmer,项目名称:mx,代码行数:33,代码来源:mx_gate.py

示例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()
开发者ID:lxp,项目名称:sulong,代码行数:8,代码来源:mx_sulong.py

示例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)
开发者ID:lxp,项目名称:sulong,代码行数:8,代码来源:mx_sulong.py

示例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)
开发者ID:bjfish,项目名称:sulong,代码行数:8,代码来源:mx_sulong.py

示例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)
开发者ID:graalvm,项目名称:sulong,代码行数:9,代码来源:testsuites.py


注:本文中的mx.ensure_dir_exists函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。