%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/
Upload File :
Create Path :
Current File : //lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyc

�
vפ\c@sdZddlZddljZddlZddlZddlZddlZe	Z
dZdZdZ
dZdZdZd	Zejj�Ze	ZiZx'd
ddd
dgD]Zdee<q�Wx<ddddddddddddgD]Zdee<q�Wd�Zd�Zd�Zd �Zd!�Zd"�Zd#efd$��YZ d%efd&��YZ!d'�Z"d(�Z#d)�Z$d*�Z%d+�Z&d,�Z'd-�Z(d.�Z)d/�Z*d0�Z+d1�Z,d2�Z-d3�Z.d4�Z/d5efd6��YZ0d7�Z1dS(8s�
This script is intended for use as a GYP_GENERATOR. It takes as input (by way of
the generator flag config_path) the path of a json file that dictates the files
and targets to search for. The following keys are supported:
files: list of paths (relative) of the files to search for.
test_targets: unqualified target names to search for. Any target in this list
that depends upon a file in |files| is output regardless of the type of target
or chain of dependencies.
additional_compile_targets: Unqualified targets to search for in addition to
test_targets. Targets in the combined list that depend upon a file in |files|
are not necessarily output. For example, if the target is of type none then the
target is not output (but one of the descendants of the target will be).

The following is output:
error: only supplied if there is an error.
compile_targets: minimal set of targets that directly or indirectly (for
  targets of type none) depend on the files in |files| and is one of the
  supplied targets or a target that one of the supplied targets depends on.
  The expectation is this set of targets is passed into a build step. This list
  always contains the output of test_targets as well.
test_targets: set of targets from the supplied |test_targets| that either
  directly or indirectly depend upon a file in |files|. This list if useful
  if additional processing needs to be done for certain targets after the
  build, such as running tests.
status: outputs one of three values: none of the supplied files were found,
  one of the include files changed so that it should be assumed everything
  changed (in this case test_targets and compile_targets are not output) or at
  least one file was found.
invalid_targets: list of supplied targets that were not found.

Example:
Consider a graph like the following:
  A     D
 / B   C
A depends upon both B and C, A is of type none and B and C are executables.
D is an executable, has no dependencies and nothing depends on it.
If |additional_compile_targets| = ["A"], |test_targets| = ["B", "C"] and
files = ["b.cc", "d.cc"] (B depends upon b.cc and D depends upon d.cc), then
the following is output:
|compile_targets| = ["B"] B must built as it depends upon the changed file b.cc
and the supplied target A depends upon it. A is not output as a build_target
as it is of type none with no rules and actions.
|test_targets| = ["B"] B directly depends upon the change file b.cc.

Even though the file d.cc, which D depends upon, has changed D is not output
as it was not supplied by way of |additional_compile_targets| or |test_targets|.

If the generator flag analyzer_output_path is specified, output is written
there. Otherwise output is written to stdout.

In Gyp the "all" target is shorthand for the root targets in the files passed
to gyp. For example, if file "a.gyp" contains targets "a1" and
"a2", and file "b.gyp" contains targets "b1" and "b2" and "a2" has a dependency
on "b2" and gyp is supplied "a.gyp" then "all" consists of "a1" and "a2".
Notice that "b1" and "b2" are not in the "all" target as "b.gyp" was not
directly supplied to gyp. OTOH if both "a.gyp" and "b.gyp" are supplied to gyp
then the "all" target includes "b1" and "b2".
i����NsFound dependencysNo dependenciessFound dependency (all)iiiitINTERMEDIATE_DIRtSHARED_INTERMEDIATE_DIRtPRODUCT_DIRtLIB_DIRtSHARED_LIB_DIRs!!!tRULE_INPUT_PATHtRULE_INPUT_ROOTtRULE_INPUT_NAMEtRULE_INPUT_DIRNAMEtRULE_INPUT_EXTtEXECUTABLE_PREFIXtEXECUTABLE_SUFFIXtSTATIC_LIB_PREFIXtSTATIC_LIB_SUFFIXtSHARED_LIB_PREFIXtSHARED_LIB_SUFFIXtCONFIGURATION_NAMEtcCs2tjdkr.tjdkr.|jdd�S|S(s*Converts a path to the format used by gyp.s\t/(tostseptaltseptreplace(tpath((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt
_ToGypPathpscCs�d}x'|jd�r/|d7}|d}q	W|t|�krFdS|t|�kr\|Sdj|dt|�|!�d|S(s�Resolves |path|, which starts with at least one '../'. Returns an empty
  string if the path shouldn't be considered. See _AddSources() for a
  description of |base_path_components|.is../iiRR(t
startswithtlentjoin(Rtbase_path_componentstdepth((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt_ResolveParentws
cCs�x�|D]�}t|�s|jd�s|jd�r>qn|}|d|djdd�}|jd�r�t||�}t|�r|j|�qqn|j||�trdG|G|t|�dGHqqWd	S(
s�Extracts valid sources from |sources| and adds them to |result|. Each
  source file is relative to |base_path|, but may contain '..'. To make
  resolving '..' easier |base_path_components| contains each of the
  directories in |base_path|. Additionally each source may contain variables.
  Such sources are ignored as it is assumed dependencies on them are expressed
  and tracked in some other means.s!!!t$iis//Rs../t	AddSourceN(RRRRtappendtdebug(tsourcest	base_pathRtresulttsourcet
org_source((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt_AddSources�s
+cCs*d|kr&t|d|||�ndS(Ntinputs(R((tactionR$Rtresults((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt_ExtractSourcesFromAction�scCs?||krdS|j|d�r;|t|�td�S|S(s5Converts |path| to a path relative to |toplevel_dir|.RR(RR(ttoplevel_dirR((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt_ToLocalPath�s
cCs�tjt|t|���}|jd�}t|�rF|d7}ntr\dG|G|GHng}d|kr�t|d|||�nd|kr�x(|dD]}t||||�q�Wnd|kr�x(|dD]}t||||�q�Wn|S(NRtExtractSourcesR#tactionstrules(	t	posixpathtdirnameR.RtsplitRR"R(R,(ttargetttarget_dictR-R$RR+R*trule((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt_ExtractSources�s$

tTargetcBseZdZd�ZRS(sAHolds information about a particular target:
  deps: set of Targets this Target depends upon. This is not recursive, only the
    direct dependent Targets.
  match_status: one of the MatchStatus values.
  back_deps: set of Targets that have a dependency on this Target.
  visited: used during iteration to indicate whether we've visited this target.
    This is used for two iterations, once in building the set of Targets and
    again in _GetBuildTargets().
  name: fully qualified name of the target.
  requires_build: True if the target type is such that it needs to be built.
    See _DoesTargetTypeRequireBuild for details.
  added_to_compile_targets: used when determining if the target was added to the
    set of targets that needs to be built.
  in_roots: true if this target is a descendant of one of the root nodes.
  is_executable: true if the type of target is executable.
  is_static_library: true if the type of target is static_library.
  is_or_has_linked_ancestor: true if the target does a link (eg executable), or
    if there is a target in back_deps that does a link.cCsmt�|_t|_t�|_||_t|_t|_t|_	t|_
t|_t|_t|_
dS(N(tsettdepstMATCH_STATUS_TBDtmatch_statust	back_depstnametFalsetvisitedtrequires_buildtadded_to_compile_targetstin_rootst
is_executabletis_static_librarytis_or_has_linked_ancestor(tselfR?((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt__init__�s								(t__name__t
__module__t__doc__RI(((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyR9�stConfigcBs eZdZd�Zd�ZRS(soDetails what we're looking for
  files: set of files to search for
  targets: see file description for details.cCs1g|_t�|_t�|_t�|_dS(N(tfilesR:ttargetstadditional_compile_target_namesttest_target_names(RH((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyRI�s	cCs|jdi�}|jdd�}|s.dSy,t|d�}tj|�}|j�WnMtk
r}td|��n-tk
r�}td|t	|���nXt
|t�s�td��n|jdg�|_t
|jd	g��|_t
|jd
g��|_dS(sfInitializes Config. This is a separate method as it raises an exception
    if there is a parse error.tgenerator_flagstconfig_pathNtrsUnable to open file sUnable to parse config file s7config_path must be a JSON file containing a dictionaryRNtadditional_compile_targetsttest_targets(tgettNonetopentjsontloadtclosetIOErrort	Exceptiont
ValueErrortstrt
isinstancetdictRNR:RPRQ(RHtparamsRRRStftconfigte((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pytInit�s$
(RJRKRLRIRg(((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyRM�s	cCs�t|t|��|kr1tr-dG|GHntSt||d�dkrOtSxh||ddD]T}ttjj||��}t||�|krbtr�dG|GdG|GHntSqbWtS(s�Returns true if the build file |build_file| is either in |files| or
  one of the files included by |build_file| is in |files|. |toplevel_dir| is
  the root of the source tree.sgyp file modifiedtincluded_filesis%included gyp file modified, gyp_file=sincluded file=(	R.RR"tTrueRR@tgyptcommontUnrelativePath(t
build_filetdataRNR-tinclude_filetrel_include_file((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt_WasBuildFileModifiedscCs:||krt||fSt|�}|||<t|fS(s�Creates or returns the Target at targets[target_name]. If there is no
  Target for |target_name| one is created. Returns a tuple of whether a new
  Target was created and the Target.(R@R9Ri(ROttarget_nameR5((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt_GetOrCreateTargetByName,s

cCs2t|ddkp.|jd�p.|jd��S(sBReturns true if the target type is such that it needs to be built.ttypetnoneR0R1(tboolRW(R6((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt_DoesTargetTypeRequireBuild7scCsmi}g}|}i}	t�}
t�}x.t|�dkr[|j�}t||�\}
}|
rw|
j|�n|jr�q.nt|_t||�|_||d}|dk|_	|dk|_
|dkp�|dk|_tj
j|�d}||	kr't||||�|	|<n||krC|j|�n|	|rodG|GHt|_|j|�npt||||�}xW|D]O}ttjj|��|kr�dG|GdG|GHt|_|j|�Pq�q�Wxv||jd	g�D]^}|j|�t||�\}}|s4|
j|�n|jj|�|jj|�q�Wq.W|||
|@fS(
s�Returns a tuple of the following:
  . A dictionary mapping from fully qualified name to Target.
  . A list of the targets that have a source file in |files|.
  . Targets that constitute the 'all' target. See description at top of file
    for details on the 'all' target.
  This sets the |match_status| of the targets that contain any of the source
  files in |files| to MATCH_STATUS_MATCHES.
  |toplevel_dir| is the root of the source tree.iRtt
executabletstatic_librarytshared_librarys(matching target from modified build fileR5tmatchestdependencies(R:RtpopRstaddRARiRwRBRERFRGRjRktParseQualifiedTargetRqtMATCH_STATUS_MATCHESR=R!R8RRRtnormpathRWtdiscardR;R>(Rnttarget_listttarget_dictsR-RNtbuild_filestname_to_targettmatching_targetsttargets_to_visittbuild_file_in_filestrootstbuild_file_targetsRrtcreated_targetR5ttarget_typeRmR#R&tdeptcreated_dep_targett
dep_target((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt_GenerateTargets>s`				
		
	
	

cCs�i}|sigfSt|�}x~|j�D]p}tjj|�}t|�dkr/|d|kr/|j|d�||||d<|s�|gfSq/q/W|g|D]}|^q�fS(s�Returns a tuple of the following:
  . mapping (dictionary) from unqualified name to Target for all the
    Targets in |to_find|.
  . any target names not found. If this is empty all targets were found.i(R:tkeysRjRkRRtremove(tall_targetstto_findR%Rrt	extractedtx((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt_GetUnqualifiedToTargetMapping�s
"cCs�|jtkrtS|jtks1|jtkr5tSxA|jD]6}t|�r?t|_dG|jGdG|jGHtSq?Wt|_tS(s�Returns true if |target| or any of its dependencies is one of the
  targets containing the files supplied as input to analyzer. This updates
  |matches| of the Targets as it recurses.
  target: the Target to look for.s	smatches by dep(	R=tMATCH_STATUS_DOESNT_MATCHR@R�t"MATCH_STATUS_MATCHES_BY_DEPENDENCYRiR;t"_DoesTargetDependOnMatchingTargetsR?(R5R�((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyR��s		cCs<g}dGHx*|D]"}t|�r|j|�qqW|S(s�Returns the list of Targets in |possible_targets| that depend (either
  directly on indirectly) on at least one of the targets containing the files
  supplied as input to analyzer.
  possible_targets: targets to search from.s#Targets that matched by dependency:(R�R!(tpossible_targetstfoundR5((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt%_GetTargetsDependingOnMatchingTargets�s
c	Cs.|jr
dSt|_||k|_xZ|jD]O}t||t|�|j|jO_|j|jO_|j|jO_q/W|jr*|js�|jr�|s�|j	s�|j
r*|r*|jr*dG|jGdG|jGdG|jGdG|GdG|j	GdG|j
GdG|jGH|j|�t|_ndS(	saRecurses through all targets that depend on |target|, adding all targets
  that need to be built (and are in |roots|) to |result|.
  roots: set of root targets.
  add_if_no_ancestor: If true and there are no ancestors of |target| then add
  |target| to |result|. |target| must still be in |roots|.
  result: targets that need to be built are added here.Ns		adding to compile targetsRxRCtadd_if_no_ancestorRBRFRG(
RARiRDR>t_AddCompileTargetsR@RCRGRERBRFR?R~(R5R�R�R%tback_dep_target((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyR��s0				


cCs=t�}x-|D]%}dG|jGHt||t|�qW|S(s�Returns the set of Targets that require a build.
  matching_targets: targets that changed and need to be built.
  supplied_targets: set of targets supplied to analyzer to search from.s!finding compile targets for match(R:R?R�Ri(R�tsupplied_targetsR%R5((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt_GetCompileTargets�s
	
cKsd|krdG|dGHnd|kr4|dGHnd|krt|dj�dGHx|dD]}dG|GHq^Wnd|kr�|dj�dGHx|dD]}dG|GHq�Wnd	|kr�|d	j�d
GHx|d	D]}dG|GHq�Wnd|kr4|dj�dGHx|dD]}dG|GHqWnd
|krt|d
j�dGHx|d
D]}dG|GHq^Wn|jdi�jdd�}|s�tj|�GHdSy7t|d�}|jtj|�d�|j�Wn&tk
r	}dG|Gt	|�GHnXdS(s;Writes the output, either to stdout or a file is specified.terrorsError:tstatusROs.Supplied targets that depend on changed files:s	tinvalid_targetss%The following targets were not found:t
build_targetssTargets that require a build:tcompile_targetssTargets that need to be built:RVs
Test targets:RRtanalyzer_output_pathNtws
sError writing to output file(
tsortRWRXRZtdumpsRYtwriteR\R]R`(RctvaluesR5toutput_pathRdRf((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt_WriteOutput�sPcCsW|djrSxC|djD]1}ttjj|��|krdG|GHtSqWntS(sNReturns true if one of the files in |files| is in the set of included
  files.toptionss+Include file modified, assuming all changed(tincludesRRRR�RiR@(RcRNtinclude((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt_WasGypIncludeFileModified)s
	cCs#g|D]}||kr|^qS(sBReturns a list of the values in |names| that are not in |mapping|.((tnamestmappingR?((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt_NamesNotIn4scCs'g|D]}||kr||^qS(sUReturns a list of the mapping[name] for each value in |names| that is in
  |mapping|.((R�R�R?((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt_LookupTargets9scCs�tjj|�}|dkr1|jdd�n�|dkr�|jdd�ddljj}t|dg�}t|dg�}tjj	||�n+|}|dkr�d	}n|jd|�dS(
sDCalculate additional variables for use in the build (called by gyp).tmactOStwini����Nt+generator_additional_non_configuration_keyst"generator_additional_path_sectionstandroidtlinux(
RjRkt	GetFlavort
setdefaulttgyp.generator.msvst	generatortmsvstgetattrtmsvs_emulationtCalculateCommonVariables(tdefault_variablesRctflavortmsvs_generatorR�R�toperating_system((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pytCalculateVariables?s	tTargetCalculatorcBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(sBCalculates the matching test_targets and matching compile_targets.c		Csyt|�|_t|�|_t||||t|�|�\|_|_|_t|j|j	��\|_
|_dS(N(R:t _additional_compile_target_namest_test_target_namesR�t	frozensett_name_to_targett_changed_targetst
_root_targetsR�t_supplied_target_names_no_allt_unqualified_mappingR�(	RHRNRPRQRnR�R�R-R�((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyRIXs$	cCs|j|jBS(N(R�R�(RH((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt_supplied_target_namescscCs|j�}|jd�|S(s0Returns the supplied test targets without 'all'.tall(R�R�(RHR%((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyR�fs
cCs|jS(s;Returns true if the supplied files impact the build at all.(R�(RH((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pytis_build_impactedlscCs�|j�st�t|j�}|jd�t||j�}d|jk}|r�gt|�t|j�BD]}|^qo}ng|D]}|^q�}dGHx|jD]}dG|GHq�WdGHx|D]}dG|jGHq�WdGHt	|�}|ot|�t|j�@}	|	rCgt|�t|�@D]}|^q.}ndGHx|D]}dG|jGHqOWg|D]}t
jj|j�d^ql}
|	r�|
j
d�dGHn|
S(	s'Returns the set of output test targets.R�ssupplied test_targetss	sfound test_targetss#searching for matching test targetssmatched test_targetsis	all(R�tAssertionErrorR:R�R�R�R�R�R?R�RjRkRR!(RHttest_target_names_no_allttest_targets_no_allttest_target_names_contains_allR�RVRrR5tmatching_test_targetst"matching_test_targets_contains_alltmatching_target_names((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pytfind_matching_test_target_namespsB
#

	 
)
cCs�|j�st�x |jj�D]}t|_q"Wt|j�|j�}d|j	�kr�gt
|�t
|j�BD]}|^qy}ndGHx|D]}dG|jGHq�WdGHt
|j|�}g|D]}tjj|j�d^q�S(s*Returns the set of output compile targets.R�s'Supplied test_targets & compile_targetss	sFinding compile targetsi(R�R�R�t
itervaluesR@RAR�R�R�R�R:R�R?R�R�RjRkR(RHR5R�R�R�((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt"find_matching_compile_target_names�s 
#
		(	RJRKRLRIR�R�R�R�R�(((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyR�Vs					+c
Cs�t�}y�|j|�|js1td��nttjj|dj��}t	rbdG|GHnt
||j�r�itd6t|j
�d6t|j|j
B�d6}t||�dSt|j|j|j
|||||d�}|j�s8itd6gd6gd6}|jr'|j|d	<nt||�dS|j�}|j�}	|	pY|}
i|d6|
rrtntd6tt|	�t|�B�d6}|jr�|j|d	<nt||�Wn)tk
r�}t|d
t|��nXdS(s2Called by gyp as the final stage. Outputs results.s<Must specify files to analyze via config_path generator flagR�R-R�RVR�NR�R�R�(RMRgRNR^RRRtabspathR-R"R�tall_changed_stringtlistRQRPR�R�R�tno_dependency_stringR�R�R�tfound_dependency_stringR:R`(R�R�RnRcReR-tresult_dictt
calculatorRQtcompile_target_namestfound_at_least_one_targetRf((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pytGenerateOutput�sT	
	

			


	

		(2RLt
gyp.commonRjtgyp.ninja_syntaxtninja_syntaxRZRR2tsysR@R"R�R�R�R�R�R�R<RktCrossCompileRequestedt$generator_supports_multiple_toolsetst4generator_wants_static_library_dependencies_adjustedtgenerator_default_variablesR3tunusedRRR(R,R.R8tobjectR9RMRqRsRwR�R�R�R�R�R�R�R�R�R�R�R�R�(((s[/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/generator/analyzer.pyt<module>?sf
							#!				V			
	*		-				\

Zerion Mini Shell 1.0