Esempio n. 1
0
def FindCheckPatch():
    top_level = gitutil.GetTopLevel()
    try_list = [
        os.getcwd(),
        os.path.join(os.getcwd(), '..', '..'),
        os.path.join(top_level, 'tools'),
        os.path.join(top_level, 'scripts'),
        '%s/bin' % os.getenv('HOME'),
    ]
    # Look in current dir
    for path in try_list:
        fname = os.path.join(path, 'checkpatch.pl')
        if os.path.isfile(fname):
            return fname

    # Look upwwards for a Chrome OS tree
    while not os.path.ismount(path):
        fname = os.path.join(path, 'src', 'third_party', 'kernel', 'files',
                             'scripts', 'checkpatch.pl')
        if os.path.isfile(fname):
            return fname
        path = os.path.dirname(path)

    sys.exit('Cannot find checkpatch.pl - please put it in your ' +
             '~/bin directory or use --no-check')
Esempio n. 2
0
def FindGetMaintainer():
    """Look for the get_maintainer.pl script.

    Returns:
        If the script is found we'll return a path to it; else None.
    """
    try_list = [
        os.path.join(gitutil.GetTopLevel(), 'scripts'),
    ]
    # Look in the list
    for path in try_list:
        fname = os.path.join(path, 'get_maintainer.pl')
        if os.path.isfile(fname):
            return fname

    return None
Esempio n. 3
0
def DetectProject():
    """Autodetect the name of the current project.

    This looks for signature files/directories that are unlikely to exist except
    in the given project.

    Returns:
        The name of the project, like "linux" or "u-boot".  Returns "unknown"
        if we can't detect the project.
    """
    top_level = gitutil.GetTopLevel()

    if os.path.exists(os.path.join(top_level, "include", "u-boot")):
        return "u-boot"
    elif os.path.exists(os.path.join(top_level, "kernel")):
        return "linux"

    return "unknown"
Esempio n. 4
0
def FindCheckPatch():
    try_list = [
        os.getcwd(),
        os.path.join(os.getcwd(), '..', '..'),
        os.path.join(gitutil.GetTopLevel(), 'tools'),
        '%s/bin' % os.getenv('HOME'),
    ]
    # Look in current dir
    for path in try_list:
        fname = os.path.join(path, 'checkpatch.pl')
        if os.path.isfile(fname):
            return fname

    # Look upwwards for a Chrome OS tree
    while not os.path.ismount(path):
        fname = os.path.join(path, 'src', 'third_party', 'kernel', 'files',
                             'scripts', 'checkpatch.pl')
        if os.path.isfile(fname):
            return fname
        path = os.path.dirname(path)
    print 'Could not find checkpatch.pl'
    return None