
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
U
    •V.a  ã                    @   sÌ  d Z zddlZW n ek
r$   Y nX ddlZddlZddlZddlZddlZddlm	Z	 ddl
ZddlmZ ddlmZmZmZ ddlmZ ddlmZ ddlmZ zddlZW n ek
rÎ   ddlZY nX dd	lmZ ddlZe d
¡ZddddddddddddddddddddddddddddddddœZdZdZ d Z!d!d"„ Z"d@d$d%„Z#d&d'„ Z$d(d)„ Z%d*d+„ Z&d,d-„ Z'd.d/„ Z(d0d1„ Z)d2d3„ Z*d4d5„ Z+d6d7„ Z,d8d9„ Z-d:d;„ Z.G d<d=„ d=e	ƒZ/G d>d?„ d?e0ƒZ1dS )Aa¹  The code in this module is mostly copy/pasted out of the distutils2 source
code, as recommended by Tarek Ziade.  As such, it may be subject to some change
as distutils2 development continues, and will have to be kept up to date.

I didn't want to use it directly from distutils2 itself, since I do not want it
to be an installation dependency for our packages yet--it is still too unstable
(the latest version on PyPI doesn't even install).
é    N)Údefaultdict)Úlog)ÚDistutilsOptionErrorÚDistutilsModuleErrorÚDistutilsFileError)Úmanifest_maker)ÚDistribution)Ú	Extension)Úextra_filesz\s*(.*?)\s*\((.*)\)\s*$)Úmetadata)r   Ú	home_page)r   Úsummary)r   Údescription)r   Ú
classifier)r   Úplatform)r   Úrequires_dist)r   Úsetup_requires_dist)r   Úprovides_dist)r   Úobsoletes_dist)ÚfilesÚpackages_root)r   )r   Úmodules)ÚglobalÚcommands)Úbackwards_compatÚuse_2to3)r   Úzip_safe)r   Útests_require)r   )ÚnameÚversionÚauthorÚauthor_emailÚ
maintainerÚmaintainer_emailÚurlr   ÚkeywordsÚlong_descriptionzdownload-urlÚclassifiersÚ	platformsÚlicenseÚinstall_requiresÚsetup_requiresÚprovidesÚ	obsoletesÚpackage_dirÚpackagesÚpackage_dataÚnamespace_packagesÚ
data_filesÚscriptsÚ
py_modulesÚcmdclassr   r   r   Údependency_linksÚinclude_package_data)r'   r(   r*   r,   r-   r1   r/   r0   r2   r3   r4   r6   r+   r   r5   )r   r   r7   )r%   c              	   C   sÒ   |   d¡}t|ƒd }|d|… }|d }|dkr�ztd |¡|gd�}W q�W q* tk
rŒ   |dkrh‚ |d8 }|d|… }|| }d}Y q*X q*||d… D ]0}zt||ƒ}W qœ tk
rÊ   t| ƒ‚Y qœX qœ|S )z�Resolve a name like ``module.object`` to an object and return it.

    Raise ImportError if the module or name is not found.
    Ú.é   Néÿÿÿÿr   )ÚfromlistÚ )ÚsplitÚlenÚ
__import__ÚjoinÚImportErrorÚgetattrÚAttributeError)r   ÚpartsÚcursorÚmodule_nameÚ	attr_nameÚretÚpart© rJ   ú9/opt/alt/python38/lib/python3.8/site-packages/pbr/util.pyÚresolve_namež   s*    
rL   ú	setup.cfgc              	   C   sÂ  t  ¡ }tj | ¡s(tdtj | ¡ ƒ‚| | ¡ i }| ¡ D ]}t	| 
|¡ƒ||< q>t|ddƒ}t|ddƒ}|rŒtj |¡}tj d|¡ �z|�r&dd„ t|ƒD ƒ}|D ]x}t|ƒ}z||ƒ W q¬ tk
râ   t d	¡ Y q¬   t ¡ d
 }t d||f ¡ t t ¡ ¡ t d
¡ Y q¬X q¬tj |¡ t|ƒ}	d|	d< d|	d< t|ƒ t|ƒ}
|
�rh|
|	d< t|ƒ}|�r~||	d< t|	ƒ t|ddƒ}|�r¦t  !t|ƒ¡ W 5 |�r¼tj d¡ X |	S )aP   Distutils2 to distutils1 compatibility util.

        This method uses an existing setup.cfg to generate a dictionary of
        keywords that can be used by distutils.core.setup(kwargs**).

        :param file:
            The setup.cfg path.
        :raises DistutilsFileError:
            When the setup.cfg file is not found.

    zfile '%s' does not existr   Úsetup_hooksr   r   r   c                 S   s   g | ]}|d kr|‘qS )zpbr.hooks.setup_hookrJ   )Ú.0ÚhookrJ   rJ   rK   Ú
<listcomp>â   s   ÿzcfg_to_args.<locals>.<listcomp>z)setup hook %s terminated the installationr9   z#setup hook %s raised exception: %s
Tr7   Fr   Úext_modulesÚentry_pointsr
   )"ÚconfigparserÚSafeConfigParserÚosÚpathÚexistsr   ÚabspathÚreadÚsectionsÚdictÚitemsÚhas_get_optionÚsysÚinsertÚpopÚsplit_multilinerL   Ú
SystemExitr   ÚerrorÚexc_infoÚ	tracebackÚ
format_excÚexitÚpbrÚhooksÚ
setup_hookÚsetup_cfg_to_setup_kwargsÚregister_custom_compilersÚget_extension_modulesÚget_entry_pointsÚwrap_commandsr
   Úset_extra_files)rW   ÚparserÚconfigÚsectionrN   r.   rP   Úhook_fnÚeÚkwargsrR   rS   Úfiles_extra_filesrJ   rJ   rK   Úcfg_to_args¾   sd    
ÿ
ÿÿry   c           "   
   C   sŽ  i }i }t D �]œ}tt | ƒdkr0t | \}}n tt | ƒdkrPt | d }|}t| ||ƒ}|sÂ|dkrt| |dƒ}|rÂt|ƒ}d}|D ]0}t|ƒ}	z||	 ¡  ¡ d 7 }W 5 |	 ¡  X qˆ|}nq|tkrÒt	|ƒ}|t
krät|ƒ}n"|tk�r| ¡ dk�rd	}nd
}|�r¢|dk�r$dd„ |D ƒ}|dk�r„g }
d}|D ]<}t ||¡}| d¡ ¡ }| d¡ ¡ }|
 ||f¡ �q:|
|d< �n|dk�ršd|i}�n|dk�rbi }d	}d}|D ]”}d|k�r| dd¡\}}| ¡ | ¡  }}||k�r|| }| | ¡ ¡ n| ¡  }|| ¡ < n&|�r0td| ƒ‚n| | ¡  ¡ ¡ d
}�q´|dk�r\| ¡ }|}n@|dk�r¢i }tƒ }|D ]"}t|ƒ}||ƒ}||| ¡ < �qz|}|||< qd| k�r$d}| d }|D ]\}g }t|| ƒ}|D ]8}t ||¡}| d¡ ¡ }| d¡}| ||f¡ �qÞ|||< �qÆi }|D ]D} ||  D ]4\}}|�rTd| |f }!n| }!| |!g ¡ |¡ �q8�q,| dg ¡|d< ||d< |S )zqProcesses the setup.cfg options and converts them to arguments accepted
    by setuptools' setup() function.
    é   r9   r   r&   Údescription_filer<   z

)ÚtrueÚtÚ1ÚyesÚyTF)r*   r   c                 S   s   g | ]}t  d |¡‘qS )z\1\2)Ú_VERSION_SPEC_REÚsub)rO   ÚpredrJ   rJ   rK   rQ   K  s   ÿz-setup_cfg_to_setup_kwargs.<locals>.<listcomp>r*   z6(?P<package>[^;]*);?(?P<env_marker>[^#]*?)(?:\s*#.*)?$ÚpackageÚ
env_markerr.   )r0   r2   Nú=z1malformed package_data first line %r (misses "=")r2   r5   Úextrasz6(?P<package>[^:]*):?(?P<env_marker>[^#]*?)(?:\s*#.*)?$z%s:(%s)Úextras_require)ÚD1_D2_SETUP_ARGSr>   r^   rb   ÚopenÚcloserZ   ÚstripÚ
CSV_FIELDSÚ	split_csvÚMULTI_FIELDSÚBOOL_FIELDSÚlowerÚreÚmatchÚgroupÚappendr=   Úextendr   r]   r   rL   Úget_command_nameÚ
setdefaultra   )"rs   rw   Úall_requirementsÚargrt   ÚoptionÚin_cfg_valueÚvalueÚfilenamer{   r*   Úrequirement_patternÚrequirementÚmÚrequirement_packager…   r2   Ú	firstlineÚprevÚlineÚkeyr5   ÚdistÚcls_nameÚclsÚcmdr‡   ÚextraÚextra_requirementsÚrequirementsÚextras_valuerˆ   Ú	req_groupÚ
extras_keyrJ   rJ   rK   rl     sÌ    
ÿ


ÿ




ÿÿ





rl   c                 C   s’   t | ddƒ}|rŽt|ƒ}|D ]p}t|ƒ}t|dƒr:|j}n|j}t|dƒrR|j}nd| }|j}tj	j
}||j|f||< tj| tjd| < qdS )z²Handle custom compilers; this has no real equivalent in distutils, where
    additional compilers could only be added programmatically, so we have to
    hack it in somehow.
    r   Ú	compilersr   r   zcustom compiler %sz
distutils.N)r^   rb   rL   Úhasattrr   Ú__name__r   Ú
__module__Ú	distutilsÚ	ccompilerÚcompiler_classr_   r   )rs   r±   Úcompilerr   ÚdescrF   ÚccrJ   rJ   rK   rm   °  s    

rm   c           
      C   s(  d}g }| D �]}d|kr(|  dd¡}n|  dd¡}dd„ |D ƒ}t|ƒdkr|d d	kri }|D ]Œ}t| ||ƒ}|sxqbt|ƒ}|d
kræg }|D ]P}	|	  dd¡}	t|	ƒdkr¾|	d  ¡ df}	n|	d  ¡ |	d  ¡ f}	| |	¡ q�|}|||< qb|rd|k�r
|d |d< | t| d¡f|Ž¡ q|S )zHandle extension modules)ÚsourcesÚinclude_dirsÚdefine_macrosÚundef_macrosÚlibrary_dirsÚ	librariesÚruntime_library_dirsÚextra_objectsÚextra_compile_argsÚextra_link_argsÚexport_symbolsÚ	swig_optsÚdependsú:r9   r†   c                 S   s   g | ]}|  ¡ ‘qS rJ   ©rŒ   )rO   ÚlrJ   rJ   rK   rQ   ê  s     z)get_extension_modules.<locals>.<listcomp>rz   r   Ú	extensionr½   Nr   )r=   r>   r^   rb   rŒ   r•   r	   ra   )
rs   ÚEXTENSION_FIELDSrR   rt   ÚlabelsÚext_argsÚfieldr�   ÚmacrosÚmacrorJ   rJ   rK   rn   Ò  s>    


ÿrn   c                 C   s&   d| kri S t dd„ | d  ¡ D ƒƒS )a  Process the [entry_points] section of setup.cfg to handle setuptools
    entry points.  This is, of course, not a standard feature of
    distutils2/packaging, but as there is not currently a standard alternative
    in packaging, we provide support for them.
    rS   c                 s   s   | ]\}}|t |ƒfV  qd S ©N)rb   )rO   r›   r�   rJ   rJ   rK   Ú	<genexpr>  s   ÿz#get_entry_points.<locals>.<genexpr>)r\   r]   )rs   rJ   rJ   rK   ro     s
    
ÿro   c                 C   sÎ   t ƒ }| ¡  | ¡ D ]²\}}i }| |¡ ¡ D ]H\}}|d }| d¡sT| d¡r0| dd¡\}}| |i ¡}	||	|< q0|s€qd| kr¢|| d kr¢| d | }
n
| |¡}
t	||
|ƒ}||  di ¡|< qd S )Nr9   z	pre_hook.z
post_hook.r8   r5   )
r   Úparse_config_filesÚget_command_listÚget_option_dictr]   Ú
startswithr=   r˜   Úget_command_classÚwrap_command)rw   r§   rª   Ú_rj   ÚoptÚvalÚ	hook_typeÚaliasÚ	hook_dictr5   Únew_cmdclassrJ   rJ   rK   rp     s"    

rp   c              	   C   s2   |fdd„}t | |tf|t| d¡| d¡dœƒS )Nc                 S   s"   |   d¡ | | ¡ |   d¡ d S )NÚpre_hookÚ	post_hook)Úrun_command_hooksÚrun)Úselfr5   rJ   rJ   rK   rä   2  s    

zwrap_command.<locals>.runrá   râ   )rä   rã   rá   râ   )ÚtypeÚobjectrã   Úget)rª   r5   rj   rä   rJ   rJ   rK   rÙ   1  s    
þÿrÙ   c              	   C   s  |dkrt d| ƒ‚t| |dƒ}|dkr,dS | ¡ D ]Ì}t|tƒr‚zt|ƒ}W q† tk
r~   t ¡ d }t	d||f ƒ‚Y q†X n|}t
|dƒsœtd| ƒ‚t d|||  ¡ ¡ z|| ƒ W q4   t ¡ d }t d	||f ¡ t t ¡ ¡ t d¡ Y q4X q4dS )
z˜Run hooks registered for that command and phase.

    *cmd_obj* is a finalized command object; *hook_kind* is either
    'pre_hook' or 'post_hook'.
    )rá   râ   zinvalid hook kind: %rNr9   zcannot find hook %s: %sÚ__call__zhook %r is not callablezrunning %s %s for command %szhook %s raised exception: %s
)Ú
ValueErrorrB   ÚvaluesÚ
isinstanceÚstrrL   rA   r_   re   r   r²   r   r   Úinfor—   rd   rf   rg   rh   )Úcmd_objÚ	hook_kindrj   rP   Úhook_objÚerrrv   rJ   rJ   rK   rã   =  s:    
ÿ
  ÿrã   c                 C   sX   || kr || | kr | | | S || krP|  dd¡| | krP| | |  dd¡ S dS d S )NrÚ   ú-F©Úreplace)rs   rt   r›   rJ   rJ   rK   r^   f  s
    r^   c                 C   s"   dd„ dd„ |   d¡D ƒD ƒ} | S )z3Special behaviour when we have a multi line optionsc                 S   s   g | ]}|r|‘qS rJ   rJ   ©rO   ÚelementrJ   rJ   rK   rQ   r  s    þz#split_multiline.<locals>.<listcomp>c                 s   s   | ]}|  ¡ V  qd S rÒ   rÉ   )rO   r¥   rJ   rJ   rK   rÓ   s  s     z"split_multiline.<locals>.<genexpr>Ú
©r=   ©r�   rJ   rJ   rK   rb   o  s    ÿrb   c                 C   s"   dd„ dd„ |   d¡D ƒD ƒ} | S )z8Special behaviour when we have a comma separated optionsc                 S   s   g | ]}|r|‘qS rJ   rJ   rö   rJ   rJ   rK   rQ   {  s    þzsplit_csv.<locals>.<listcomp>c                 s   s   | ]}|  ¡ V  qd S rÒ   rÉ   )rO   ÚchunkrJ   rJ   rK   rÓ   |  s     zsplit_csv.<locals>.<genexpr>ú,rù   rú   rJ   rJ   rK   rŽ   x  s    ÿrŽ   c                    s   ‡ fdd„}|S )z[A function decorator to monkey-patch a method of the same name on the
    given class.
    c                    s:   t ˆ | jd ƒ}|r6t|dƒs6t| d|ƒ tˆ | j| ƒ | S )NÚ_orig)rB   r³   r²   Úsetattr)ÚfuncÚorig©r©   rJ   rK   Úwrapper†  s
    z#monkeypatch_method.<locals>.wrapperrJ   )r©   r  rJ   r  rK   Úmonkeypatch_method�  s    r  c                       s"   e Zd ZdZd‡ fdd„	Z‡  ZS )ÚDefaultGetDictzXLike defaultdict, but the get() method also sets and returns the default
    value.
    Nc                    s"   |d kr|   ¡ }tt| ƒ ||¡S rÒ   )Údefault_factoryÚsuperr  r˜   )rå   r¦   Údefault©Ú	__class__rJ   rK   rè   –  s    zDefaultGetDict.get)N)r³   r´   Ú__qualname__Ú__doc__rè   Ú__classcell__rJ   rJ   r  rK   r  ‘  s   r  c                       s(   e Zd ZdZdd„ Z‡ fdd„Z‡  ZS )Ú
IgnoreDictz²A dictionary that ignores any insertions in which the key is a string
    matching any string in `ignore`.  The ignore list can also contain wildcard
    patterns using '*'.
    c                 C   s$   t  dd dd„ |D ƒ¡ ¡| _d S )Nz(%s)ú|c                 S   s   g | ]}|  d d¡‘qS )Ú*z.*rô   )rO   ÚpatrJ   rJ   rK   rQ   ¤  s   ÿz'IgnoreDict.__init__.<locals>.<listcomp>)r’   Úcompiler@   Ú_IgnoreDict__ignore)rå   ÚignorerJ   rJ   rK   Ú__init__¢  s
    
ÿÿzIgnoreDict.__init__c                    s&   | j  |¡rd S tt| ƒ ||¡ d S rÒ   )r  r“   r  r  Ú__setitem__)rå   r¦   rÜ   r  rJ   rK   r  §  s    zIgnoreDict.__setitem__)r³   r´   r
  r  r  r  r  rJ   rJ   r  rK   r  œ  s   r  )rM   )2r  ÚmultiprocessingrA   ÚloggingrV   r’   r_   rf   Úcollectionsr   Údistutils.ccompilerrµ   r   Údistutils.errorsr   r   r   Úsetuptools.command.egg_infor   Úsetuptools.distr   Úsetuptools.extensionr	   ÚConfigParserrT   ri   r
   Ú	pbr.hooksr  r�   r‰   r�   r�   r�   rL   ry   rl   rm   rn   ro   rp   rÙ   rã   r^   rb   rŽ   r  r  r\   r  rJ   rJ   rJ   rK   Ú<module>.   s”   
Ý' 
V "5)			