source: anuga_core/source/anuga/utilities/data_audit.py @ 4939

Last change on this file since 4939 was 4939, checked in by ole, 17 years ago

Moved data_audit to utilities

Caching work on Joaquim Luis example

File size: 1.5 KB
Line 
1"""Track IP of data files included in this distribution.
2
3
4"""
5
6from os import remove, walk, sep
7from os.path import join
8
9def identify_data_files(distro_dir):
10    """ Identify potential data files that might violate IP
11    """
12
13    print '---------------------------------------------'
14    print 'Files that need to be assessed for IP issues:'
15    print '---------------------------------------------'
16
17    # Print header
18    dirwidth = 72
19    print '---------------------------------------------'
20    print 'Directory'.ljust(dirwidth), 'File'
21    print '---------------------------------------------'
22
23    # Ignore source code files
24    extensions_to_ignore = ['.py','.c','.h', '.f'] #,'gif']
25
26    # Ignore certain other files
27    files_to_ignore = ['README.txt']
28
29    for dirpath, dirnames, filenames in walk(distro_dir):
30
31        #print 'Searching dir', dirpath
32   
33
34        for filename in filenames:
35
36
37            # Ignore extensions that need no IP check
38            ignore = False
39            for ext in extensions_to_ignore:
40                if filename.endswith(ext):
41                    ignore = True
42
43            if filename in files_to_ignore:
44                ignore = True
45
46            if ignore is False:
47                subdirs = dirpath.split(sep)
48               
49                print join(subdirs[3:],sep).ljust(dirwidth), filename
50       
51
52
53# FIXME (Ole): Here we could put in a check testing if
54# all the files above have a .license file associated with them
55# explaining their origins.
56
Note: See TracBrowser for help on using the repository browser.