32""" A selector that selects files based on other criteria.
+ 33
+ 34 It is similar to the Ant file selector objects in design. This one selects files
+ 35 based on whether the root-most Distribution.Policy.S60 file matches the given value.
+ 36 """
+ 37
+
90""" A selector that selects files based on other criteria.
+ 91
+ 92 It is similar to the Ant file selector objects in design. This one selects files
+ 93 based on whether the root-most distribution.policy file matches the given value.
+ 94 """
+ 95
+
109""" Determines if the path is selected by this selector. """
+110current_dir=os.path.abspath(os.path.dirname(path))
+111logger.debug('is_selected: current dir = '+current_dir+' '+str(os.path.exists(current_dir)))
+112result=False
+113policy_file=None
+114# finding the distribution policy from the filelist.
+115forfilenameinself._policy_files:
+116ifsys.platform!='win32':
+117forfinos.listdir(current_dir):
+118iff.lower()==filename.lower():
+119policy_file=os.path.join(current_dir,f)
+120logger.debug('Using Policy file: '+policy_file)
+121break
+122elifos.path.exists(os.path.join(current_dir,filename)):
+123policy_file=os.path.join(current_dir,filename)
+124logger.debug('Using Policy file: '+policy_file)
+125break
+126
+127policy_value=None
+128ifpolicy_fileisNone:
+129logger.error("POLICY_ERROR: Policy file not found under '%s' using names [%s]"%(current_dir,", ".join(self._policy_files)))
+130policy_value=archive.mappers.MISSING_POLICY
+131else:
+132try:
+133policy_value=fileutils.read_symbian_policy_content(policy_file)
+134exceptException:
+135logger.warning('POLICY_ERROR: Exception thrown parsing policy file: '+policy_file)
+136policy_value=archive.mappers.MISSING_POLICY
+137# loop through the possible values
+138forvalueinself.values:
+139(val,negate)=self.get_value_and_negate(value)
+140logger.debug('Policy value: '+str(policy_value)+' '+val)
+141if(notnegateandpolicy_value==val)or(negateandpolicy_value!=val):
+142returnTrue
+143returnFalse
+