
    擖g2                         S r SSKrSSKrSSKrSSKJr  SSKrS r\R                  " 5         SSS.r
SS jr " S	 S
5      r " S S\5      r " S S\5      r " S S5      rg)z7New implementation of Visual Studio project generation.    N)
attrgetterc                     X:  X:  -
  $ N )xys     -/usr/lib/python3/dist-packages/gyp/MSVSNew.pycmpr
      s    Eae    z&{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}z&{2150E333-8FDC-42A3-9474-1A3956D46DE8})projectfolderc                    [         R                  " [        U5      [        U 5      -   R                  S5      5      R	                  5       R                  5       nSUSS -   S-   USS -   S-   USS -   S-   USS -   S-   USS	 -   S
-   nU$ )a  Returns a GUID for the specified target name.

Args:
  name: Target name.
  seed: Seed for MD5 hash.
Returns:
  A GUID-line string calculated from the name and seed.

This generates something which looks like a GUID, but depends only on the
name and seed.  This means the same name/seed will always generate the same
GUID, so that projects and solutions which refer to each other can explicitly
determine the GUID to refer to explicitly.  It also means that the GUID will
not change when the project for a target is rebuilt.
zutf-8{N   -             })hashlibmd5strencode	hexdigestupper)nameseeddguids       r	   MakeGuidr!       s      	SYT*227;<FFHNNPA 	
BQ%	
	 Ab'	 		
 Br(	 	 Br(	 	 Br(		 
	 	 Kr   c                       \ rS rSrS rSrg)MSVSSolutionEntryE   c                     [        U R                  U R                  5       4UR                  UR                  5       45      $ r   )r
   r   get_guid)selfothers     r	   __cmp__MSVSSolutionEntry.__cmp__F   s.    DIIt}}/%**enn>N1OPPr   r   N)__name__
__module____qualname____firstlineno__r)   __static_attributes__r   r   r	   r#   r#   E   s    Qr   r#   c                   (    \ rS rSrSrSS jrS rSrg)
MSVSFolderK   z.Folder in a Visual Studio project or solution.Nc                    U(       a  X l         O$[        R                  R                  U5      U l         Xl        X@l        [        U=(       d    / [        S5      S9U l        [        U=(       d    / 5      U l	        [        S   U l        g)a  Initializes the folder.

Args:
  path: Full path to the folder.
  name: Name of the folder.
  entries: List of folder entries to nest inside this folder.  May contain
      Folder or Project objects.  May be None, if the folder is empty.
  guid: GUID to use for folder, if not None.
  items: List of solution items to include in the folder project.  May be
      None, if the folder does not directly contain items.
pathkeyr   N)r   osr4   basenamer    sortedr   entrieslistitemsENTRY_TYPE_GUIDSentry_type_guid)r'   r4   r   r:   r    r<   s         r	   __init__MSVSFolder.__init__N   sd     I ((.DI		 gmF1CD%+2&
/9r   c                 f    U R                   c  [        U R                  SS9U l         U R                   $ )Nmsvs_folder)r   )r    r!   r4   r'   s    r	   r&   MSVSFolder.get_guidi   s(    99 ?DIyyr   )r:   r>   r    r<   r   r4   )NNNN)r+   r,   r-   r.   __doc__r?   r&   r/   r   r   r	   r1   r1   K   s    8:6r   r1   c                   B    \ rS rSrSr       S	S jrS rS rS rSr	g)
MSVSProjects   zVisual Studio project.Nc	                 `   Xl         X@l        XPl        X`l        U=(       d?    [        R                   R                  [        R                   R                  U5      5      S   U l        [        U=(       d    / 5      U l	        [        S   U l        U(       a  Xpl        O0 U l        Xl        SU l        g)a  Initializes the project.

Args:
  path: Absolute path to the project file.
  name: Name of project.  If None, the name will be the same as the base
      name of the project file.
  dependencies: List of other Project objects this project is dependent
      upon, if not None.
  guid: GUID to use for project, if not None.
  spec: Dictionary specifying how to build this project.
  build_file: Filename of the .gyp file that the vcproj file comes from.
  config_platform_overrides: optional dict of configuration platforms to
      used in place of the default for this target.
  fixpath_prefix: the path used to adjust the behavior of _fixpath
r   r   N)r4   r    spec
build_filer7   splitextr8   r   r;   dependenciesr=   r>   config_platform_overridesfixpath_prefixmsbuild_toolset)	r'   r4   r   rM   r    rJ   rK   rN   rO   s	            r	   r?   MSVSProject.__init__v   s    4 			$GBGG,,RWW-=-=d-CDQG	 !!34/	:$-F*-/D*,#r   c                 6    [        U=(       d    / 5      U l        g r   )r;   rM   )r'   rM   s     r	   set_dependenciesMSVSProject.set_dependencies   s     !34r   c                 h    U R                   c  [        U R                  5      U l         U R                   $ r   )r    r!   r   rC   s    r	   r&   MSVSProject.get_guid   s(    99 !+DIyyr   c                     Xl         g r   )rP   )r'   rP   s     r	   set_msbuild_toolsetMSVSProject.set_msbuild_toolset   s    .r   )
rK   rN   rM   r>   rO   r    rP   r   r4   rJ   )NNNNNNN)
r+   r,   r-   r.   rE   r?   rS   r&   rX   r/   r   r   r	   rG   rG   s   s1     
 "&+$Z5"/r   rG   c                   X    \ rS rSrSr SS jr\R                  R                  4S jr	Sr
g)MSVSSolution   zVisual Studio solution.Nc                     Xl         XPl        X l        [        U=(       d    / 5      U l        U(       a  USS U l        O	SS/U l        U R                  5         g)a  Initializes the solution.

Args:
  path: Path to solution file.
  version: Format version to emit.
  entries: List of entries in solution.  May contain Folder or Project
      objects.  May be None, if the folder is empty.
  variants: List of build variant strings.  If none, a default list will
      be used.
  websiteProperties: Flag to decide if the website properties section
      is generated.
NzDebug|Win32zRelease|Win32)r4   websitePropertiesversionr;   r:   variantsWrite)r'   r4   r_   r:   r`   r^   s         r	   r?   MSVSSolution.__init__   sM     	!2 GMr*$QKDM +O<DM 	

r   c                 n
   [        5       nU R                  SS nU(       aU  UR                  S5      nXB;   a  M  UR                  U5        [	        U[
        5      (       a  X4R                  -  nU(       a  MU  [        U[        S5      S9nU" U R                  5      nUR                  SU R                  R                  5       -  5        UR                  SU R                  R                  5       -  5        [        R                  R                  U R                  5      S   nU GH  n[        R                   R#                  UR                  U5      nUR%                  SS5      =(       d    S	nUR                  S
UR&                  < SUR(                  < SU< SUR+                  5       < S3	5        U R,                  (       a  UR                  S5        [	        U[
        5      (       a^  UR.                  (       aM  UR                  S5        UR.                   H  n	UR                  SU	 SU	 S35        M     UR                  S5        [	        U[0        5      (       az  UR2                  (       ai  UR                  S5        UR2                   H7  n
UR                  SU
R+                  5        SU
R+                  5        S35        M9     UR                  S5        UR                  S5        GM     UR                  S5        UR                  S5        U R4                   H  nUR                  SU SU S35        M     UR                  S5        / n0 nU HU  n[	        U[0        5      (       d  M  UR7                  UR+                  5       5        UR8                  XR+                  5       '   MW     UR;                  5         UR                  S5        U He  nU R4                   HR  nX   R=                  X5      nUR                  SU< S	U< SU< S35        UR                  SU< S	U< SU< S35        MT     Mg     UR                  S5        UR                  S5        UR                  S5        UR                  S5        [?        S U 5       5      (       a  UR                  S5        U Ha  n[	        U[
        5      (       d  M  UR                   H7  nUR                  SUR+                  5        SUR+                  5        S35        M9     Mc     UR                  S5        UR                  S 5        URA                  5         g)!zZWrites the solution file to disk.

Raises:
  IndexError: An entry appears multiple times.
Nr   r4   r5   z:Microsoft Visual Studio Solution File, Format Version %s
z# %s
/\.z	Project("z") = "z", "z"
z	ProjectSection(WebsiteProperties) = preProject
		Debug.AspNetCompiler.Debug = "True"
		Release.AspNetCompiler.Debug = "False"
	EndProjectSection
z-	ProjectSection(SolutionItems) = preProject
z		z = z
z	EndProjectSection
z4	ProjectSection(ProjectDependencies) = postProject
zEndProject
zGlobal
z>	GlobalSection(SolutionConfigurationPlatforms) = preSolution
z	EndGlobalSection
z>	GlobalSection(ProjectConfigurationPlatforms) = postSolution
z.ActiveCfg = z.Build.0 = z2	GlobalSection(SolutionProperties) = preSolution
z		HideSolutionNode = FALSE
c              3   h   #    U  H(  n[        U[        5      (       d  M  UR                  v   M*     g 7fr   )
isinstancer1   r:   ).0es     r	   	<genexpr>%MSVSSolution.Write.<locals>.<genexpr>b  s     K+QAz1Jyqyy+s   22z.	GlobalSection(NestedProjects) = preSolution
zEndGlobal
)!setr:   popaddrh   r1   r9   r   r4   writer_   SolutionVersionDescriptionr7   splitgypcommonRelativePathreplacer>   r   r&   r^   r<   rG   rM   r`   appendrN   sortgetanyclose)r'   writerall_entriesentries_to_checkrj   fsln_rootrelative_pathfolder_nameir   vconfig_guidsconfig_guids_overridesgnvsubentrys                    r	   ra   MSVSSolution.Write   s0    e<<? $$Q'A OOA !Z(( II-   [j.@A 499	$&*ll&B&B&DE	
 	

T\\55778 77==+A.AJJ33AFFHEM (//T:AcKGG %%FFJJL %%. !Z((QWWJKAGGd1#S401 !12![))annQRAGGd1::<.AJJL>FG (12GG$%I N 	
 	
STAGGd1#S4() 	() !#A![))##AJJL1787R7R&zz|4  		STA]]+.2218  	  	 # . 	
() 	
GH	23	() K+KKKGGGH !!Z00 !		HGGd8#4#4#6"7s1::<.MN !* !
 GG,-	 		r   )r:   r4   r`   r_   r^   )NNT)r+   r,   r-   r.   rE   r?   rt   ru   WriteOnDiffra   r/   r   r   r	   r[   r[      s'    ! MQ#J ::11 Gr   r[   )msvs_new)rE   r   r7   randomoperatorr   
gyp.commonrt   r
   r   r=   r!   r#   r1   rG   r[   r   r   r	   <module>r      su   
 >  	   
  86 JQ Q"" "PE/# E/Vo or   