Ë
    Ï"Kb`%  ã                   óR   — d Z ddlZddlZddddddœZd„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Z	d„ Z
y)z8Utility functions shared amongst the Windows generators.é    NÚexeÚdllÚlibÚsys)Ú
executableÚloadable_moduleÚshared_libraryÚstatic_libraryÚwindows_driverc                  ó„  — t         j                  j                  t         j                  j                  t        «      «      } t         j                  j                  t         j                  j                  | dd«      «      }t         j                  j                  |dd«      }t         j                  j                  |d«      }|S )z/Returns the path of the large_pdb_shim.cc file.z..ÚdataÚwinzlarge-pdb-shim.cc)ÚosÚpathÚabspathÚdirnameÚ__file__Újoin)Úthis_dirÚsrc_dirÚwin_data_dirÚlarge_pdb_shim_ccs       ú./usr/lib/python3/dist-packages/gyp/MSVSUtil.pyÚ_GetLargePdbShimCcPathr      sv   € ä�W‰W�_‰_œRŸW™WŸ_™_¬XÓ6Ó7€(Ü�G‰G�O‰OœBŸG™GŸL™L¨°4¸Ó>Ó?€'Ü—‘—‘˜g v¨uÓ5€,Ü—g‘g—l‘l <Ð1DÓEÐØ	Ðó    c                 óX   — i }|D ]"  }|| vrŒt        j                  | |   «      ||<   Œ$ |S )a-  Performs a partial deep-copy on |in_dict|, only copying the keys in |keys|.

  Arguments:
    in_dict: The dictionary to copy.
    keys: The keys to be copied. If a key is in this list and doesn't exist in
        |in_dict| this is not an error.
  Returns:
    The partially deep-copied dictionary.
  )ÚcopyÚdeepcopy)Úin_dictÚkeysÚdÚkeys       r   Ú_DeepCopySomeKeysr#      s@   € ð 	€!Øò )€cØ
�'ÑØÜ�]‰]˜7 3™<Ó(€A€c‚Fð)ð 
€(r   c                 ób   — | j                  dd«      }|d   ›d|›�|d<   dj                  |«      S )zÃAdd a suffix to the end of a target.

  Arguments:
    name: name of the target (foo#target)
    suffix: the suffix to be added
  Returns:
    Target name with suffix added (foo_suffix#target)
  ú#é   r   Ú_)Úrsplitr   )ÚnameÚsuffixÚpartss      r   Ú_SuffixNamer,   0   s4   € ð �+‰+�c˜1Ó
€%Ø˜a›¡&Ð)€%ˆ�(Ø	�‰�%‹Ðr   c                 ó,   — t        | t        |«      «      S )z¹Add a shard number to the end of a target.

  Arguments:
    name: name of the target (foo#target)
    number: shard number
  Returns:
    Target name with shard added (foo_1#target)
  )r,   Ústr)r)   Únumbers     r   Ú
_ShardNamer0   >   s   € ô 
�Tœ3˜v›;Ó	'Ð'r   c           
      óœ  — i }|D ](  }t        ||   j                  dd«      «      }|sŒ$|||<   Œ* g }| D ]F  }||v r/t        ||   «      D ]  }|j                  t	        ||«      «       Œ Œ6|j                  |«       ŒH i }|D ]²  }||v r¤t        ||   «      D ]’  }t	        ||«      }t        j
                  ||   «      ||<   t	        ||   d   |«      ||   d<   ||   j                  dg «      }	g }
t        |t        |	«      ||   «      D ]  }|
j                  |	|   «       Œ |
||   d<   Œ” Œ«||   ||<   Œ´ t        |«      D ]†  }dD ]  }t        j
                  ||   j                  |g «      «      }g }|D ]F  }||v r/t        ||   «      D ]  }|j                  t	        ||«      «       Œ Œ6|j                  |«       ŒH |||   |<   Œ� Œˆ ||fS )a  Shard some targets apart to work around the linkers limits.

  Arguments:
    target_list: List of target pairs: 'base/base.gyp:base'.
    target_dicts: Dict of target properties keyed on target pair.
  Returns:
    Tuple of the new sharded versions of the inputs.
  Ú
msvs_shardr   Útarget_nameÚsources)ÚdependenciesÚdependencies_original)ÚintÚgetÚrangeÚappendr0   r   ÚlenÚsorted)Útarget_listÚtarget_dictsÚtargets_to_shardÚtÚshardsÚnew_target_listÚiÚnew_target_dictsr)   r4   Únew_sourcesÚposÚdeptyper5   Únew_dependenciesr!   s                   r   ÚShardTargetsrI   J   sW  € ð ÐØò #€aÜ�˜a‘×$Ñ$ \°1Ó5Ó6€FÚØ"Ð�qÒð#ð
 €/Øò  €aØÐÑÜÐ% aÑ(Ó)ò 1ˆ!Ø×Ñœz¨!¨QÓ/Õ0ñ1ð ×Ñ˜QÕð ð ÐØò ,€aØÐÑÜÐ% aÑ(Ó)ò 	8ˆ!Ü˜!˜QÓˆÜ!%§¡¨<¸©?Ó!;Ð˜ÑÜ0:Ø˜dÑ# MÑ2°Aó17Ð˜Ñ˜}Ñ-à" 4Ñ(×,Ñ,¨Y¸Ó;ˆØˆÜ˜œC ›LÐ*:¸1Ñ*=Ó>ò 	+ˆCØ
×
Ñ
˜W S™\Õ
*ð	+à,7Ð˜Ñ˜yÒ)ñ	8ð )¨™OÐ�qÒð,ô Ð"Ó#ò 
6€aØ<ò 	6ˆÜ—Y‘YÐ/°Ñ2×6Ñ6°wÀÓCÓD€lØÐØò %ˆ!ØÐ Ñ ÜÐ)¨!Ñ,Ó-ò 6ˆaØ×#Ñ#¤J¨q°!Ó$4Õ5ñ6ð ×
!Ñ
! !Õ
$ð%ð &6Ð�qÑ˜'Ò"ñ	6ð
6ð Ð+Ð	,Ð,r   c                 ó<  — | d   |   }|j                  di «      }|j                  di «      }|j                  d«      }|r|S | j                  di «      }|j                  dd«      }|r|S | j                  d| d	   «      }|›d
t        | d      ›d�}|d   dz   |z   }|S )a“  Returns the path to the PDB file that will be generated by a given
  configuration.

  The lookup proceeds as follows:
    - Look for an explicit path in the VCLinkerTool configuration block.
    - Look for an 'msvs_large_pdb_path' variable.
    - Use '<(PRODUCT_DIR)/<(product_name).(exe|dll).pdb' if 'product_name' is
      specified.
    - Use '<(PRODUCT_DIR)/<(target_name).(exe|dll).pdb'.

  Arguments:
    target_dict: The target dictionary to be searched.
    config_name: The name of the configuration of interest.
    vars: A dictionary of common GYP variables with generator-specific values.
  Returns:
    The path of the corresponding PDB file.
  ÚconfigurationsÚmsvs_settingsÚVCLinkerToolÚProgramDatabaseFileÚ	variablesÚmsvs_large_pdb_pathNÚproduct_namer3   ú.Útypez.pdbÚPRODUCT_DIRú/)Ú
setdefaultr8   ÚTARGET_TYPE_EXT)	Útarget_dictÚconfig_nameÚvarsÚconfigÚmsvsÚlinkerÚpdb_pathrO   Úpdb_bases	            r   Ú_GetPdbPathr`   �   sº   € ð$ Ð'Ñ(¨Ñ5€&Ø	×	Ñ	˜?¨BÓ	/€$à�8‰8�N BÓ'€&à�Z‰ZÐ-Ó.€(ÙØ€Oà�o‰o˜k¨2Ó.€)Ø�]‰]Ð0°$Ó7€(ÙØ€Oð �_‰_˜^¨[¸Ñ-GÓH€(Ú$¤o°kÀ&Ñ6IÓ&JÐK€(Ø�-Ñ  3Ñ&¨Ñ1€(à	€/r   c                 ó^  — g }|D ]4  }||   }t        |j                  dd«      «      sŒ$|j                  |«       Œ6 t        «       }|D �]ß  }||   }|j                  d«      }t	        |g d¢«      }d}	|dz   |	z   }
t        ||	«      }t        j                  j                  |«      }|d   dz   |
z   }|dz   |z   }t        j                  |«      }|
|d<   d	|d
<   |g|d<   ||gdœg|d<   d}|dz   |z   }t        ||«      }t        j                  |«      }||d<   d|d
<   |g|d<   |g|d<   |j                  d«      j                  «       D ]�  \  }}t        |||«      }dD ]  }|j                  |d«       Œ |j                  di «      }|j                  di «      }d|d<   ||d<   |d   |   }|j                  di «      }|j                  di «      }d|d<   ||d<   Œ‘ | j                  d|«       | j                  d|«       |||<   |||<   |j                  dg «      j                  |«       �Œâ | |fS )aï  Insert a shim target that forces the linker to use 4KB pagesize PDBs.

  This is a workaround for targets with PDBs greater than 1GB in size, the
  limit for the 1KB pagesize PDBs created by the linker by default.

  Arguments:
    target_list: List of target pairs: 'base/base.gyp:base'.
    target_dicts: Dict of target properties keyed on target pair.
    vars: A dictionary of common GYP variables with generator-specific values.
  Returns:
    Tuple of the shimmed version of the inputs.
  Úmsvs_large_pdbr   r3   )rK   Údefault_configurationÚtoolsetÚlarge_pdb_copyr'   ÚSHARED_INTERMEDIATE_DIRrU   ÚnonerS   r4   )ÚdestinationÚfilesÚcopiesÚlarge_pdb_shimr
   r5   rK   )Úmsvs_precompiled_headerÚmsvs_precompiled_sourceÚtestNrL   ÚVCCLCompilerToolÚ3ÚDebugInformationFormatÚProgramDataBaseFileNamerM   ÚtrueÚGenerateDebugInformationrN   )r7   r8   r:   r   r#   r,   r   r   Úbasenamer   r   Úitemsr`   ÚpoprV   Úinsert)r=   r>   rZ   Útargets_to_shimr@   rX   r   r3   Ú	base_dictÚcopy_suffixÚcopy_target_nameÚfull_copy_target_nameÚshim_cc_basenameÚshim_cc_dirÚshim_cc_pathÚ	copy_dictÚshim_suffixÚshim_target_nameÚfull_shim_target_nameÚ	shim_dictrY   r[   r^   r"   r\   Úcompilerr]   s                              r   ÚInsertLargePdbShimsr‡   ©   sÝ  € ð €/Øò 
€aØ˜q‘/€Kô ˆ{�‰Ð/°Ó3Ô4Øð
 ×Ñ˜1Õð
ô -Ó.Ðàó GM€aØ˜q‘/€KØ—/‘/ -Ó0€Kä! +Ú
@óB€Ið #€KØ" SÑ(¨;Ñ6ÐÜ'¨¨;Ó7ÐÜ—w‘w×'Ñ'Ð(9Ó:ÐØÐ0Ñ1°CÑ7Ð:JÑJ€KØ Ñ$Ð'7Ñ7€LÜ—‘˜iÓ(€IØ/€IˆmÑØ€IˆfÑØ.Ð0€IˆiÑà Ø"Ð$ñð €IˆhÑð #€KØ" SÑ(¨;Ñ6ÐÜ'¨¨;Ó7ÐÜ—‘˜iÓ(€IØ/€IˆmÑØ(€IˆfÑØ)Ð+€IˆiÑØ"7Ð 9€IˆnÑð  )Ÿ}™}Ð-=Ó>×DÑDÓFò /Ñˆ�VÜ˜[¨+°tÓ<€hð Pò ˆ#Ø�
‰
�3˜Õðð ×Ñ˜°Ó3€dð —‘Ð!3°RÓ8€hØ+.€hÐ'Ñ(Ø,4€hÐ(Ñ)ð Ð+Ñ,¨[Ñ9€fØ×Ñ˜°Ó3€dØ�‰˜~¨rÓ2€fØ+1€fÐ'Ñ(Ø&.€fÐ"Ò#ð)/ð0 ×Ñ�qÐ/Ô0Ø×Ñ�qÐ/Ô0Ø*3€LÐ&Ñ'Ø*3€LÐ&Ñ'ð ×Ñ˜>¨2Ó.×5Ñ5Ð6KÖLðOGMðR �|Ð	$Ð$r   )Ú__doc__r   r   rW   r   r#   r,   r0   rI   r`   r‡   © r   r   ú<module>rŠ      sN   ðñ
 ?ã Û 	ð
 ØØØØñ€òòò$ò	(ò4-òn%óPf%r   