Changeset 4941
- Timestamp:
- Jan 15, 2008, 8:57:07 PM (17 years ago)
- Location:
- anuga_core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/clean_all.py
r3772 r4941 16 16 '.pyc', # Python 17 17 '.o', '.so', '.dll', # C 18 '.aux', '.ps'] # LaTeX 18 '.aux', '.ps', # LaTeX 19 '.sww'] 19 20 20 21 filenames_to_delete = [] -
anuga_core/source/anuga/utilities/data_audit.py
r4939 r4941 1 1 """Track IP of data files included in this distribution. 2 3 4 2 """ 5 3 6 4 from os import remove, walk, sep 7 from os.path import join 5 from os.path import join, splitext 8 6 9 def identify_data_files(distro_dir): 10 """ Identify potential data files that might violate IP 7 8 def IP_verified(directory): 9 """Find and audit potential data files that might violate IP 10 11 This is the public function to be used to ascertain that 12 all data in the specified directory tree has been audited according 13 to the GA data IP tracking process. 14 15 if IP_verified is False: 16 # Stop and take remedial action 17 ... 18 else: 19 # Proceed boldly with confidence 20 21 11 22 """ 12 23 … … 18 29 dirwidth = 72 19 30 print '---------------------------------------------' 20 print ' Directory'.ljust(dirwidth), 'File'31 print 'File'.ljust(dirwidth), 'Status' 21 32 print '---------------------------------------------' 22 33 34 # Identify data files 35 all_files_accounted_for = True 36 for dirpath, datafile in identify_datafiles(directory): 37 print join(dirpath, datafile) + ': ', 38 39 basename, ext = splitext(datafile) 40 41 # Look for a XML license file with the .lic 42 try: 43 fid = open(join(dirpath, basename + '.lic')) 44 except IOError: 45 print 'NO LICENSE FILE' 46 all_files_accounted_for = False 47 else: 48 if license_file_is_valid(fid): 49 print 'OK' 50 else: 51 print 'LICENSE FILE NOT VALID' 52 all_files_accounted_for = False 53 fid.close() 54 55 # Return result 56 return all_files_accounted_for 57 58 59 def identify_datafiles(root): 60 """ Identify files that might contain data 61 """ 62 23 63 # Ignore source code files 24 extensions_to_ignore = ['.py','.c','.h', '.f'] #,'gif'] 64 extensions_to_ignore = ['.py','.c','.h', '.f'] #, '.gif', '.jpg', '.png'] 65 66 # Ignore generated stuff 67 extensions_to_ignore += ['.pyc', '.o', '.so', '~'] 68 extensions_to_ignore += ['.aux', '.log', '.idx', 'ilg', '.ind', 69 '.bbl', '.blg'] 70 71 # Ignore license files themselves 72 extensions_to_ignore += ['.lic'] 73 25 74 26 75 # Ignore certain other files 27 76 files_to_ignore = ['README.txt'] 28 77 29 for dirpath, dirnames, filenames in walk(distro_dir): 78 # Ignore directories 79 directories_to_ignore = ['anuga_work', 'pymetis', 'obsolete_code', 80 'anuga_parallel', 'anuga_viewer', 81 'planning', 'coding_standards', 82 'experimentation', 83 '.svn', 'misc', '.metadata'] 84 85 for dirpath, dirnames, filenames in walk(root): 86 87 for ignore in directories_to_ignore: 88 if ignore in dirnames: 89 dirnames.remove(ignore) # don't visit ignored directories 30 90 31 91 #print 'Searching dir', dirpath 32 92 33 93 34 94 for filename in filenames: … … 45 105 46 106 if ignore is False: 47 subdirs = dirpath.split(sep) 48 49 print join(subdirs[3:],sep).ljust(dirwidth), filename 50 107 yield dirpath, filename 51 108 52 109 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. 110 def license_file_is_valid(fid): 111 """Check that XML license file is valid 112 """ 56 113 114 # TODO 115 116 print fid.read() 117 import sys 118 from xml.dom import minidom 119 doc = minidom.parse(fid)
Note: See TracChangeset
for help on using the changeset viewer.