Example #1
0
File: cc.py Project: devnulltao/Xnt
def nvcc(src, flags=None):
    """NVCC: compile CUDA C/C++ programs

    :param src: CUDA source file to compile with default `nvcc`
    :param flags: List of flags to pass onto the compiler
    """
    assert which('nvcc')
    return _gcc(src, flags, compiler='nvcc')
Example #2
0
File: cc.py Project: devnulltao/Xnt
def gpp(src, flags=None):
    """g++ compiler, non-named output file

    :param src: C++ source file to compile with default `g++`
    :param flags: List of flags to pass onto the compiler
    """
    assert which("g++")
    return _gcc(src, flags, "g++")
Example #3
0
File: cc.py Project: devnulltao/Xnt
def nvcc_o(src, output, flags=None):
    """NVCC: compile with named output

    :param src: CUDA source file to compile with default `nvcc`
    :param output: Name of resulting object or executable
    :param flags: List of flags to pass onto the compiler
    """
    assert which('nvcc')
    return _gcc_o(src, output, flags, compiler='nvcc')
Example #4
0
File: cc.py Project: devnulltao/Xnt
def gpp_o(src, output, flags=None):
    """g++ compiler, with output file

    :param src: C++ source file to compile with default `g++`
    :param output: Name of resulting object or executable
    :param flags: List of flags to pass onto the compiler
    """
    assert which("g++")
    return _gcc_o(src, output, flags, "g++")
Example #5
0
File: cc.py Project: devnulltao/Xnt
def javac(src, flags=None):
    """Javac: compile Java programs

    :param src: Java source file to compile with default `javac`
    :param flags: List of flags to pass onto the compiler
    """
    assert which("javac")
    LOGGER.info("Compiling %s", src)
    cmd = __generate_command(src, flags, "javac")
    return __compile(cmd)
Example #6
0
def cvsupdate(path):
    """Run CVS Update

    :param path: Directory path to module to update
    """
    assert which("cvs")
    cwd = os.path.abspath(os.getcwd())
    os.chdir(path)
    cmd = ["cvs", "update"]
    subprocess.call(cmd)
    os.chdir(cwd)
Example #7
0
def cvsco(module, rev="", dest=""):
    """Run CVS Checkout

    :param module: CVS Module name to checkout
    :param rev: Revision to checkout
    :param dest: Destination directory or name of checked out module
    """
    assert which("cvs")
    cmd = ["cvs", "co", "-P"]
    if rev:
        cmd.append("-r")
        cmd.append(rev)
    if dest:
        cmd.append("-d")
        cmd.append(dest)
    cmd.append(module)
    subprocess.call(cmd)
Example #8
0
def make(target, path="", flags=None, pkeys=None, pvalues=None):
    """Wrapper around GNU Make

    Invoke Gnu Make (*make*) in either the current working directory or the
    specified directory using the specified target, passing a list of *flags*
    to the invocation. Where *flags* is a list of valid flags for *make*.

    `pkeys` and `pvalues` are zipped together to form a key/value pair that are
    passed to Make as property values.

    :param target: Make Target to execute
    :param path: Path of the make file if different than current directory
    :param flags: List of flags to pass to make
    :param pkeys: List of keys, zipped with pvalues, to pass to Make
    :param pvalues: List of values, zipped with pkeys, to pass to Make
    """
    assert which("make")
    cmd = __add_params(["make"], __build_param_list(pkeys, pvalues))
    cmd = __add_flags(cmd, flags)
    cmd.append(target)
    return __run_in(path, lambda: subprocess.call(cmd))
Example #9
0
def nant(target, path="", flags=None, pkeys=None, pvalues=None):
    """Wrapper around .NET Ant

    Invoke NAnt in either the current working directory or the specified
    directory using the specified target, passing a list of *flags* to the
    invocation. Where *flags* is a list of valid flags for *nant*.

    `pkeys` and `pvalues` are zipped together to form a key/ value pair to pass
    to NAnt as property values.

    :param target: NAnt Target to execute
    :param path: Path of NAnt build file, if different than current directory
    :param flags: List of flags to pass to NAnt
    :param pkeys: List of keys, zipped with pvalues, to pass to NAnt
    :param pvalues: List of values, zipped with pkeys, to pass to NAnt
    """
    assert which("nant")
    cmd = __add_params(["nant"],
                        __build_param_list(pkeys, pvalues),
                        lambda x: "-D:%s" % x)
    cmd = __add_flags(cmd, flags)
    cmd.append(target)
    return __run_in(path, lambda: subprocess.call(cmd))