HEX
Server: Apache
System: Linux srv1.prosuiteplus.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: prosuiteplus (1001)
PHP: 8.3.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/pbr/__pycache__/util.cpython-38.pyc
U

jP�^�\�$@s�dZzddlZWnek
r$YnXddlZddlmZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZ
ddl
mZddl
mZddlZddlmZddlmZzddlZWnek
r�ddlZYnXddlmZddlZe�d	�Zd
d
d
d
d
d
dd
dd
d
dd
ddd
ddd
dd
ddddddddddddddd�#ZdZdZd Zd!Z d"d#�Z!d$d%�Z"d9d'd(�Z#d:d)d*�Z$d+d,�Z%d-d.�Z&d/d0�Z'd1d2�Z(d3d4�Z)d5d6�Z*Gd7d8�d8e�Z+dS);a�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)�errors)�log)�dist)�	extension)�extra_filesz\s*(.*?)\s*\((.*)\)\s*$)�metadata)rZ	home_page)rZsummary)r�description)rZdescription_content_type)rZ
classifier)r�platform)rZ
requires_dist)rZsetup_requires_dist)rZ
provides_dist)rZobsoletes_dist)�files�
packages_root)r)r�modules)�globalZcommands)�backwards_compat�use_2to3)r�zip_safe)r�
tests_require)r)#�name�versionZauthorZauthor_emailZ
maintainerZmaintainer_emailZurl�project_urlsr	�keywords�long_descriptionZlong_description_content_typeZdownload_url�classifiers�	platforms�license�install_requires�setup_requiresZpython_requires�provides�provides_extras�	obsoletes�package_dir�packages�package_data�namespace_packages�
data_files�scripts�
py_modules�cmdclassrrr�dependency_links�include_package_data)rrrrrr#r!r"r$r%r&r(rrrr'r)r)rrr)�cCs4tjdkr*|�dd�}dd�t�|�D�St�|�S)N�nt�\�/cSsg|]}|�dd��qS)r-r,)�replace)�.0�xr*r*�*/usr/lib/python3/dist-packages/pbr/util.py�
<listcomp>�szshlex_split.<locals>.<listcomp>)�osrr.�shlex�split)�pathr*r*r1�shlex_split�s
r7c	Cs�|�d�}t|�d}|d|�}|d}|dkr�ztd�|�|gd�}Wq�Wq*tk
r�|dkrh�|d8}|d|�}||}d}Yq*Xq*||d�D]0}zt||�}Wq�tk
r�t|��Yq�Xq�|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�)r5�len�
__import__�join�ImportError�getattr�AttributeError)r�partsZcursor�module_nameZ	attr_nameZret�partr*r*r1�resolve_name�s*
rF�	setup.cfgc	Cs(tjdkrt��}nt��}tj�|�s>t�	dtj�
|���z|j|dd�Wntk
rn|�|�YnXi}|�
�D]6}t�||<|�|�D]\}}||||�dd�<q�q|t|dd�}t|d	d
�}|r�tj�
|�}tj�d|��z"|�r�dd
�t|�D�}|D]�}	t|	�}
z|
|�Wnjtk
�rBt�d�YnLtk
�r�t��d}t�d|	|f�t�t���t�d�YnX�q
tj� |�t!||�}d|d<d|d<t"|�t#|�}
|
�r�|
|d<t$|�}|�r�||d<t|d	d�}|�rt%�&t|��W5|�r"tj�d�X|S)a�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 path:
        The setup.cfg path.
    :param script_args:
        List of commands setup.py was called with.
    :raises DistutilsFileError:
        When the setup.cfg file is not found.
    )�rzfile '%s' does not exist�utf-8��encoding�-�_r�setup_hooksrrrcSsg|]}|dkr|�qS)zpbr.hooks.setup_hookr*)r/�hookr*r*r1r2�s�zcfg_to_args.<locals>.<listcomp>z)setup hook %s terminated the installationr9z#setup hook %s raised exception: %s
Tr)Fr�ext_modules�entry_pointsr)'�sys�version_info�configparser�ConfigParserZSafeConfigParserr3r6�existsrZDistutilsFileError�abspath�read�	TypeErrorZsections�dict�itemsr.�has_get_option�insert�pop�split_multilinerF�
SystemExitr�error�	Exception�exc_info�	traceback�
format_exc�exit�pbrZhooksZ
setup_hook�setup_cfg_to_setup_kwargs�register_custom_compilers�get_extension_modules�get_entry_pointsrZset_extra_files)r6�script_args�parser�config�section�k�valuerNr rOZhook_fn�e�kwargsrPrQZfiles_extra_filesr*r*r1�cfg_to_args�sp


�
��
rtc)
Csbi}i}tD�]�}tt|�dkr0t|\}}n tt|�dkrPt|d}|}t|||�}|s�|dkrt||d�}|r�t|�}d}|D]6}	tj|	dd�}
z||
����d	7}W5|
��Xq�|}nq|t	kr�t
|�}|tkr�t|�}nf|tk�r.i}t|�D]&}|�
d
d�\}
}|��||
��<�q|}n"|tk�rP|��dk�rLd}nd
}|�r�|dk�rndd�|D�}|dk�r�g}d}|D]<}t�||�}|�d���}|�d���}|�||f��q�||d<�n.|dk�r�d|i}�n|dk�r�i}d}d}|D]�}d
|k�rr|�
d
d�\}}t|���d}||��}}||k�r\||}|�t|��nt|�}||��<n(|�r�t�d|��n|�t|����d
}�q�|dk�r�|��}|}nB|dk�r�i}t��}|D]"}t|�}||�}|||��<�q�|}|||<qd|k�r�d}|d} d| k�rPddlm}!d�|!� |!j!���"d d!�| d<| D]\}"g}#t| |"�}$|$D]8}t�||�}|�d���}%|�d�}|#�|%|f��ql|#||"<�qTi}&|D]�}'||'D]z\}}|�r(d"|'|f}(d#|k�r,zt#�$d$|��r|'}(Wn"t%k
�r$t&�'d%��YnXn|'}(|&�(|(g��|��qƐq�|&�)dg�|d<|&|d&<|S)'z�Convert config options to kwargs.

    Processes the setup.cfg options and converts them to arguments accepted
    by setuptools' setup() function.
    �r9rr�description_filer<rIrJz

�=)�true�t�1Zyes�yTF)rrcSsg|]}t�d|��qS)z\1\2)�_VERSION_SPEC_RE�sub)r/Zpredr*r*r1r2ms�z-setup_cfg_to_setup_kwargs.<locals>.<listcomp>rz6(?P<package>[^;]*);?(?P<env_marker>[^#]*?)(?:\s*#.*)?$�package�
env_markerr )r"r$Nz1malformed package_data first line %r (misses "=")r$r'�extrasz6(?P<package>[^:]*):?(?P<env_marker>[^#]*?)(?:\s*#.*)?$Ztest)�	packaging�
�;�:z%s:(%s)Zbdist_wheelz(%s)z�Marker evaluation failed, see the following error.  For more information see: http://docs.openstack.org/pbr/latest/user/using.html#environment-markers�extras_require)*�D1_D2_SETUP_ARGSr=r\r_�io�open�closerX�strip�
CSV_FIELDS�	split_csv�MULTI_FIELDS�
MAP_FIELDSr5�BOOL_FIELDS�lower�re�match�group�appendr7�extendrZDistutilsOptionErrorr[�st_distZDistributionrFZget_command_namergr�r?Zparse_requirementsZTEST_REQUIREMENTS_FILESr.�
pkg_resourcesZevaluate_marker�SyntaxErrorrra�
setdefaultr^))rnrlrsZall_requirements�argro�optionZin_cfg_valuerq�filenamervZ
in_cfg_map�irp�vrZrequirement_patternZrequirement�mZrequirement_packagerr$�	firstline�prev�line�keyZkey_unquotedr'rZcls_name�cls�cmdr�r�ZextraZextra_requirementsZrequirementsZextras_valuer�Z	req_groupZ
extras_keyr*r*r1rh.s
�



�
�



��



�
��


�
rhcCs�t|dd�}|r�t|�}|D]p}t|�}t|d�r:|j}n|j}t|d�rR|j}nd|}|j}tj	j
}||j|f||<tj|tjd|<qdS)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�	compilersrr	zcustom compiler %sz
distutils.N)
r\r_rF�hasattrr�__name__r	�
__module__�	distutilsZ	ccompilerZcompiler_classrRr
)rnr�ZcompilerrZdescrDZccr*r*r1ri�s

ric
Cs*d}g}|D�]}d|kr(|�dd�}n|�dd�}dd�|D�}t|�dkr|dd	kri}|D]�}t|||�}|sxqbt|�}|d
kr�g}|D]P}	|	�dd�}	t|	�dkr�|	d��df}	n|	d��|	d��f}	|�|	�q�|}|||<qb|rd|k�r
|d|d<|�tj|�d�f|��q|S)
zHandle extension modules)
ZsourcesZinclude_dirs�
define_macrosZundef_macrosZlibrary_dirsZ	librariesZruntime_library_dirsZ
extra_objectsZextra_compile_argsZextra_link_argsZexport_symbolsZ	swig_optsZdependsr�r9rwcSsg|]}|���qSr*�r�)r/�lr*r*r1r2'sz)get_extension_modules.<locals>.<listcomp>rurrr�Nr)	r5r=r\r_r�r�rZ	Extensionr^)
rnZEXTENSION_FIELDSrPro�labelsZext_argsZfieldrqZmacrosZmacror*r*r1rjs>


�rjcCs&d|kriStdd�|d��D��S)aProcess the [entry_points] section of setup.cfg.

    Processes 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.
    rQcss|]\}}|t|�fVqdS�N)r_)r/r�rqr*r*r1�	<genexpr>Os�z#get_entry_points.<locals>.<genexpr>)rZr[)rnr*r*r1rkDs

�rkcCs(||kr |||kr |||SdSdS)NFr*)rnror�r*r*r1r\Ssr\cCs"dd�dd�|�d�D�D�}|S)z3Special behaviour when we have a multi line optionscSsg|]}|r|�d�s|�qS)�#)�
startswith�r/�elementr*r*r1r2]s
�z#split_multiline.<locals>.<listcomp>css|]}|��VqdSr�r�)r/r�r*r*r1r�^sz"split_multiline.<locals>.<genexpr>r��r5�rqr*r*r1r_Zs�r_cCs"dd�dd�|�d�D�D�}|S)z8Special behaviour when we have a comma separated optionscSsg|]}|r|�qSr*r*r�r*r*r1r2fs�zsplit_csv.<locals>.<listcomp>css|]}|��VqdSr�r�)r/�chunkr*r*r1r�gszsplit_csv.<locals>.<genexpr>�,r�r�r*r*r1r�cs�r�cs"eZdZdZd�fdd�	Z�ZS)�DefaultGetDictzDLike defaultdict, but get() also sets and returns the default value.Ncs"|dkr|��}tt|��||�Sr�)�default_factory�superr�r�)�selfr��default��	__class__r*r1�getpszDefaultGetDict.get)N)r�r��__qualname__�__doc__r��
__classcell__r*r*r�r1r�msr�)rGr*)r*),r�Zmultiprocessingr@Zlogging�collectionsrr�r3r�r4rRrdZdistutils.ccompilerr�rrr�Z
setuptoolsrr�rrUrTrgrZ	pbr.hooks�compiler|r�r�r�r�r�r7rFrtrhrirjrkr\r_r�r�r*r*r*r1�<module>.s�
�+
 
_
?#5