Пример #1
0
def _recurse_file(included_files, cmd_options):
    '''
    Parse the file passed in 'included_files', and add the license
    '''
    for f in included_files:
        if os.path.exists(f) and os.path.isfile(f):
            parsefile.parse(f, cmd_options)
        else:
            print "File or directory '%(arg)s' does not exist. It will not be considered." % {'arg': f}
Пример #2
0
def _recurse_file(included_files, cmd_options):
    '''
    Parse the file passed in 'included_files', and add the license
    '''
    for f in included_files:
        if os.path.exists(f) and os.path.isfile(f):
            parsefile.parse(f, cmd_options)
        else:
            print "File or directory '%(arg)s' does not exist. It will not be considered." % {
                'arg': f
            }
Пример #3
0
def _crawl_dir(args, cmd_options, excluded_dirs, cwd=None):
    '''
    Traverse the directories and perform some checks on dir and file names
    '''
    for arg in args:
        if len(excluded_dirs) > 0 and os.path.basename(arg) in excluded_dirs:
            continue

        if hidden_files_pattern.match(os.path.basename(arg)) != None:
            continue

        if cwd != None:
            arg = os.path.join(cwd, arg)

        if os.path.exists(arg):
            if os.path.isfile(arg):
                parsefile.parse(arg, cmd_options)
            elif os.path.isdir(arg):
                _crawl_dir(os.listdir(arg), cmd_options, excluded_dirs, arg)
        else:
            print "File or directory '%(arg)s' does not exist. It will not be considered." % {'arg': arg}
Пример #4
0
def _crawl_dir(args, cmd_options, excluded_dirs, cwd=None):
    '''
    Traverse the directories and perform some checks on dir and file names
    '''
    for arg in args:
        if len(excluded_dirs) > 0 and os.path.basename(arg) in excluded_dirs:
            continue

        if hidden_files_pattern.match(os.path.basename(arg)) != None:
            continue

        if cwd != None:
            arg = os.path.join(cwd, arg)

        if os.path.exists(arg):
            if os.path.isfile(arg):
                parsefile.parse(arg, cmd_options)
            elif os.path.isdir(arg):
                _crawl_dir(os.listdir(arg), cmd_options, excluded_dirs, arg)
        else:
            print "File or directory '%(arg)s' does not exist. It will not be considered." % {
                'arg': arg
            }