;ò ýcêCcE@s*dkZdkZdkZdklZdkTdklZdkTdk l Z dk Z ddddd d d d d ddddddgZ ddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXgEe Z dYZeeƒZdZ„Zd[„Zd\„Zd]fd^„ƒYZd_„Zd`„Zda„Zdb„Zdc„Zdd„Zde„Zdf„Zdgdh„Zdi„Zdj„Zdk„Z dl„Z!dm„Z"dS(nN(sStringIO(s*(s setrpstack(srpcopyschilds clearrulessdelrulesdllsimportslibsltlibsproducesprogramsrecipesroutesrules toolsearchstotypesvariantsactionsaddsaddallsasroots assertpkgsattrs attributes buildcheckscatscdschangedschdirscheckins checkinallscheckouts checkoutallschecksumschmodscommits commitallsconfscopysdelsdeldirsdeletesdoserrorsevalsexecutesexitsfetchsfetchallsfiletypesfinishsincludes installpkgslogsmkdirs mkdownloadsmovespassspopdirsprints progsearchsproxyspublishs publishallspushdirsquitsremoves removealls reviseallsscopesstartssymlinkssyss sysdependssysevalssyspathssystemstagstagallstouchstreesunlocks unlockallsupdatesusetoolsversconts #@recipe=cCs:x3|D]+}t|ƒ ot|tdƒƒqqWdS(sRCheck if "name" is a valid scope name. If it isn't, throw a user exception.sInvalid character in scope nameN(snamescs scopechars recipe_errorsrpstacks_(srpstacksnamesc((s,/mnt/gmirror/ports/devel/aap/work/Process.pysassert_scope_namess cCs:x3|D]+}t|ƒ ot|tdƒƒqqWdS(sUCheck if "name" is a valid variable name. If it isn't, throw a user exception.s"Invalid character in variable nameN(snamescsvarchars recipe_errorsrpstacks_(srpstacksnamesc((s,/mnt/gmirror/ports/devel/aap/work/Process.pysassert_var_name{s cCsœ|i}x3||ijot|i|ƒo|d}q W||ijo|i|ddjo|d}n|i|i|!t|i|ƒfSdS(s³Get the name of a variable from the current position at "fp" and get the index of the next non-white after it. Returns an empty string if there is no valid variable name.is.N(sfpsidxsline_lensvarcharslines skip_white(sfpsidx((s,/mnt/gmirror/ports/devel/aap/work/Process.pys get_var_nameƒs $(sArgItemcBstZdZd„ZRS(s,Object used as smallest part in the arglist.cCs||_||_dS(N(sisexprsselfsstr(sselfsisexprsstr((s,/mnt/gmirror/ports/devel/aap/work/Process.pys__init__’s (s__name__s __module__s__doc__s__init__(((s,/mnt/gmirror/ports/devel/aap/work/Process.pysArgItems cCsd}d}g}x—no|i|ijoPn|i|idjox|id|ijo|i|iddjo$|idƒ|id|_qn|idt|ƒdƒqn|i|idjoJ|id |ijo3|i|idd jo|i|id d jo8|i|i|i|id !ƒ|id |_qn|o%|i|i|jo d}qÒnH|i|id jp|i|idjo|i|i}n|i|idjo|d}n=|i|idjo%|d}|djo d}q.n|i|i|jo…|i|idjpJ|id|ijp3|i|iddjp|i|iddjo!|i|idjp |djoPn|i|i}|d jp |djo|id|ƒn|i|ƒ|id|_|djo>|i|ijo+|i|idjp|i|idjo+|i|i|iƒ|id|_qqWt |ƒ}t |ƒ}xF|djo'||ddjp||ddjo|d}qÇW|| SdS(sÜGet an argument starting at fp.line[fp.idx] and ending at a character in stop[]. Quotes are used to include stop characters in the argument. Backticks are handled here. `` is reduced to a single `. A Python expression `python` is translated to '" + expr2str(python) + "'. Ignore $(`). Returns the resulting string and fp.idx is updated to the character after the argument (the stop character or past the end of line). siis`is " + expr2str(s) + "s$is(is)s"s's{s}s:s s s=s\s#N(sinquotesinbracesslsfpsidxsline_lenslinesappends get_py_exprsstopscs list2stringsresslense(sfpsstopsinbracesscsinquotesresslse((s,/mnt/gmirror/ports/devel/aap/work/Process.pysgetarg—s\ 2 d!.  Ÿ N  7cCs}d}t|i|iƒ|_xLnoD|i|ijp|i|idjoV|iƒ|itjoPnt|idƒ|_t|iƒ|joq(nPn|o¦t |ƒdjo|ddjott |ƒd}d}x4|djo||d jo|d}| }qìW|o|d }qQ|d d }qU|d }n|t |dƒ}q(Wd |d Sd S(ssGet the arguments for an aap_ function or assignment from the recipe line(s). Stop at a line with an indent of "indent" or less. Input lines: cmdname arg ` `arg arg Result: "arg " + expr2str() + "arg arg" Return the argument string, advance fp to the following line.sis#iiiýÿÿÿs$bris$s s\ns"N(sress skip_whitesfpslinesidxsline_lensnextlinesNones get_indentsindentslensisescapedsgetarg(sfpsindentsisressescaped((s,/mnt/gmirror/ports/devel/aap/work/Process.pys get_func_args÷s6 * $  cCs&titi|ddƒddƒSdS(s4Escape double quotes and backslash with a backslash.s\s\\s"s\"N(sstringsreplacess(ss((s,/mnt/gmirror/ports/devel/aap/work/Process.pys esc_quote'sc Cs!g}g} d}d}x¤noœ|itjoPnt|iƒ} | |joPn| |jo| }t | ƒ}n|i ddt |i difƒ| i |iƒ|iƒq"Wd}g} x5td|ƒD]$}| i | |ƒ| i dƒqÛW| od kl}||i d t| ƒƒ}|iƒx[noO|itjoPnt|idƒ|_|dt|d ƒ}|iƒqFWntƒ} xYt|t | ƒƒD]B}| i||ƒ| idƒ| i| |ƒ| idƒq¹W|d t| iƒƒd fSd S(sIRead command lines for a dependency or a rule. Stop when the indent is at or below "indent". Separate the part at the start with more indent than the smallest indent in the block (this is considered continuation of the first line). Returns the head and the string of commands, each line ending in ' '.iŸ†iis s%s%diÿÿÿÿss (sParsePossstrings#s"""N(smarkerssliness min_indentsmin_indent_idxsfpslinesNones get_indentsidtsindentslensappends line_markersrpstacksline_nrsnextlinesheadslsrangesisParsePoss list2stringspps skip_whitesindexsgetargsStringIOssswrites esc_quotesgetvalue( sfpsindentsmin_indent_idxs min_indentsheadsppsmarkerssParsePossisidtslinesslss((s,/mnt/gmirror/ports/devel/aap/work/Process.pys get_commands,sV  %    cCs”t|i|idiƒ}d}|id|_xWnoO|i|ijo?|iƒ|it jot |t dƒƒn|d}n|i|idjoM|id|_|i|ijp|i|idjoPn|d}n†|i|idjo9|id|ijo"|i|id|id!d jo|d}|id |_n||i|i}|id|_q<W|Sd S( sÙGet a Python expression from ` to matching `. Reduce `` to ` and $(`) to `. fp.idx points to the ` and is advanced to after the matching `. Returns the expression excluding the ` before and after.iÿÿÿÿsis Missing `s s`s$is(`)iN( srpcopysfpsrpstacksline_nrsressidxsline_lensnextlineslinesNones recipe_errors_(sfpsrpstacksres((s,/mnt/gmirror/ports/devel/aap/work/Process.pys get_py_exprgs, *S cCs0| odSnd|di|difSdS(Ns in recipe: sin recipe "%s" line %d: iÿÿÿÿ(srpstacksnamesline_nr(srpstack((s,/mnt/gmirror/ports/devel/aap/work/Process.pysget_recipe_msgŒscCsdt|ƒ|d}t|ƒdjoMxJtt|ƒdddƒD](}|d||i||if}qHWn|d }t |‚dS( sThrow an exception for an error in a recipe: Error: Unknown command in recipe "main.aap" line 88: :foobar asdf included from "main.aap" line 33 When "rpstack" is empty it's not mentioned, useful for errors not related to a specific line.sError s iiiiÿÿÿÿsincluded from "%s" line %d N( sget_recipe_msgsrpstacksmsgseslensrangesisnamesline_nrs UserError(srpstacksmsgsesi((s,/mnt/gmirror/ports/devel/aap/work/Process.pys recipe_error”s* cCsqt|iƒƒdjo-t|tdƒ|t|iƒƒfƒn(t|tdƒ||iƒdfƒdS(s7Give an error message for options in dictionary "dict".is"Illegal options for %s command: %ss!Illegal option for %s command: %siN(slensdictskeyss recipe_errorsrpstacks_scmdsstr(srpstacksdictscmd((s,/mnt/gmirror/ports/devel/aap/work/Process.pys option_error¥s-icCsw|||t!tjoW|t}y*x#||tijo|d}q(WWnnXt||t|!ƒSntSdS(shCheck for the line marker comment at string "s". Return the line number if found, None otherwise.iN( ssssidxsline_marker_lens line_markersjsstringsdigitssintsNone(ssssidxsj((s,/mnt/gmirror/ports/devel/aap/work/Process.pysget_line_marker®s cCsÊt|i|iƒ|_t|i|iƒ}||ijot|itdƒ|ƒn|i|i|!}t|i|ƒ}||i jo|i|djot|itdƒ|ƒn|SdS(sdGet the argument used to terminate a block of lines. Used for ":python EOF" and "var << EOF".sMissing item for %ss#sToo many arguments for %sN( s skip_whitesfpslinesidxs skip_to_whitesns recipe_errorsrpstacks_scmdstermsline_len(sfpscmdstermsn((s,/mnt/gmirror/ports/devel/aap/work/Process.pysget_block_term¼s$cCs2d} |idi}t|ƒ}d}xÿno÷|i ƒ|i t jo;| oPn||id_t |it dƒ|ƒn|djot|i ƒ}n| ot|i ƒ|joPqXn‹t|i dƒ} | |ijo|i | | |!|joMt|i | |ƒ} | |ijp|i | djo|i ƒPqXn|djo,| dt|idif} ||} nd} d}d} xƒ| | |jo|t|i ƒjo[|i |d jo| d} n,|i |d jo| d | d } nP|d}q¦Wt|i |ƒ|| jo„x|t|i ƒjof|i |d jo!| d | d } |d}Pn|i |d joPn| d} |d}qJWn| || jot |it d ƒ|ƒnd | || |i |} | | d } q2W| SdS(séGet the lines for a block of lines followed by terminator "term". Stop when "term" is empty and the indent drops below "indent". Remove "indent_sub" indent from the lines. Used for ":python EOF" and "var << EOF".siÿÿÿÿisUnterminated %s blockis#s:pythons%s%d s s isNot enough indent in %s blocks N(slinessfpsrpstacksline_nrs start_line_nrslenstermsterm_lens first_indentsnextlineslinesNones recipe_errors_scmds get_indentsindents skip_whitesnsline_lens line_markers indent_subs keep_indentsisind(sfpstermsindents indent_subscmds start_line_nrs first_indentsisterm_lenslinessns keep_indentsindsline((s,/mnt/gmirror/ports/devel/aap/work/Process.pysget_block_linesÉsl    +$   '  cCs3tiƒ\} }} d}| tjoBy4|\}\}}} } |t j o d}nWqjqjXn|djoæx| i o | i } qzW| i ii}|djp+|o$|dj oti|dƒdjondkl} | |tdƒƒtiƒ}| |titi|d|d|d ƒƒƒtidƒnti| ƒ}nd}t|ƒ}d}x¡no™|djoPnx2||jo$||d joPn|d}q”W|d}||joPnt"||ƒ}|t j o |}n|d}qWt$t%||ƒd ƒd S( s¡Handle an error raised while executing the Python script produced for a recipe. The error is probably in the recipe, try to give a useful error message.iÿÿÿÿiþÿÿÿissScope.py(s error_msgsInternal Erroriis sN('ssyssexc_infosetypesevaluestbs py_line_nrs SyntaxErrorsmsgsfilenamesoffsetslinesNonestb_nextstb_framesf_codes co_filenamesfnamesstringsfindsMains error_msgsrecdicts_sesjoins tracebacksformat_exceptionsexits tb_linenosislensscripts script_lens rec_line_nrsget_line_markersnsrecipe_py_errorsrpcopysrpstack(srpstacksrecdictsscriptsfilenames script_lensevalues py_line_nrsfnamesmsgstbsetypesoffsetslines error_msgsesis rec_line_nrsn((s,/mnt/gmirror/ports/devel/aap/work/Process.pys script_errorsV   ;  +      c CsÁtiƒ\}}} ti||ƒ}|tjoEy7|\}\}}} } |tjod|d}!nI|d?jo d@}!n2|dAjo dB}!ne|iedCƒ|ƒe|i|(ƒ}(|(|ijo|i|(djo%e|iedDƒ|i|(ƒn|iHdEƒejoe|iedFƒƒn|i ||!d;ƒ|iƒq†ne,|ƒ\}}*|djo |*|ijo|i|*}|}0|0dGjo|*d|ijo|*d}|i|}0n|*}|0dHjp |0dIjo|d|ijo!|0} |d}|i|}0nd} |0dJjp |0dKjo;|0dKjof|d|ijp|i|ddKjoe|iedLƒƒn|dM|_e1|dNƒ}$n|dOjo|i |dPƒne|i|dƒ|_|i |dQ|idi"|fƒ|0dKjo*e2||$dddRƒ}dS|dS}ne?||&ƒ}|i |dT|| fƒq†q$ne8|d(ƒ}|i|ijp|i|idjoLe|idƒ},e|i|,ƒ} e|iedUƒ|i|,| !ƒn| oe|iedVƒƒqe|i|idƒ|_e8|dƒ}|idi"}|iƒe<||&ƒ\}}||}|i |dW|||f|d-ƒq†W|iQo|iQiRƒn|iEddXdYdZd[ƒeS|ƒ}eiU}"|e_UzRy|||UWn=eWj o ‚n)eXj o} eY|i||ƒnXWd\|"e_U|e_Xd\S(]sZ Read all the lines in ParsePos "fp", convert it into a Python script and execute it. When "fp.string" is empty, the source is a recipe file, otherwise it is a string (commands from a dependency or rule). When executing the recipe itself, not build commands or a file included from build commands, "toplevel" is True. sVariantcBstZdZd„ZRS(sNClass used to remember nested ":variant" commands in variant_stack.cCs1||_||_||_d|_d|_dS(Ni(snamesselfsindents min_indentsline_nrs val_indentshad_star(sselfsnamesindentsline_nr((s,/mnt/gmirror/ports/devel/aap/work/Process.pys__init__‚s     (s__name__s __module__s__doc__s__init__(((s,/mnt/gmirror/ports/devel/aap/work/Process.pysVariants si(sshell_cmd_has_forceis#s"First command in recipe has indents is:syssaap_shell(%d, globals(), "%s") s%s%d iÿÿÿÿs'Exepected list of values after :variantselse: s> aap_error(%d, globals(), 'invalid value for %s: %%s' %% %s) sVariant item * must be last ones*s* must be by itselfsExepected variant values'if not globals()["_no"].has_key("%s"): s %s = "%s" sBDIR = _no.BDIR + '-' + _no.%s selsif _no.%s == '%s': s pass is:pythons:sunknownsnotheressystemssyss\nsvariants%Expected variable name after :variantsaap_%s(%d, globals(), srules:#sMissing ':' after :%ss"%s", s "%s", %s) sdelrules) sroutestrees""""""sMissing commands after :trees"%s", %d, %s) sfiletypesaction(smaydo_recipe_cmdsrecipes/globals()["_start_recdict"] = globals().copy() s@s s s s>salwayssif 1:sbuildsif _really_build:snobuildsif not _really_build:sUnknown section name: %ssTrailing text: %ss _really_buildsUsing sections not allowed heres$s+s?s=s