,9Mc@sdZddkZddkZddkZddkZddkZyeidZWn%eij oeidZnXyddk l Z Wne j odZ nXe Z ddk Z ddkZ eiZeiZe iiiZdZdeifd YZd eifd YZd eifd YZdeifdYZdeifdYZdZ dS(sFsrc/engine/SCons/Script/SConsOptions.py 4629 2010/01/17 22:23:21 sconsiNs((\s+|(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))s(\s+|-*\w{2,}-(?=\w{2,}))(tgettextcCs|S(N((tmessage((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyR*scCs|djogSntii|pti|d}ng}xotti|D][}|djo t}qW|djo g}qW|tjo|i |qWt |qWW|S(Nt,talltnone( tNonetSConstUtiltis_Listtstringtsplittmaptlowert diskcheck_alltappendt ValueError(tvaluetresulttv((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pytdiskcheck_convert6s       t SConsValuesc BsSeZdZdZdZddddddd d d d d dg ZdZRS(s Holder class for uniform access to SCons options, regardless of whether or not they can be set on the command line or in the SConscript files (using the SetOption() function). A SCons option value can originate three different ways: 1) set on the command line; 2) set in an SConscript file; 3) the default setting (from the the op.add_option() calls in the Parser() function, below). The command line always overrides a value set in a SConscript file, which in turn always overrides default settings. Because we want to support user-specified options in the SConscript file itself, though, we may not know about all of the options when the command line is first parsed, so we can't make all the necessary precedence decisions at the time the option is configured. The solution implemented in this class is to keep these different sets of settings separate (command line, SConscript file, and default) and to override the __getattr__() method to check them in turn. This should allow the rest of the code to just fetch values as attributes of an instance of this class, without having to worry about where they came from. Note that not all command line options are settable from SConscript files, and the ones that are must be explicitly added to the "settable" list in this class, and optionally validated and coerced in the set_option() method. cCs||idinstall/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyt__init__hs cCsfy|i|SWnPtj oDy|id|SWqbtj ot|id|SqbXnXdS(s Fetches an options value, checking first for explicit settings from the command line (which are direct attributes), then the SConscript file settings, then the default values. RRN(RtKeyErrortgetattr(Rtattr((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyt __getattr__lstcleant diskcheckt duplicatethelptimplicit_cachet max_driftt md5_chunksizetno_exectnum_jobstrandomt stack_sizetwarncCs||ijotiid|n|djoZy't|}|djo tnWqtj o tiidt|qXnQ|djoCyt|}Wqtj o tiidt|qXn|djoyt|}Wn,tj o tiidt|nX|tii i jotiid |ntii i |nq|d joiyt |}Wn(tj o}tiid |nX|i id ptii i|qn|d joCyt|}Wqtj o tiidt|qXn|d joCyt|}Wqtj o tiidt|qXn[|djoMtii|o |g}n|ii|g|}tii|n||i|install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyt set_optionsZ   " "   " "  (t__name__t __module__t__doc__RRR+R<(((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyRGs    t SConsOptioncBseZdZdZdZyeiiZeii Z Wnae j oUdZdZ eii eiieiieiie eiieiigZ nXe egZ eeiiZRS(cCsU|dj oD|idjo|i||SqQtt||d|SndS(Nit?cSs|i||S((t check_value(Rtots((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyts(iRA(RtnargsRBttupleR (RtoptR((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyt convert_values cCs4|i||}|i|i|i||||S(N(RIt take_actiontactiontdest(RRHRtvaluestparser((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pytprocessscCsB|idjo.|io$d}tii||idndS(NRAs7option %s: nargs='?' is incompatible with short optionsi(RFt _short_optsRR,R-(Rtfmt((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyt_check_nargs_optionalst store_constcCsA|i|ijo*|idj otd|i|ndS(Ns*'const' must not be supplied for action %r(RKt CONST_ACTIONStconstRt OptionError(R((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyt _check_consts# (RS(R=R>RIRORRtoptparsetOptionRTt_orig_CONST_ACTIONSt CHECK_METHODSt_orig_CHECK_METHODStAttributeErrorRWt _check_actiont _check_typet _check_choicet _check_destt _check_nargst_check_callbackt TYPED_ACTIONS(((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyR@s$         tSConsOptionGroupcBseZdZdZRS(s A subclass for SCons-specific option groups. The only difference between this and the base class is that we print the group's help text flush left, underneath their own title but lined up with the normal "SCons Options". cCsC|i|i|i}|i|tii||}|S(s Format an option group's help text, outdenting the title so it's flush with the "SCons Options" title we print at the top. (tdedenttformat_headingttitletindentRXtOptionContainert format_help(Rt formatterR((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyRks   (R=R>R?Rk(((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyRestSConsOptionParsercBs)eZeZdZdZdZRS(cCs5|ititiid|tiddS(NsSCons error: %s i(t print_usagetsyststderrtwritetexit(Rtmsg((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyterrorsc Cs|id}d|jo5ti|dd\}}|id|t}n |}t}y|i|}WnStij oD|i o0|i i ||o|idndSnnX|i |}|i o|i}|djo'|o|id} q|i} qt||joI|djo|itd|q|itd||fq|djo|id} qt|d|!} |d|5n)|o|itd|nd} |i|| ||dS( si SCons-specific processing of long options. This is copied directly from the normal optparse._process_long_opt() method, except that, if configured to do so, we catch the exception thrown when an unknown option is encountered and just stick it back on the "leftover" arguments for later (re-)processing. it=iNRAs%s option requires an arguments%s option requires %d argumentss%s option does not take a value(tpopR R tinserttTruetFalset_match_long_optRXtBadOptionErrortpreserve_unknown_optionstlargsRt _long_optt takes_valueRFRUtlenRtt_RGRRO( RtrargsRMtargRHtnext_argthad_explicit_valuetoptionRFR((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyt_process_long_optsH           cOsy |i}Wn:tj o.t|d}|i|}||_nXt|i||}|o6t|ii|i |i |i |i |in|S(s Adds a local option to the parser. This is initiated by a SetOption() call to add a user-defined command-line option. We add the option to a separate option group for the local options, creating the group if necessary. s Local Options( tlocal_option_groupR]Retadd_option_grouptapplyt add_optiontsetattrRMRRLtdefaultt parse_argsR}(RtargstkwtgroupR((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pytadd_local_optionXs  (R=R>RyR|RtRR(((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyRms  @tSConsIndentedHelpFormattercBs8eZdZdZdZdZdZdZRS(cCsd|S(Ns usage: %s ((Rtusage((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyt format_usagexscCsA|djo d}n|djo d}ntii||S(s This translates any heading of "options" or "Options" into "SCons Options." Unfortunately, we have to do this here, because those titles are hard-coded in the optparse calls. toptionstOptionss SCons Options(RXtIndentedHelpFormatterRg(Rtheading((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyRg{s     c Csg}y|i|}Wntj o|i}nX|i|id}t||joJtid|idddd}t|_ |i |d}|i}n d|id||f}d }|i ||i oy |i }Wntj o|i }nX||}tid|idd}t|_ |i|} |i d |d| d fxU| d D]#} |i d |id| fqqWn#|d djo|i dnti|dS( s A copy of the normal optparse.IndentedHelpFormatter.format_option() method. This has been snarfed so we can modify text wrapping to out liking: -- add our own regular expression that doesn't break on hyphens (so things like --no-print-directory don't get broken); -- wrap the list of options themselves when it's too long (the wrapper.fill(opts) call below); -- set the subsequent_indent when wrapping the help_text. itwidthtinitial_indents tsubsequent_indents s %*s%-*s tis%*s%s ii(toption_stringsR]t help_positiontcurrent_indentRttextwrapt TextWrapperRt no_hyphen_ret wordsep_retfillRR"texpand_defaultt help_widthtwrapR tjoin( RRRtoptst opt_widthtwrappert indent_firstRt help_textt help_linestline((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyt format_optionsB          %s%s %ss%s=%scCs|io|ipti|i}g}x+|iD] }|i|i||fq9Wg}xA|iD] }|i|i ||fqmWn|i}|i}|i o||}n ||}ti |dS(s@Return a comma-separated list of option strings & metavariables.s, ( RtmetavarR tupperRLRPRt_short_opt_fmtt _long_optst _long_opt_fmtt short_firstR(RRRt short_optstsoptt long_optstloptR((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pytformat_option_stringss    "    (R=R>RRgRRRR(((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyRws    LcCs5 tdd}tdtdtd|dd}t|_||_d}|id d d d d ddddddddddd|dd |iddddddtdd dd!|id"d#d$d%d&d'dd(dgdd)dd*d+d,|id-d$d%dd.dddd/dd0d+d1|id2d3dd4dtdd dd5|id6d7dd8dtdd dd9|id:dd;dtdd dd<d=d>d?g}|d@}dAt i |dB}|idCd$d%d&d'ddDdd=ddd|d|d+dE|idFddGddddHdIdJddKhdLdM<dNdO<dPdQ<dRdS<}dTdUdVdWdXdYdZd[d\d]d^g |i }||d_} d`t i |dB} |idad$d%d&d'ddbdgddd| d| d+dcdd} |ided$d%d&d'ddfddddd| ddgd+dcdh} dit i t i iidB} |idjd$d%d&d'ddkddlddd| d| |idmdndodpd$d%d&d'ddqdgdd)ddr|idsdtdddtdd ddu|idvdwddddx|idydzdd{dtdd dd||id}d~d$d%dddgdd)ddd+d,|iddddtdd ddd}|iddddtddd|dd|iddddtddd|dd|idddddtdd dd|iddd$d%d&ddddd%dd/ddd+d|idddddtdd dd|idd$d%d&ddddt i iidd/ddd+d|idd$d%d&ddddt i iiidd/ddd+d|iddddddddtdd dd|iddddtdd dd|idd$d%dddddd/ddd+d1|idddddtdd dd|iddddtdd dd|iddddtdd dd|iddddddtdd dd|idd$d%dddddd/ddd+d,|idd$d%d&ddddd/ddd+d|idd$d%dddddd/ddd+d1ddddg}|d}dt i |dB}|idd$d%d&d'dddgddd|d|d+d|idddddGddddHdId%dd|idddGddddHdIdddd}|iddddd|dd|d}|iddd$d%d&d'dddgddd|ddd+d|idddd$d%dddgdd)ddd}|idddd$d%d&dddddddd|dt|idddddd|dt|idddddd|dt|idddddd|dt|idddd$d%d&d'dddgddd|dt|idd$d%d&d'ddd|dddt|idddd|dddt|iddddddd|dddt|idd$d%d&d'ddddd|dt|iddddd$d%d&d'ddddd|dt|idddddd|dt|S(s[ Returns an options parser object initialized with the standard SCons options. tmax_help_positionit option_classtadd_help_optionRlRs"usage: scons [OPTION] [TARGET] ...cSstiid|dS(NsWarning: ignoring %s option (RoRpRq(RRHRRN((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyt opt_ignoress-bs-ds-es-ms-Ss-ts-ws--environment-overridess--no-keep-goings--no-print-directorys--print-directorys--stops--touchRKtcallbackR"sIgnored for compatibility.s-cs--cleans--removeRLRRt store_trues*Remove specified targets and dependencies.s-Cs --directoryRFittypeR t directoryRs$Change to DIR before doing anything.RtDIRs --cache-debugt cache_debugtstores"Print CacheDir debug info to FILE.tFILEs--cache-disables --no-cachet cache_disables,Do not retrieve built targets from CacheDir.s --cache-forces--cache-populatet cache_forces-Copy already-built targets into the CacheDir.s --cache-showt cache_shows,Print build actions for files from CacheDir.tautotforcetcachecSs;||jotd|nt|i|i|dS(Ns'Warning: %s is not a valid config type(tOptionValueErrorRRMRL(RRHRRNt c_options((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyt opt_configBs s!Controls Configure subsystem: %s.s, s--configtconfigtMODEs-Dtclimb_upRSRUisKSearch up directory tree for SConstruct, build all Default() targets.s#; please use --tree=derived insteadtdtrees and has no effectt nomemoizers&; please use --tree=all,status insteadtstrees; please use --tree=all insteadttreetcounttexplaintfindlibstincludestmemoizertmemorytobjectstpdbtpresubt stacktracettimec Ss||jo|iii|||ijosy|iiWntj og|i_nX||}d||f}tii|f}|iii|qnt d|dS(Ns&The --debug=%s option is deprecated%s.s&Warning: %s is not a valid debug type( RMtdebugRtkeystdelayed_warningsR]RR9tDeprecatedWarningR( RRHRRNt debug_optionstdeprecated_debug_optionsRstwtt((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyt opt_debugas  s1Print various types of debugging information: %s.s--debugRtTYPEcSsRyt|}Wn%tj o}td|nXt|i|i|dS(Ns+Warning: `%s' is not a valid diskcheck type(RRRRRMRL(RRHRRNtdiskcheck_valuete((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyt opt_diskcheckzs s --diskcheckR sEnable specific on-disk checks.cSsW|tiiijotd|nt|i|i|tiii|dS(Ns&`%s' is not a valid duplication style.( RR1R2R3RRRMRLR4(RRHRRN((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyt opt_duplicatess6Set the preferred duplication methods. Must be one of s --duplicateR!shard-soft-copys-fs--files --makefiles --sconstructtfiles+Read FILE as the top-level SConstruct file.s-hs--helps(Print defined help message, or this one.s-Hs--help-optionssPrint this message and exit.s-is--ignore-errorst ignore_errorss!Ignore errors from build actions.s-Is --include-dirt include_dirs'Search DIR for imported Python modules.s--implicit-cacheR#sCache implicit dependenciescSs-t|idtt|i|itdS(NR#(RRMRxRL(RRHRRN((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pytopt_implicit_depsss--implicit-deps-changedtimplicit_deps_changeds$Ignore cached implicit dependencies.s--implicit-deps-unchangedtimplicit_deps_unchangeds(Ignore changes in implicit dependencies.s --interacts --interactivet interactivesRun in interactive mode.s-js--jobsR.R'sAllow N jobs at once.tNs-ks --keep-goingt keep_goings'Keep going when a target can't be made.s --max-driftR$s,Set maximum system clock drift to N seconds.s--md5-chunksizeR%s<Set chunk-size for MD5 signature computation to N kilobytes.s-ns --no-execs --just-prints --dry-runs--reconR&s!Don't build; just print commands.s --no-site-dirt no_site_dirs-Don't search or use the usual site_scons dir.s --profilet profile_files&Profile SCons and put results in FILE.s-qs --questiontquestions,Don't build; exit status says if up to date.s-Qt no_progresss.Suppress "Reading/Building" progress messages.s--randomR(s#Build dependencies in random order.s-ss--silents--quiettsilentsDon't print commands.s --site-dirtsite_dirs,Use DIR instead of the usual site_scons dir.s --stack-sizeR)sBSet the stack size of the threads used to run jobs to N kilobytes.s--taskmastertracettaskmastertrace_filesTrace Node evaluation to FILE.RtderivedtprunetstatuscSsddk}|i}xti|dD]~}|djo t|_q+|djo t|_q+|djo t|_q+|djo t|_q+t d|q+W|i i i |dS(NiRRRRRs)Warning: %s is not a valid --tree option( tMaint TreePrinterR R RyRRxRRRRMt tree_printersR(RRHRRNt tree_optionsRttpRC((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pytopt_tree"s          s/Print a dependency tree in various formats: %s.s--treeRtOPTIONSs-us--ups --search-upis[Search up directory tree for SConstruct, build targets at or below current directory.s-Uis]Search up directory tree for SConstruct, build Default() targets from local SConscript.cSs(tii|idtiddS(Ns i(RotstdoutRqtversionRr(RRHRRN((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyt opt_versionHss-vs --versions(Print the SCons version number and exit.cSs@tii|oti|d}n|iii|dS(NR(RRR7R R RMR*textend(RRHRRNR((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pytopt_warnOss--warns --warningR*sEnable or disable warnings.s WARNING-SPECs-Ys --repositorys--srcdirt repositorys.Search REPOSITORY for source and target files.cSsd|}tii|dS(Ns/Warning: the %s option is not yet implemented (RoRpRq(RRHRRNRs((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyt opt_not_yetfs s-ls--load-averages --max-loadt load_averages--list-actionst list_actionss--list-derivedt list_deriveds --list-wheret list_wheres-os --old-files --assume-oldtold_files --overridetoverrides-ptps-rs-Rs--no-builtin-ruless--no-builtin-variablestno_builtin_ruless--write-filenamestwrite_filenamess-Ws --new-files --assume-news --what-iftnew_files--warn-undefined-variablestwarn_undefined_variablesN(RRmR@RyRxR|R RRR RRRR1R2R3tdefault_max_drifttFileR%t SUPPRESS_HELP(R RltopRtconfig_optionsRtopt_config_helpRRRtopt_debug_helpRRtopt_duplicate_helpRRR t opt_tree_helpRRR((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pytParsers>                                                                                                                               (!t __revision__RXtreR RoRtcompileRRtRt ImportErrorRt SCons.Node.FSRtSCons.WarningsRR R1R2tdiskcheck_typesR RtValuesRRYR@t OptionGroupRet OptionParserRmRRR'(((s>install/lib/scons-1.2.0.d20100117/SCons/Script/SConsOptions.pyss4          {;gw