AlkantarClanX12

Your IP : 3.145.85.74


Current Path : /lib/python3.8/site-packages/setuptools/__pycache__/
Upload File :
Current File : //lib/python3.8/site-packages/setuptools/__pycache__/dist.cpython-38.pyc

U

�Qab���@sdgZddlZddlZddlZddlZddlZddlZddlZddl	Zddl
ZddlZddlm
Z
ddlmZddlmZddlZddlmZddlmZddlmZmZmZdd	lmZdd
lmZddlmZddlm Z dd
lm!Z!ddl"m#Z#m$Z$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ddl0Z0e1d�e1d�dd�Z2dd�Z3dd�Z4dd�Z5e6e7fZ8dd �Z9d!d"�Z:d#d$�Z;d%d&�Z<d'd(�Z=d)d*�Z>d+d,�Z?d-d.�Z@d/d0�ZAd1d2�ZBd3d4�ZCd5d6�ZDe-ejEjF�ZGGd7d�deG�ZFGd8d9�d9�ZHGd:d;�d;e'�ZIdS)<�Distribution�N)�	strtobool)�DEBUG��translate_longopt)�defaultdict)�message_from_file)�DistutilsOptionError�DistutilsPlatformError�DistutilsSetupError)�
rfc822_escape)�
StrictVersion)�six)�	packaging)�ordered_set)�map�filter�filterfalse�)�SetuptoolsDeprecationWarning)�Require)�windows_support)�
get_unpatched)�parse_configurationz&setuptools.extern.packaging.specifiersz#setuptools.extern.packaging.versioncCst�dt�t|�S)NzDo not call this function)�warnings�warn�DistDeprecationWarningr)�cls�r�3/usr/lib/python3.8/site-packages/setuptools/dist.py�_get_unpatched-sr cCs�t|dd�}|dkr�|js |jr*td�}nd|jdk	sT|jdk	sTt|dd�dk	sT|jr^td�}n0|js||js||j	s||j
s||jr�td�}ntd�}||_|S)N�metadata_versionz2.1�python_requires�1.2�1.1z1.0)
�getattr�long_description_content_type�provides_extrasr
�
maintainer�maintainer_email�project_urls�provides�requires�	obsoletes�classifiers�download_urlr!)�selfZmvrrr�get_metadata_version2s*

���
��
r1cs t|���fdd�}�fdd�}t�d�|_|d�|_|d�|_|d�|_|d	�|_d
|_|d�|_d
|_	|d�|_
|d
�|_d�kr�|d�|_nd
|_|d�|_
|d�|_d�kr�|d��d�|_|d�|_|d�|_|jtd�k�r
|d�|_|d�|_|d�|_nd
|_d
|_d
|_d
S)z-Reads the metadata values from a file object.cs�|}|dkrdS|S)NZUNKNOWNr)�name�value��msgrr�_read_fieldLsz"read_pkg_file.<locals>._read_fieldcs��|d�}|gkrdS|S�N)Zget_all)r2�valuesr4rr�
_read_listRsz!read_pkg_file.<locals>._read_listzmetadata-versionr2�versionZsummary�authorNzauthor-emailz	home-page�licensezdownload-url�description�keywords�,�platformZ
classifierr$r,r+r-)rr
r!r2r:r=r;r(�author_emailr)Zurlr<r/Zlong_description�splitr>Z	platformsr.r,r+r-)r0�filer6r9rr4r�
read_pkg_fileHs:












rDc
s���}tjr��fdd�}n�fdd�}|dt|��|d����|d����|d����|d����|td	�kr�|d
��	��|d��
��n.d}|D]$\}}t�|�}|d
k	r�|||�q�|d�����j
r�|d�j
��j��D]}|dd|�q�t����}	|d|	�d�����}
|
�r:|d|
�|td	�k�rd���D]}|d|��qPn���d�������d�������d�������d�������d����t�d��r�|d�j��j�r�|d�j��j�r
�jD]}|d|��q�d
S)z5Write the PKG-INFO format data to a file object.
    cs��d|��|�f�dS�Nz%s: %s
)�writeZ
_encode_field��keyr3�rCr0rr�write_field�sz#write_pkg_file.<locals>.write_fieldcs��d||f�dSrE)rFrG)rCrrrJ�szMetadata-Version�Name�VersionZSummaryz	Home-pager#�Author�Author-email))rMr;)rNrA)Z
Maintainerr()zMaintainer-emailr)NZLicensezDownload-URLzProject-URLz%s, %sZDescriptionr?ZKeywordsZPlatformZ
ClassifierZRequiresZProvidesZ	Obsoletesr"zRequires-PythonzDescription-Content-TypezProvides-Extra)r1r�PY2�strZget_nameZget_versionZget_descriptionZget_urlr
Zget_contactZget_contact_emailr%Zget_licenser/r*�itemsrZget_long_description�joinZget_keywordsZ
get_platformsZ_write_listZget_classifiersZget_requiresZget_providesZ
get_obsoletes�hasattrr"r&r')
r0rCr:rJZoptional_fieldsZfield�attrZattr_valZproject_urlZ	long_descr>r@�extrarrIr�write_pkg_file~sZ


�
rVcCsPztj�d|�}|jrt�Wn,ttttfk
rJtd||f��YnXdS)Nzx=z4%r must be importable 'module:attrs' string (got %r))	�
pkg_resources�
EntryPoint�parse�extras�AssertionError�	TypeError�
ValueError�AttributeErrorr)�distrTr3�eprrr�check_importable�s��racCsZz(t|ttf�st�d�|�|ks&t�Wn,ttttfk
rTtd||f��YnXdS)z"Verify that value is a string list�z%%r must be a list of strings (got %r)N)	�
isinstance�list�tupler[rRr\r]r^r�r_rTr3rrr�assert_string_list�s
�rgcCsd|}t|||�|D]J}|�|�s2tdd|��|�d�\}}}|r||krtj�d||�qdS)z(Verify that namespace packages are validz1Distribution contains no modules or packages for znamespace package %r�.z^WARNING: %r is declared as a package namespace, but %r is not: please correct this in setup.pyN)rg�has_contents_forr�
rpartition�	distutils�logr)r_rTr3Zns_packagesZnsp�parent�sepZchildrrr�	check_nsp�s 
���roc
Cs@ztt�t|����Wn"tttfk
r:td��YnXdS)z+Verify that extras_require mapping is validz�'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.N)	rd�	itertools�starmap�_check_extrarQr\r]r^rrfrrr�check_extras�s�rscCs<|�d�\}}}|r*t�|�r*td|��tt�|��dS)N�:zInvalid environment marker: )�	partitionrWZinvalid_markerrrd�parse_requirements)rUZreqsr2rn�markerrrrrrsrrcCs&t|�|kr"d}t|j||d���dS)z)Verify that value is True, False, 0, or 1z0{attr!r} must be a boolean value (got {value!r}))rTr3N)�boolr�format)r_rTr3�tmplrrr�assert_boolsr{c
Csjz(tt�|��t|ttf�r&td��Wn<ttfk
rd}zd}t|j	||d���W5d}~XYnXdS)z9Verify that install_requires is a valid requirements listzUnordered types are not allowedzm{attr!r} must be a string or list of strings containing valid project/version requirement specifiers; {error}�rT�errorN)
rdrWrvrc�dict�setr\r]rry�r_rTr3r}rzrrr�check_requirementss�r�c
CsRztj�|�Wn<tjjk
rL}zd}t|j||d���W5d}~XYnXdS)z.Verify that value is a valid version specifierzF{attr!r} must be a string containing valid version specifiers; {error}r|N)rZ
specifiersZSpecifierSetZInvalidSpecifierrryr�rrr�check_specifier s�r�c
Cs@ztj�|�Wn*tk
r:}zt|��W5d}~XYnXdS)z)Verify that entry_points map is parseableN)rWrXZ	parse_mapr]r)r_rTr3�errr�check_entry_points,sr�cCst|tj�std��dS)Nztest_suite must be a string)rcr�string_typesrrfrrr�check_test_suite4sr�cCs\t|t�std�|���|��D]6\}}t|tj�sDtd�||���t|d�|�|�q dS)z@Verify that value is a dictionary of package names to glob listszT{!r} must be a dictionary mapping package names to lists of string wildcard patternsz,keys of {!r} dict must be strings (got {!r})zvalues of {!r} dictN)rcr~rryrQrr�rg)r_rTr3�k�vrrr�check_package_data9s
����r�cCs(|D]}t�d|�stj�d|�qdS)Nz\w+(\.\w+)*z[WARNING: %r not a valid package name; please use only .-separated package names in setup.py)�re�matchrkrlr)r_rTr3Zpkgnamerrr�check_packagesHs�r�c@sReZdZdZdeejd�ZdZdd�Z	dMdd�Z
dd	�Zd
d�Ze
dd
��Zdd�Zdd�ZdNdd�Ze
dd��ZdOdd�ZdPdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Z d3d4�Z!d5d6�Z"d7d8�Z#d9d:�Z$d;d<�Z%d=d>�Z&d?d@�Z'dAdB�Z(dCdD�Z)dEdF�Z*dGdH�Z+dIdJ�Z,dKdL�Z-dS)Qra�Distribution with support for features, tests, and package data

    This is an enhanced version of 'distutils.dist.Distribution' that
    effectively adds the following new optional keyword arguments to 'setup()':

     'install_requires' -- a string or sequence of strings specifying project
        versions that the distribution requires when installed, in the format
        used by 'pkg_resources.require()'.  They will be installed
        automatically when the package is installed.  If you wish to use
        packages that are not available in PyPI, or want to give your users an
        alternate download location, you can add a 'find_links' option to the
        '[easy_install]' section of your project's 'setup.cfg' file, and then
        setuptools will scan the listed web pages for links that satisfy the
        requirements.

     'extras_require' -- a dictionary mapping names of optional "extras" to the
        additional requirement(s) that using those extras incurs. For example,
        this::

            extras_require = dict(reST = ["docutils>=0.3", "reSTedit"])

        indicates that the distribution can optionally provide an extra
        capability called "reST", but it can only be used if docutils and
        reSTedit are installed.  If the user installs your package using
        EasyInstall and requests one of your extras, the corresponding
        additional requirements will be installed if needed.

     'features' **deprecated** -- a dictionary mapping option names to
        'setuptools.Feature'
        objects.  Features are a portion of the distribution that can be
        included or excluded based on user options, inter-feature dependencies,
        and availability on the current system.  Excluded features are omitted
        from all setup commands, including source and binary distributions, so
        you can create multiple distributions from the same source tree.
        Feature names should be valid Python identifiers, except that they may
        contain the '-' (minus) sign.  Features can be included or excluded
        via the command line options '--with-X' and '--without-X', where 'X' is
        the name of the feature.  Whether a feature is included by default, and
        whether you are allowed to control this from the command line, is
        determined by the Feature object.  See the 'Feature' class for more
        information.

     'test_suite' -- the name of a test suite to run for the 'test' command.
        If the user runs 'python setup.py test', the package will be installed,
        and the named test suite will be run.  The format is the same as
        would be used on a 'unittest.py' command line.  That is, it is the
        dotted name of an object to import and call to generate a test suite.

     'package_data' -- a dictionary mapping package names to lists of filenames
        or globs to use to find data files contained in the named packages.
        If the dictionary has filenames or globs listed under '""' (the empty
        string), those names will be searched for in every package, in addition
        to any names for the specific package.  Data files found using these
        names/globs will be installed along with the package, in the same
        location as the package.  Note that globs are allowed to reference
        the contents of non-package subdirectories, as long as you use '/' as
        a path separator.  (Globs are automatically converted to
        platform-specific paths at runtime.)

    In addition to these new keywords, this class also has several new methods
    for manipulating the distribution's contents.  For example, the 'include()'
    and 'exclude()' methods can be thought of as in-place add and subtract
    commands that add or remove packages, modules, extensions, and so on from
    the distribution.  They are used by the feature subsystem to configure the
    distribution for the included and excluded features.
    N)r&r*r'cCsl|rd|ksd|krdSt�t|d����}tjj�|�}|dk	rh|�d�sht�t|d��|_	||_
dS)Nr2r:zPKG-INFO)rWZ	safe_namerP�lower�working_setZby_key�getZhas_metadataZsafe_versionZ_version�
_patched_dist)r0�attrsrHr_rrr�patch_missing_pkg_info�sz#Distribution.patch_missing_pkg_infoc
	s�t�d�}|si�_|pi}d|ks,d|kr4t��g�_i�_g�_|�dd��_��	|�|�dg��_
|�dg��_t�
d�D]}t���|jd�q�t���fdd	�|��D���j��D]L\}}�jj|fD]}||kr�||}�qq�|r�|�nd}t�j||�q�t�jjtj��r4t�jj��j_�jjdk	�r�zHtj��jj�}t|�}	�jj|	k�r�t� d
�jj|	f�|	�j_Wn0tjj!t"fk
�r�t� d�jj�YnX��#�dS)N�package_data�features�require_features�src_root�dependency_links�setup_requires�distutils.setup_keywordscs i|]\}}|�jkr||�qSr)�_DISTUTILS_UNSUPPORTED_METADATA��.0r�r��r0rr�
<dictcomp>�s
�z)Distribution.__init__.<locals>.<dictcomp>zNormalizing '%s' to '%s'z�The version specified (%r) is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.)$rSr��Feature�warn_deprecatedr�r�Z
dist_files�popr�r�r�r�rW�iter_entry_points�vars�
setdefaultr2�
_Distribution�__init__rQr��metadata�__dict__�setattrrcr:�numbers�NumberrPrrLrrZInvalidVersionr\�_finalize_requires)
r0r�Zhave_package_datar`�option�default�sourcer3ZverZnormalized_versionrr�rr��s\

�����
zDistribution.__init__cCsft|dd�r|j|j_t|dd�rR|j��D]$}|�d�d}|r,|jj�|�q,|��|�	�dS)z�
        Set `metadata.python_requires` and fix environment markers
        in `install_requires` and `extras_require`.
        r"N�extras_requirertr)
r%r"r�r��keysrBr'�add�_convert_extras_requirements�"_move_install_requirements_markers)r0rUrrrr��s
zDistribution._finalize_requirescCsht|dd�pi}tt�|_|��D]@\}}|j|t�|�D]"}|�|�}|j||�|�q>q"dS)z�
        Convert requirements in `extras_require` of the form
        `"extra": ["barbazquux; {marker}"]` to
        `"extra:{marker}": ["barbazquux"]`.
        r�N)	r%rrd�_tmp_extras_requirerQrWrv�_suffix_for�append)r0Z
spec_ext_reqs�sectionr��r�suffixrrrr��s


z)Distribution._convert_extras_requirementscCs|jrdt|j�SdS)ze
        For a requirement, return the 'extras_require' suffix for
        that requirement.
        rtrb)rwrP��reqrrrr�szDistribution._suffix_forcs�dd�}t�dd�pd}tt�|��}t||�}t||�}ttt|���_|D]}�j	dt|j
��|�qNt�fdd��j	�
�D���_dS)	zv
        Move requirements in `install_requires` that are using environment
        markers `extras_require`.
        cSs|jSr7�rwr�rrr�
is_simple_reqszFDistribution._move_install_requirements_markers.<locals>.is_simple_req�install_requiresNrrtc3s,|]$\}}|dd�t�j|�D�fVqdS)cSsg|]}t|��qSr)rP�r�r�rrr�
<listcomp>)szMDistribution._move_install_requirements_markers.<locals>.<genexpr>.<listcomp>N)r�
_clean_reqr�r�rr�	<genexpr>(s�zBDistribution._move_install_requirements_markers.<locals>.<genexpr>)r%rdrWrvrrrrPr�r�rwr�r~rQr�)r0r�Zspec_inst_reqsZ	inst_reqsZsimple_reqsZcomplex_reqsr�rr�rr�s


�z/Distribution._move_install_requirements_markerscCs
d|_|S)zP
        Given a Requirement, remove environment markers and return it.
        Nr�)r0r�rrrr�-szDistribution._clean_reqc
Cs�ddlm}tjr>tjtjkr>ddddddd	d
ddd
ddg
}ng}t|�}|dkrZ|��}t	rh|�
d�|�}|D]�}tj|dd��4}t	r�|�
dj
ft���tjr�|jn|j|�W5QRX|��D]\}|�|�}|�|�}	|D]>}
|
dkr�|
|kr�|�|�||
��}|
�dd�}
||f|	|
<q�q�|��qrd|jk�r�|jd��D]�\}
\}}|j�|
�}
zF|
�r|t||
t|��n(|
dk�r�t||
t|��nt||
|�Wn,tk
�r�}zt|��W5d}~XYnX�qHdS)z�
        Adapted from distutils.dist.Distribution.parse_config_files,
        this method provides the same functionality in subtly-improved
        ways.
        r)�ConfigParserzinstall-basezinstall-platbasezinstall-libzinstall-platlibzinstall-purelibzinstall-headerszinstall-scriptszinstall-data�prefixzexec-prefix�home�user�rootNz"Distribution.parse_config_files():�utf-8)�encodingz  reading {filename}�__name__�-�_�global)�verboseZdry_run)Z(setuptools.extern.six.moves.configparserr�r�PY3�sysr��base_prefix�	frozensetZfind_config_filesr�announce�io�openry�localsZ	read_fileZreadfpZsections�options�get_option_dict�_try_strr��replacer��command_optionsrQ�negative_optr�rr]r	)r0�	filenamesr�Zignore_options�parser�filename�readerr�r�Zopt_dict�opt�val�src�aliasr5rrr�_parse_config_files4s`�
 



z Distribution._parse_config_filescCs.tjr
|Sz
|��WStk
r(YnX|S)ab
        On Python 2, much of distutils relies on string values being of
        type 'str' (bytes) and not unicode text. If the value can be safely
        encoded to bytes using the default encoding, prefer that.

        Why the default encoding? Because that value can be implicitly
        decoded back to text if needed.

        Ref #1653
        )rr��encode�UnicodeEncodeError)r�rrrr�rs
zDistribution._try_strcCs^|��}|dkr|�|�}tr,|�d|�|��D�]"\}\}}trZ|�d|||f�zdd�|jD�}Wntk
r�g}YnXz
|j}Wntk
r�i}YnXz~t|t	j
�}	||kr�|	r�t|||t|��nJ||kr�|	r�t||t|��n,t
||��rt|||�ntd|||f��Wq4tk
�rV}
zt|
��W5d}
~
XYq4Xq4dS)a�
        Set the options for 'command_obj' from 'option_dict'.  Basically
        this means copying elements of a dictionary ('option_dict') to
        attributes of an instance ('command').

        'command_obj' must be a Command instance.  If 'option_dict' is not
        supplied, uses the standard option dictionary for this command
        (from 'self.command_options').

        (Adopted from distutils.dist.Distribution._set_command_options)
        Nz#  setting options for '%s' command:z    %s = %s (from %s)cSsg|]}t|��qSrr)r��orrrr��s�z5Distribution._set_command_options.<locals>.<listcomp>z1error in %s: command '%s' has no such option '%s')Zget_command_namer�rr�rQZboolean_optionsr^r�rcrr�r�rrSr	r])r0Zcommand_objZoption_dictZcommand_namer�r�r3Z	bool_opts�neg_optZ	is_stringr5rrr�_set_command_options�sF

��



��z!Distribution._set_command_optionsFcCs(|j|d�t||j|d�|��dS)zYParses configuration files from various levels
        and loads configuration.

        )r�)�ignore_option_errorsN)r�rr�r�)r0r�r�rrr�parse_config_files�s
�zDistribution.parse_config_filescCst�|�}|jr|��|S)z3Process features after parsing command line options)r��parse_command_liner��_finalize_features)r0�resultrrrr��s
zDistribution.parse_command_linecCsd|�dd�S)z;Convert feature name to corresponding option attribute nameZwith_r�r��r��r0r2rrr�_feature_attrname�szDistribution._feature_attrnamecCs8tjjt�|�|jdd�}|D]}tjj|dd�q|S)zResolve pre-setup requirementsT)�	installerZreplace_conflictingr�)rWr��resolverv�fetch_build_eggr�)r0r,Zresolved_distsr_rrr�fetch_build_eggs�s�zDistribution.fetch_build_eggscCs�t�|�|jr|��t�d�D]:}t||jd�}|dk	r"|j|j	d�|�
�||j|�q"t|dd�r~dd�|jD�|_ng|_dS)Nr��r��convert_2to3_doctestscSsg|]}tj�|��qSr)�os�path�abspath�r��prrrr��s�z1Distribution.finalize_options.<locals>.<listcomp>)r��finalize_optionsr��_set_global_opts_from_featuresrWr�r%r2�requirer��loadr�)r0r`r3rrrr��s
�
zDistribution.finalize_optionsc	Csvtj�tjd�}tj�|�srt�|�t�|�tj�|d�}t|d��$}|�	d�|�	d�|�	d�W5QRX|S)Nz.eggsz
README.txt�wzcThis directory contains eggs that were downloaded by setuptools to build, test, and run plug-ins.

zAThis directory caches those eggs to prevent repeated downloads.

z/However, it is safe to delete this directory.

)
r�r�rR�curdir�exists�mkdirrZ	hide_filer�rF)r0Z
egg_cache_dirZreadme_txt_filename�frrr�get_egg_cache_dir�s



zDistribution.get_egg_cache_dirc
Cs�ddlm}|�ddgi�}|�d�}|��|�dd�|�d���D��|jr�|jdd�}d|krx|dd	|}d
|f|d<|��}||dg|dd
dd
d
ddd
d�}|�	�|�|�S)z Fetch an egg needed for buildingr)�easy_installZscript_argsr	css"|]\}}|dkr||fVqdS))�
find_links�	site_dirsZ	index_url�optimizerZallow_hostsNrr�rrrr��s�z/Distribution.fetch_build_egg.<locals>.<genexpr>Nr
rZsetup�xTF)
�args�install_dirZexclude_scriptsZalways_copyZbuild_directoryZeditableZupgradeZ
multi_versionZ	no_reportr�)
Zsetuptools.command.easy_installr	�	__class__r��clear�updaterQr�rZensure_finalized)r0r�r	r_�optsZlinksr�cmdrrrr��s8

��zDistribution.fetch_build_eggc	Cs�g}|j��}|j��D]�\}}|�|d�|�|�|jr|j}d}d}|��s\||}}d|dd||fd|dd||ff}|�	|�d||d|<q||j
|_
|_||_|_dS)z;Add --with-X/--without-X options based on optional featuresNz
 (default)rbzwith-zinclude zwithout-zexclude )
r��copyr�rQ�_set_feature�validate�optionalr=�include_by_default�extend�global_optionsZfeature_optionsZfeature_negopt)	r0ZgoZnor2�feature�descrZincdefZexcdef�newrrrrs$


�
z+Distribution._set_global_opts_from_featurescCs�|j��D]<\}}|�|�}|s0|dkr
|��r
|�|�|�|d�q
|j��D](\}}|�|�sR|�|�|�|d�qRdS)z9Add/remove features and resolve dependencies between themNrr)r�rQ�feature_is_includedr�
include_inr�exclude_from)r0r2rZenabledrrrr�0s



zDistribution._finalize_featurescCs\||jkr|j|St�d|�}|D]*}|j|jd�|��|j|<}|St�||�S)z(Pluggable version of get_command_class()�distutils.commandsr�N)�cmdclassrWr�rr�rr��get_command_class)r0�commandZepsr`r#rrrr$As

zDistribution.get_command_classcCs:t�d�D]$}|j|jkr
|��}||j|j<q
t�|�S�Nr")rWr�r2r#r�r��print_commands�r0r`r#rrrr'Ns
zDistribution.print_commandscCs:t�d�D]$}|j|jkr
|��}||j|j<q
t�|�Sr&)rWr�r2r#r�r��get_command_listr(rrrr)Vs
zDistribution.get_command_listcCst||�|�|�dS)zSet feature's inclusion statusN)r�r�)r0r2Zstatusrrrr^szDistribution._set_featurecCst||�|��S)zAReturn 1 if feature is included, 0 if excluded, 'None' if unknown)r%r�r�rrrrbsz Distribution.feature_is_includedcCsF|�|�dkr&|j|j}t|d��|j|�|�|�|d�dS)z)Request inclusion of feature named 'name'rz2 is required, but was excluded or is not availablerN)rr�r=r	r r)r0r2rrrr�include_featurefs�zDistribution.include_featurecKs@|��D]2\}}t|d|d�}|r.||�q|�||�qdS)a�Add items to distribution that are named in keyword arguments

        For example, 'dist.include(py_modules=["x"])' would add 'x' to
        the distribution's 'py_modules' attribute, if it was not already
        there.

        Currently, this method only supports inclusion for attributes that are
        lists or tuples.  If you need to add support for adding to other
        attributes in this or a subclass, you can add an '_include_X' method,
        where 'X' is the name of the attribute.  The method will be called with
        the value passed to 'include()'.  So, 'dist.include(foo={"bar":"baz"})'
        will try to call 'dist._include_foo({"bar":"baz"})', which can then
        handle whatever special inclusion logic is needed.
        Z	_include_N)rQr%�
_include_misc)r0r�r�r��includerrrr,qs

zDistribution.includecsf�d�|jr&��fdd�|jD�|_|jrD��fdd�|jD�|_|jrb��fdd�|jD�|_dS)z9Remove packages, modules, and extensions in named packagerhcs"g|]}|�kr|���s|�qSr��
startswithr���package�pfxrrr��s
�z0Distribution.exclude_package.<locals>.<listcomp>cs"g|]}|�kr|���s|�qSrr-r�r/rrr��s
�cs&g|]}|j�kr|j���s|�qSr)r2r.r�r/rrr��s
�N)�packages�
py_modules�ext_modules)r0r0rr/r�exclude_package�s���zDistribution.exclude_packagecCs2|d}|��D]}||ks&|�|�rdSqdS)z<Return true if 'exclude_package(package)' would do somethingrhTN)�iter_distribution_namesr.)r0r0r1r�rrrri�szDistribution.has_contents_forcs�t�t�std|�f��zt||�}Wn tk
rHtd|��YnX|dk	rjt|t�sjt|d��n|r�t||�fdd�|D��dS)zAHandle 'exclude()' for list/tuple attrs without a special handlerz(%s: setting must be a list or tuple (%r)� %s: No such distribution settingN�4: this setting cannot be changed via include/excludecsg|]}|�kr|�qSrr�r��item�r3rrr��sz.Distribution._exclude_misc.<locals>.<listcomp>�rc�sequencerr%r^r�)r0r2r3�oldrr;r�
_exclude_misc�s 

��
�zDistribution._exclude_misccs�t|t�std||f��zt||��Wn tk
rHtd|��YnX�dkr`t|||�n:t�t�sxt|d��n"�fdd�|D�}t||�|�dS)zAHandle 'include()' for list/tuple attrs without a special handlerz%s: setting must be a list (%r)r7Nr8csg|]}|�kr|�qSrrr9�r>rrr��sz.Distribution._include_misc.<locals>.<listcomp>r<)r0r2r3rrr@rr+�s$

��

�zDistribution._include_misccKs@|��D]2\}}t|d|d�}|r.||�q|�||�qdS)aRemove items from distribution that are named in keyword arguments

        For example, 'dist.exclude(py_modules=["x"])' would remove 'x' from
        the distribution's 'py_modules' attribute.  Excluding packages uses
        the 'exclude_package()' method, so all of the package's contained
        packages, modules, and extensions are also excluded.

        Currently, this method only supports exclusion from attributes that are
        lists or tuples.  If you need to add support for excluding from other
        attributes in this or a subclass, you can add an '_exclude_X' method,
        where 'X' is the name of the attribute.  The method will be called with
        the value passed to 'exclude()'.  So, 'dist.exclude(foo={"bar":"baz"})'
        will try to call 'dist._exclude_foo({"bar":"baz"})', which can then
        handle whatever special exclusion logic is needed.
        Z	_exclude_N)rQr%r?)r0r�r�r��excluderrrrA�s

zDistribution.excludecCs,t|t�std|f��tt|j|��dS)Nz.packages: setting must be a list or tuple (%r))rcr=rrdrr5)r0r2rrr�_exclude_packages�s

�zDistribution._exclude_packagesc
Cs�|jj|_|jj|_|d}|�d�}||krf||\}}||=ddl}|�|d�|dd�<|d}q&t�|||�}|�|�}	t	|	dd�r�d|f|�|�d<|dk	r�gS|S)Nr�aliasesTrZcommand_consumes_arguments�command liner)
rrr�r��shlexrBr��_parse_command_optsr$r%)
r0r�rr%rCr�r�rE�nargsZ	cmd_classrrrrF�s"




z Distribution._parse_command_optscCs�i}|j��D]�\}}|��D]�\}\}}|dkr4q|�dd�}|dkr�|�|�}|j��}|�t|di��|��D]\}	}
|
|krv|	}d}q�qvtd��n|dkr�d}||�	|i�|<qq|S)	ahReturn a '{cmd: {opt:val}}' map of all command-line options

        Option names are all long, but do not include the leading '--', and
        contain dashes rather than underscores.  If the option doesn't take
        an argument (e.g. '--quiet'), the 'val' is 'None'.

        Note that options provided by config files are intentionally excluded.
        rDr�r�rr�NzShouldn't be able to get herer)
r�rQr�Zget_command_objr�rrr%r[r�)r0�drrr�r�r�Zcmdobjr��neg�posrrr�get_cmdline_optionss(



z Distribution.get_cmdline_optionsccsv|jpdD]
}|Vq
|jpdD]
}|Vq |jp4dD]:}t|t�rN|\}}n|j}|�d�rj|dd�}|Vq6dS)z@Yield all packages, modules, and extension names in distributionr�moduleNi����)r2r3r4rcrer2�endswith)r0ZpkgrLZextr2Z	buildinforrrr60s


z$Distribution.iter_distribution_namesc
Cs�ddl}tjs|jr t�||�St|jtj	�s:t�||�S|jj
��dkrVt�||�S|jj
}|jj}|j
dkrtdpvd}|jj}t�	|j��d|||�|_zt�||�W�St�	|j��||||�|_XdS)z�If there were any non-global "display-only" options
        (--help-commands or the metadata display options) on the command
        line, display the requested info and return true; else return
        false.
        rN)r��utf8Zwin32�
r�)r�rrOZ
help_commandsr��handle_display_optionsrc�stdoutr��
TextIOWrapperr�r��errorsr@�line_buffering�detach)r0Zoption_orderr�r�rS�newlinerTrrrrPBs6��z#Distribution.handle_display_options)N)N)N)NF).r��
__module__�__qualname__�__doc__r~rZ
OrderedSetr�r�r�r�r�r��staticmethodr�r�r�r�r�r�r�r�r�r�r�rr�rr�r$r'r)rrr*r,r5rir?r+rArBrFrKr6rPrrrrrTsXD�
;

>

/

	(c@sFeZdZdZedd��Zddd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)r�a�
    **deprecated** -- The `Feature` facility was never completely implemented
    or supported, `has reported issues
    <https://github.com/pypa/setuptools/issues/58>`_ and will be removed in
    a future version.

    A subset of the distribution that can be excluded if unneeded/wanted

    Features are created using these keyword arguments:

      'description' -- a short, human readable description of the feature, to
         be used in error messages, and option help messages.

      'standard' -- if true, the feature is included by default if it is
         available on the current system.  Otherwise, the feature is only
         included if requested via a command line '--with-X' option, or if
         another included feature requires it.  The default setting is 'False'.

      'available' -- if true, the feature is available for installation on the
         current system.  The default setting is 'True'.

      'optional' -- if true, the feature's inclusion can be controlled from the
         command line, using the '--with-X' or '--without-X' options.  If
         false, the feature's inclusion status is determined automatically,
         based on 'availabile', 'standard', and whether any other feature
         requires it.  The default setting is 'True'.

      'require_features' -- a string or sequence of strings naming features
         that should also be included if this feature is included.  Defaults to
         empty list.  May also contain 'Require' objects that should be
         added/removed from the distribution.

      'remove' -- a string or list of strings naming packages to be removed
         from the distribution if this feature is *not* included.  If the
         feature *is* included, this argument is ignored.  This argument exists
         to support removing features that "crosscut" a distribution, such as
         defining a 'tests' feature that removes all the 'tests' subpackages
         provided by other features.  The default for this argument is an empty
         list.  (Note: the named package(s) or modules must exist in the base
         distribution when the 'setup()' function is initially called.)

      other keywords -- any other keyword arguments are saved, and passed to
         the distribution's 'include()' and 'exclude()' methods when the
         feature is included or excluded, respectively.  So, for example, you
         could pass 'packages=["a","b"]' to cause packages 'a' and 'b' to be
         added or removed from the distribution as appropriate.

    A feature must include at least one 'requires', 'remove', or other
    keyword argument.  Otherwise, it can't affect the distribution in any way.
    Note also that you can subclass 'Feature' to create your own specialized
    feature types that modify the distribution in other ways when included or
    excluded.  See the docstrings for the various methods here for more detail.
    Aside from the methods, the only feature attributes that distributions look
    at are 'description' and 'optional'.
    cCsd}tj|tdd�dS)NzrFeatures are deprecated and will be removed in a future version. See https://github.com/pypa/setuptools/issues/65.�)�
stacklevel)rrrr4rrrr��s�zFeature.warn_deprecatedFTrc	Ks�|��||_||_||_||_t|ttf�r4|f}dd�|D�|_dd�|D�}|r^||d<t|t�rn|f}||_	||_
|s�|s�|s�td��dS)NcSsg|]}t|t�r|�qSr�rcrPr�rrrr��s
z$Feature.__init__.<locals>.<listcomp>cSsg|]}t|t�s|�qSrr]r�rrrr��s
r�zgFeature %s: must define 'require_features', 'remove', or at least one of 'packages', 'py_modules', etc.)r�r=�standard�	availablerrcrPrr��removerZr)	r0r=r^r_rr�r`rZZerrrrr��s*�
�zFeature.__init__cCs|jo
|jS)z+Should this feature be included by default?)r_r^r�rrrr�szFeature.include_by_defaultcCs<|jst|jd��|jf|j�|jD]}|�|�q(dS)aEnsure feature and its requirements are included in distribution

        You may override this in a subclass to perform additional operations on
        the distribution.  Note that this method may be called more than once
        per feature, and so should be idempotent.

        z3 is required, but is not available on this platformN)r_r
r=r,rZr�r*)r0r_rrrrr �s	�
zFeature.include_incCs.|jf|j�|jr*|jD]}|�|�qdS)a2Ensure feature is excluded from distribution

        You may override this in a subclass to perform additional operations on
        the distribution.  This method will be called at most once per
        feature, and only after all included features have been asked to
        include themselves.
        N)rArZr`r5�r0r_r:rrrr!�s	
zFeature.exclude_fromcCs.|jD]"}|�|�std|j||f��qdS)a�Verify that feature makes sense in context of distribution

        This method is called by the distribution just before it parses its
        command line.  It checks to ensure that the 'remove' attribute, if any,
        contains only valid package/module names that are present in the base
        distribution when 'setup()' is called.  You may override it in a
        subclass to perform any other required validation of the feature
        against a target distribution.
        zg%s wants to be able to remove %s, but the distribution doesn't contain any packages or modules under %sN)r`rirr=rarrrr�s


��zFeature.validateN)FTTrr)r�rWrXrYrZr�r�rr r!rrrrrr�es8
�
r�c@seZdZdZdS)rzrClass for warning about deprecations in dist in
    setuptools. Not ignored by default, unlike DeprecationWarning.N)r�rWrXrYrrrrr�sr)J�__all__r�r�r�r�rr�Z
distutils.logrkZdistutils.coreZ
distutils.cmdZdistutils.distZdistutils.utilrZdistutils.debugrZdistutils.fancy_getoptrrp�collectionsrZemailrZdistutils.errorsr	r
rrZdistutils.versionr
Zsetuptools.externrrrZsetuptools.extern.six.movesrrrrbrZsetuptools.dependsrZ
setuptoolsrZsetuptools.monkeyrZsetuptools.configrrW�
__import__r r1rDrVrerdr=rargrorsrrr{r�r�r�r�r�r�Zcorerr�r�rrrrr�<module>sv6L