Changeset 5018
- Timestamp:
- Feb 11, 2008, 4:45:53 PM (17 years ago)
- Files:
-
- 1 added
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/utilities/data_audit.py
r5014 r5018 1 """Track IP of data files included in this distribution. 1 """Track IP of data files in an entire directory tree. 2 See docstring for the public function IP_verified() 3 for details. 2 4 """ 3 5 … … 7 9 from anuga.utilities.xml_tools import xml2object, XML_element 8 10 from anuga.utilities.system_tools import compute_checksum 9 10 from data_audit_config import extensions_to_ignore, directories_to_ignore, files_to_ignore11 12 11 13 12 … … 25 24 WrongTags) 26 25 27 def IP_verified(directory, verbose=False): 26 27 def IP_verified(directory, 28 extensions_to_ignore=None, 29 directories_to_ignore=None, 30 files_to_ignore=None, 31 verbose=False): 28 32 """Find and audit potential data files that might violate IP 29 33 … … 41 45 If verbose is False, only diagnostics about failed audits will appear. 42 46 All files that check OK will pass silently. 43 44 47 48 Optional arguments extensions_to_ignore, directories_to_ignore, and 49 files_to_ignore are lists of things to skip. 50 51 Examples are: 52 extensions_to_ignore = ['.py','.c','.h', '.f'] # Ignore source code 53 files_to_ignore = ['README.txt'] 54 directories_to_ignore = ['.svn', 'misc'] 55 56 None is also OK for these parameters. 57 45 58 """ 46 59 … … 51 64 first_time = True 52 65 all_files_accounted_for = True 53 for dirpath, datafile in identify_datafiles(directory): 66 for dirpath, datafile in identify_datafiles(directory, 67 extensions_to_ignore, 68 directories_to_ignore, 69 files_to_ignore): 54 70 55 71 filename = join(dirpath, datafile) … … 99 115 100 116 101 def identify_datafiles(root): 117 118 #------------------ 119 # Private functions 120 #------------------ 121 def identify_datafiles(root, 122 extensions_to_ignore=None, 123 directories_to_ignore=None, 124 files_to_ignore=None): 102 125 """ Identify files that might contain data 126 127 See function IP_verified() for details about optinoal parmeters 103 128 """ 104 129 … … 109 134 dirnames.remove(ignore) # don't visit ignored directories 110 135 111 #print 'Searching dir', dirpath112 113 136 114 137 for filename in filenames: … … 129 152 130 153 def license_file_is_valid(fid, dirpath='.', verbose=False): 131 """Check that XML license file is valid 154 """Check that XML license file is valid. 155 156 Check for each datafile listed that 157 158 * Datafile tags are there 159 * Fields are non empty 160 * Datafile exists 161 * Checksum is correct 162 * Datafile is flagged as publishable 163 164 If anything is violated an appropriate exception is raised. 165 If everything is honky dory the function will return True. 132 166 """ 133 167 … … 149 183 150 184 # Validate elements: metadata, datafile, datafile, ... 185 # FIXME (Ole): I'd like this to verified by the parser 186 # using a proper DTD template one day.... 187 # For not, let's check the main ones. 151 188 elements = doc['ga_license_file'] 152 189 if not elements.has_key('metadata'): … … 174 211 author = metadata['author'] 175 212 if verbose: print 'Author: ', author 213 if author == '': 214 msg = 'Missing author' 215 raise Exception, msg 176 216 177 217 #svn_keywords = metadata['svn_keywords'] -
anuga_core/test_all.py
r5017 r5018 1 from anuga.utilities.data_audit import IP_verified1 from anuga.utilities.data_audit_wrapper import IP_verified 2 2 from tempfile import mktemp 3 3 … … 14 14 15 15 16 print 17 print '************************** NOTE *************************************' 18 print 'If all unit tests passed you should run the suite of validation tests' 19 print 'Go to the directory anuga_validation/automated_validation_tests' 20 print 'and run' 21 print ' python validate_all.py' 22 print 23 print 'These tests will take a few hours and will verify that ANUGA' 24 print 'produces the physical results expected.' 25 print '*********************************************************************' 26 27 28 16 29 # Temporary bail out 17 30 import sys; sys.exit() … … 23 36 24 37 # Create temporary area for svn to export source files 38 # FIXME (Ole): It would be good to make sure these files 39 # are exactly the same as those walked over by the 40 # release script: create_distribution. 41 # 42 # Come to think of it - this is probably not the best 43 # place for this check. It may have to move up one level. 44 # What do you all think? 45 46 47 25 48 temp_dir = mktemp() 26 49 27 50 print 'Temp dir', temp_dir 28 51 os.mkdir(temp_dir) 29 30 52 31 53 # Get the ANUGA core source files … … 42 64 43 65 44 print 45 print '************************** NOTE *************************************' 46 print 'If all unit tests passed you should run the suite of validation tests' 47 print 'Go to the directory anuga_validation/automated_validation_tests' 48 print 'and run' 49 print ' python validate_all.py' 50 print 51 print 'These tests will take a few hours and will verify that ANUGA' 52 print 'produces the physical results expected.' 53 print '*********************************************************************' 66 54 67 55 68 -
create_distribution.py
r5016 r5018 18 18 it depends on still work for that revision. 19 19 20 This script works only on Linux 20 This script works only on Linux! 21 21 """ 22 22 … … 30 30 from anuga.config import major_revision 31 31 32 from anuga.utilities.data_audit import IP_verified32 from anuga.utilities.data_audit_wrapper import IP_verified 33 33 34 34 if platform == 'win32':
Note: See TracChangeset
for help on using the changeset viewer.