Changeset 101
- Timestamp:
- 07/22/06 11:49:34 (7 years ago)
- Files:
-
- branches/mk/cheesecake/cheesecake_index.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/mk/cheesecake/cheesecake_index.py
r100 r101 352 352 value = -1 353 353 details = "" 354 advices= ""354 info = "" 355 355 356 356 def __init__(self, *indices): … … 497 497 return self._indices_dict[name] 498 498 499 def get_ advices(self):499 def get_info(self): 500 500 if self.subindices: 501 return ''.join(map(lambda index: index.get_ advices(), self.subindices))502 return self. advices501 return ''.join(map(lambda index: index.get_info(), self.subindices)) 502 return self.info 503 503 504 504 ################################################################################ … … 783 783 784 784 def compute(self, files_list, dirs_list, package_dir): 785 # Inform user of files and directories the package is missing. 786 def make_info(dictionary, what): 787 missing = self.get_not_used(dictionary.keys()) 788 importance = {30: ' critical', 20: ' important', 10: ''} 789 info = [] 790 791 positive_msg = "[%s] Package has%s %s: %s.\n" 792 negative_msg = "[%s] Package doesn't have%s %s: %s.\n" 793 794 for key in dictionary.keys(): 795 msg = positive_msg 796 if key in missing: 797 msg = negative_msg 798 info.append(msg % (index_class_to_name(self.name), importance[dictionary[key]], what, str(key))) 799 800 return ''.join(info) 801 802 # Compute required files. 785 803 files_count, files_value = self._compute_from_rules(files_list, package_dir, self.cheese_files) 804 self.info = make_info(self.cheese_files, 'file') 805 806 # Compute required directories. 786 807 dirs_count, dirs_value = self._compute_from_rules(dirs_list, package_dir, self.cheese_dirs) 808 self.info += make_info(self.cheese_dirs, 'directory') 787 809 788 810 self.value = files_value + dirs_value … … 790 812 self.details = "%d files and %d required directories found" % \ 791 813 (files_count, dirs_count) 792 793 # Inform user of files and directories the package is missing.794 def make_advices(dictionary, what):795 missing = self.get_not_used(dictionary.keys())796 importance = {30: ' critical', 20: ' important', 10: ''}797 return ''.join(map(lambda miss: "Package don't have%s %s: %s.\n" % \798 (importance[dictionary[miss]], what, str(miss)),799 missing))800 801 self.advices = make_advices(self.cheese_files, 'file') +\802 make_advices(self.cheese_dirs, 'directory')803 814 804 815 return self.value … … 1537 1548 if self.verbose: 1538 1549 print 1539 print self.index.get_ advices(),1550 print self.index.get_info(), 1540 1551 1541 1552 return cheesecake_index
