; #Bc@sXdkZdkZdkZdkTdklZdZdfdYZdZdS(N(s*(s fname_foldcCst|}t|}t|} ti|d}|djo||d}t|}n |}| }x{|D]s}|d}t|}ti|ddjo|}|}n>|ido|do|}t|}n |}| }||joqtnti|d}|djo(dkl} | |td|nd} |djp|d|!|d|!jo9|||d} ||d|| jo d} qn| o ||jo|}t|}||joqtn|djp|d|!|d|!jo9|||d} ||d|| jo d} qTqXn| oqtn|id o|d |joqtnd } ||jo1ti|d}|djo|| } qn||| !| |fSqtWd d dfSd S( sCheck if "name" matches with a pattern in dictlist "patlist". "name_short" is the short version of "name", for when it turns out to be a virtual item. Returns three items: 1. A string for the part that matches with "%". If there is no match this is an empty string. 2. The directory of name_short when it was ignored for matching. Otherwise it's an empty string. 3. The length of the matching pattern.s/iisnamesvirtuals%(s recipe_errorsMissing %% in rule target "%s"sskipsN(s fname_foldsnames name_shortslensname_lensstringsrfindsistailstail_lenspatliststspatspat_lensfindsssstr_lenshas_keysProcesss recipe_errorsrpstacks_smatchsesadirssi(srpstacksnames name_shortspatlistsstr_lenspat_lenspatssistailsmatchsadirsname_lens recipe_errorsesissststail_len((s)/mnt/gmirror/ports/devel/aap/work/Rule.pys _trymatch sj           (  (!  sRulecBs5tZdZdZdZdZdZRS(NcCsdd|_d|_||_||_||_||_||_ti |_ t |_ d|_ dS(Nisnormal(sselfsdefaults sourceexistss targetlists build_attrs sourcelistsrpstackscommandssossgetcwdsbuilddirsNones buildrecdictsscope(sselfs targetlists build_attrs sourcelistsrpstackscommands((s)/mnt/gmirror/ports/devel/aap/work/Rule.pys__init__|s        cCst|i|||iSdS(sIf "name" matches with one of the target patterns return a string for the part that matches with "%". Otherwise return an empty string. also return the length of the matching pattern.N(s _trymatchsselfsrpstacksnames name_shorts targetlist(sselfsnames name_short((s)/mnt/gmirror/ports/devel/aap/work/Rule.pys match_targetscCs|i|||iSdS(s]Assume a target matches with "name" and return the corresponding dictlist of sources.N(sselfs target2listsnames name_shorts sourcelist(sselfsnames name_short((s)/mnt/gmirror/ports/devel/aap/work/Rule.pystarget2sourcelistscCs|i|||iSdS(s]Assume a target matches with "name" and return the corresponding dictlist of sources.N(sselfs target2listsnames name_shorts targetlist(sselfsnames name_short((s)/mnt/gmirror/ports/devel/aap/work/Rule.pystarget2targetlistsc Cs|i||\} }}| djottd|ng}xj|D]b}|i } ti|dd| }|otii||}n|| d<|i| qLW|SdS(Nss1target2list used without matching target for "%s"snames%(sselfs match_targetsnames name_shortsmatchsadirsmatchlens InternalErrors_sresslistslscopysentsstringsreplacesnsosspathsjoinsappend( sselfsnames name_shortslistsmatchlensadirsresslsnsentsmatch((s)/mnt/gmirror/ports/devel/aap/work/Rule.pys target2lists   (s__name__s __module__s__init__s match_targetstarget2sourceliststarget2targetlists target2list(((s)/mnt/gmirror/ports/devel/aap/work/Rule.pysRule{s    c Cszxo|iD]d}t|i|||i\}}}t|i|||i \}}}|o|o|Sq q WtSdS(sCheck if there is a rule for target "tname" and source "sname". These must be the short names (not expanded to a full path). Return the Rule object or None.N(sworksrulessrs _trymatchsrpstackstnames targetliststmsadirstlssnames sourcelistssmsslsNone( sworkstnamessnamesadirstlstmssmsslsr((s)/mnt/gmirror/ports/devel/aap/work/Rule.pys find_rules $$ ( sstringsossos.pathsErrorsUtils fname_folds _trymatchsRules find_rule(sstrings _trymatchsRules fname_foldsoss find_rule((s)/mnt/gmirror/ports/devel/aap/work/Rule.pys?s   [2