Changeset 5028
- Timestamp:
- Feb 13, 2008, 9:59:59 AM (17 years ago)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/utilities/data_audit.py
r5027 r5028 73 73 all_files += 1 74 74 75 filename = join(dirpath, datafile)75 data_filename = join(dirpath, datafile) 76 76 basename, ext = splitext(datafile) 77 license_filename = join(dirpath, basename + '.lic') 77 78 78 79 # Look for a XML license file with the .lic 79 80 status = 'OK' 80 81 try: 81 fid = open( join(dirpath, basename + '.lic'))82 fid = open(license_filename) 82 83 except IOError: 83 84 status = 'NO LICENSE FILE' 84 85 all_files_accounted_for = False 85 86 else: 87 fid.close() 88 86 89 try: 87 license_file_is_valid(fid, datafile, dirpath, 90 license_file_is_valid(license_filename, 91 data_filename, 92 dirpath, 88 93 verbose=False) 89 94 except audit_exceptions, e: … … 93 98 94 99 try: 95 doc = xml2object( fid)100 doc = xml2object(license_filename) 96 101 except: 97 status += 'XML file could not be read:' 98 fid.seek(0) 99 status += fid.read() 102 status += 'XML file %s could not be read:' %license_filename 103 fid = open(license_filename) 104 status += fid.read() 105 fid.close() 100 106 else: 101 107 status += str(doc) 102 108 103 fid.close() 109 104 110 105 111 if status == 'OK': … … 114 120 first_time = False 115 121 116 print filename + ' (Checksum=%s): '\117 %str(compute_checksum( filename)), status122 print data_filename + ' (Checksum=%s): '\ 123 %str(compute_checksum(data_filename)), status 118 124 119 125 … … 165 171 166 172 167 def license_file_is_valid( fid, filename_to_verify,173 def license_file_is_valid(license_filename, filename_to_verify, 168 174 dirpath='.', verbose=False): 169 175 """Check that XML license file for given filename_to_verify is valid. 170 176 171 177 Input: 172 fid: Open file object forXML license file178 license_filename: XML license file 173 179 file_name_to_verify: The data filename that is being audited 174 180 dir_path: Where the files live … … 188 194 """ 189 195 190 license_filename = fid.name 191 192 doc = xml2object( fid)196 197 198 doc = xml2object(license_filename) 193 199 #print doc 194 200 -
create_distribution.py
r5018 r5028 123 123 #--------------------------- 124 124 print 'Verifying data IP' 125 if not IP_verified(distro_dir ):125 if not IP_verified(distro_dir, verbose=True): 126 126 msg = 'Files have not been verified for IP.\n' 127 127 msg += 'Each data file must have a license file with it.'
Note: See TracChangeset
for help on using the changeset viewer.