Spade

Mini Shell

Directory:~$ /lib/python3.6/site-packages/setuptools/__pycache__/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ //lib/python3.6/site-packages/setuptools/__pycache__/dist.cpython-36.pyc

3

J$�\u��@s�dgZddlZddlZddlZddlZddlZddlZddlZddl	Zddl
Z
ddlmZddl
mZmZmZddlmZddlmZddlmZddlmZdd	lmZmZmZdd
lmZddlmZddl
m!Z!dd
l"m#Z#ddl$Z$ddl%m&Z&e'd�e'd�dd�Z(dd�Z)dd�Z*e+e,fZ-dd�Z.dd�Z/dd�Z0dd�Z1d
d!�Z2d"d#�Z3d$d%�Z4d&d'�Z5d(d)�Z6d*d+�Z7d,d-�Z8d.d/�Z9e!ej:j;�Z<Gd0d�de&e<�Z;Gd1d2�d2�Z=dS)3�Distribution�N)�defaultdict)�DistutilsOptionError�DistutilsPlatformError�DistutilsSetupError)�
rfc822_escape)�
StrictVersion)�six)�	packaging)�map�filter�filterfalse)�Require)�windows_support)�
get_unpatched)�parse_configuration�)�Distribution_parse_config_filesz&setuptools.extern.packaging.specifiersz#setuptools.extern.packaging.versioncCstjdt�t|�S)NzDo
not call this
function)�warnings�warn�DeprecationWarningr)�cls�r�/usr/lib/python3.6/dist.py�_get_unpatched#srcCsn|js|jrtd�S|jdk	s8|jdk	s8t|dd�dk	r@td�S|js^|js^|js^|j	s^|j
rftd�Std�S)Nz2.1�python_requiresz1.2z1.1z1.0)�long_description_content_type�provides_extrasr�
maintainer�maintainer_email�getattrZprovides�requiresZ	obsoletesZclassifiers�download_url)Zdist_mdrrr�get_metadata_version(s

r#cCsPt|�}|jd|�|jd|j��|jd|j��|jd|j��|jd|j��|td�kr�|jd|j��|jd|j��nJd'}xD|D]<\}}t	||�}t
jr�|j|�}|dk	r�|jd||f�q�W|jd|j
��|j�r|jd|j�x"|jj�D]}|jd|��qWt|j��}|jd|�dj|j��}	|	�rd|jd|	�|td�k�r�x4|j�D]}
|jd|
��q|Wn|j|d|j��|j|d|j��|j|d|j��|j|d|j��|j|d|j��t|d��r|jd
|j�|j�r$|jd!|j�|j�rLx|jD]}|jd"|��q4WdS)(z5Write
the PKG-INFO format data to a file object.
    zMetadata-Version: %s
z	Name: %s
zVersion: %s
zSummary: %s
zHome-page: %s
z1.2zAuthor: %s
zAuthor-email: %s
�Author�author�Author-email�author_email�
Maintainerr�Maintainer-emailrNz%s: %s
zLicense: %s
zDownload-URL: %s
zProject-URL: %s, %s
zDescription: %s
�,z
Keywords: %s
z
Platform: %s
ZPlatformZ
ClassifierZRequiresZProvidesZ	ObsoletesrzRequires-Python: %s
zDescription-Content-Type: %s
zProvides-Extra: %s
�r$r%�r&r'�r(r�r)r)r+r,r-r.)r#�writeZget_nameZget_versionZget_descriptionZget_urlrZget_contactZget_contact_emailr
r	�PY2Z
_encode_fieldZget_licenser"�project_urls�itemsrZget_long_description�joinZget_keywordsZ
get_platformsZ_write_listZget_classifiersZget_requiresZget_providesZ
get_obsoletes�hasattrrrr)�self�file�versionZoptional_fieldsZfield�attrZattr_valZproject_urlZ	long_desc�keywords�platform�extrarrr�write_pkg_file7s\


r<cCsRy tjjd|�}|jst�Wn,ttttfk
rLtd||f��YnXdS)Nzx=z4%r must be importable
'module:attrs' string (got %r))	�
pkg_resources�
EntryPoint�parse�extras�AssertionError�	TypeError�
ValueError�AttributeErrorr)�distr8�value�eprrr�check_importable�srHcCsHydj|�|kst�Wn,ttttfk
rBtd||f��YnXdS)z*Verify that value is a string list or
None�z%%r must be a list of strings (got
%r)N)r3rArBrCrDr)rEr8rFrrr�assert_string_list�s
rJcCsh|}t|||�xR|D]J}|j|�s4tdd|��|jd�\}}}|r||krtjjd||�qWdS)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)rJ�has_contents_forr�
rpartition�	distutils�logr)rEr8rFZns_packagesZnsp�parent�sepZchildrrr�	check_nsp�s

rRc
Cs@yttjt|j���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)	�list�	itertools�starmap�_check_extrar2rBrCrDr)rEr8rFrrr�check_extras�s
rWcCs<|jd�\}}}|r*tj|�r*td|��ttj|��dS)N�:zInvalid
environment marker:
)�	partitionr=Zinvalid_markerrrS�parse_requirements)r;Zreqs�namerQ�markerrrrrV�srVcCs&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}))r8rFN)�boolr�format)rEr8rF�tmplrrr�assert_bool�sr`cCsjy(ttj|��t|ttf�r&td��Wn<ttfk
rd}zd}t|j	||d���WYdd}~XnXdS)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})r8�errorN)
rSr=rZ�
isinstance�dict�setrBrCrr^)rEr8rFrar_rrr�check_requirements�srecCsRytjj|�Wn<tjjk
rL}zd}t|j||d���WYdd}~XnXdS)z.Verify that value
is a valid version specifierzF{attr!r} must be a string containing valid
version specifiers; {error})r8raN)r
Z
specifiersZSpecifierSetZInvalidSpecifierrr^)rEr8rFrar_rrr�check_specifier�s
rfcCs@ytjj|�Wn*tk
r:}zt|��WYdd}~XnXdS)z)Verify that entry_points map is
parseableN)r=r>Z	parse_maprCr)rEr8rF�errr�check_entry_points�srhcCst|tj�std��dS)Nztest_suite
must be a
string)rbr	Zstring_typesr)rEr8rFrrr�check_test_suite�sricCsdt|t�rTxH|j�D]8\}}t|t�s(Pyt|�Wqtk
rJPYqXqWdSt|d��dS)z@Verify that value is a dictionary of
package names to glob listsNzI must be a dictionary mapping package names
to lists of wildcard
patterns)rbrcr2�str�iterrBr)rEr8rF�k�vrrr�check_package_data�s

rncCs,x&|D]}tjd|�stjjd|�qWdS)Nz\w+(\.\w+)*z[WARNING:
%r not a valid package name; please use only .-separated package names in
setup.py)�re�matchrNrOr)rEr8rFZpkgnamerrr�check_packages�s

rqc@s0eZdZdZdeed�ZdZdd�ZdGdd�Z	dd	�Z
d
d�Zedd
��Z
dd�Zdd�ZdHdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd
�Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Z
d5d6�Z!d7d8�Z"d9d:�Z#d;d<�Z$d=d>�Z%d?d@�Z&dAdB�Z'dCdD�Z(dEdF�Z)dS)Ira�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)rr1rcCsp|sd|ksd|krdStjt|d��j�}tjjj|�}|dk	rl|jd�rltjt|d��|_	||_
dS)Nr[r7zPKG-INFO)r=Z	safe_namerj�lower�working_setZby_key�getZhas_metadataZsafe_versionZ_version�
_patched_dist)r5�attrs�keyrErrr�patch_missing_pkg_infoSsz#Distribution.patch_missing_pkg_infoc
s�t�d�}|si�_|pi}d|ks,d|kr4tj�g�_i�_g�_|jdd��_�j	|�|jdg��_
|jdg��_x$tj
d�D]}t��j|jd�q�Wtj��fdd	�|j�D��x\�jj�D]N\}}x6�jj|fD]}||kr�||}Pq�W|�r|�nd}t�j||�q�Wt�jjtj��r>t�jj��j_�jjdk	�r�yHtjj�jj�}t|�}	�jj|	k�r�tj
d
�jj|	f�|	�j_Wn0tjj!t"fk
�r�tj
d�jj�YnX�j#�dS)N�package_data�features�require_features�src_root�dependency_links�setup_requireszdistutils.setup_keywordscs
i|]\}}|�jkr||�qSr)�_DISTUTILS_UNSUPPORTED_METADATA)�.0rlrm)r5rr�
<dictcomp>qsz)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.)$r4ry�Feature�warn_deprecatedr{rzZ
dist_files�popr|rxr}r~r=�iter_entry_points�vars�
setdefaultr[�
_Distribution�__init__r2r�metadata�__dict__�setattrrbr7�numbers�Numberrjr
ZVersionrrZInvalidVersionrB�_finalize_requires)
r5rvZhave_package_datarGZoption�default�sourcerFZverZnormalized_versionr)r5rr�`sR


zDistribution.__init__cCsjt|dd�r|j|j_t|dd�rVx2|jj�D]$}|jd�d}|r.|jjj|�q.W|j�|j	�dS)z�
        Set `metadata.python_requires` and fix environment markers
        in `install_requires` and `extras_require`.
        rN�extras_requirerXr)
r
rr�r��keys�splitr�add�_convert_extras_requirements�"_move_install_requirements_markers)r5r;rrrr��s
zDistribution._finalize_requirescCspt|dd�pi}tt�|_xP|j�D]D\}}|j|x0tj|�D]"}|j|�}|j||j|�qBWq$WdS)z�
        Convert requirements in `extras_require` of the form
        `"extra": ["barbazquux; {marker}"]` to
        `"extra:{marker}": ["barbazquux"]`.
        r�N)	r
rrS�_tmp_extras_requirer2r=rZ�_suffix_for�append)r5Z
spec_ext_reqsZsectionrm�r�suffixrrrr��s


z)Distribution._convert_extras_requirementscCs|jrdt|j�SdS)ze
        For a requirement, return the 'extras_require' suffix for
        that requirement.
       
rXrI)r\rj)�reqrrrr��szDistribution._suffix_forcs�dd�}t�dd�pf}ttj|��}t||�}t||�}ttt|���_x&|D]}�j	dt|j
�j|�qPWt�fdd��j	j
�D���_dS)zv
        Move requirements in `install_requires` that are using environment
        markers `extras_require`.
       
cSs|jS)N)r\)r�rrr�
is_simple_req�szFDistribution._move_install_requirements_markers.<locals>.is_simple_req�install_requiresNrXc3s,|]$\}}|dd�t�j|�D�fVqdS)cSsg|]}t|��qSr)rj)r�r�rrr�
<listcomp>�szMDistribution._move_install_requirements_markers.<locals>.<genexpr>.<listcomp>N)r�
_clean_req)r�rlrm)r5rr�	<genexpr>�szBDistribution._move_install_requirements_markers.<locals>.<genexpr>)r
rSr=rZrr
rrjr�r�r\r�rcr2r�)r5r�Zspec_inst_reqsZ	inst_reqsZsimple_reqsZcomplex_reqsr�r)r5rr��s




z/Distribution._move_install_requirements_markerscCs
d|_|S)zP
        Given a Requirement, remove environment markers and return it.
       
N)r\)r5r�rrrr��szDistribution._clean_reqFcCs*tj||d�t||j|d�|j�dS)zYParses
configuration files from various levels
        and loads configuration.

       
)�	filenames)�ignore_option_errorsN)r��parse_config_filesr�command_optionsr�)r5r�r�rrrr��szDistribution.parse_config_filescCstj|�}|jr|j�|S)z3Process
features after parsing command line
options)r��parse_command_linerz�_finalize_features)r5�resultrrrr��s
zDistribution.parse_command_linecCsd|jdd�S)z;Convert
feature name to corresponding option attribute
nameZwith_�-�_)�replace)r5r[rrr�_feature_attrname�szDistribution._feature_attrnamecCs<tjjtj|�|jdd�}x|D]}tjj|dd�q
W|S)zResolve pre-setup
requirementsT)�	installerZreplace_conflicting)r�)r=rs�resolverZ�fetch_build_eggr�)r5r!Zresolved_distsrErrr�fetch_build_eggs�s
zDistribution.fetch_build_eggscCs�tj|�|jr|j�xHtjd�D]:}t||jd�}|dk	r$|j|j	d�|j
�||j|�q$Wt|dd�r�dd�|jD�|_ng|_dS)Nzdistutils.setup_keywords)r��convert_2to3_doctestscSsg|]}tjj|��qSr)�os�path�abspath)r��prrrr�sz1Distribution.finalize_options.<locals>.<listcomp>)r��finalize_optionsrz�_set_global_opts_from_featuresr=r�r
r[�requirer��loadr�)r5rGrFrrrr�s
zDistribution.finalize_optionsc	Csvtjjtjd�}tjj|�srtj|�tj|�tjj|d�}t|d��$}|j	d�|j	d�|j	d�WdQRX|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�r3�curdir�exists�mkdirrZ	hide_file�openr/)r5Z
egg_cache_dirZreadme_txt_filename�frrr�get_egg_cache_dirs



zDistribution.get_egg_cache_dirc
Cs�ddlm}|jddgi�}|jd�}|j�|jdd�|jd�j�D��|jr�|jdd�}d|krx|dd	|}d
|f|d<|j�}||dg|dd
dd
d
ddd
d�}|j	�|j|�S)z
Fetch an egg needed for
buildingr)�easy_installZscript_argsr�css"|]\}}|dkr||fVqdS)�
find_links�	site_dirs�	index_url�optimize�allow_hostsN)r�r�r�r�r�r�r)r�rlrmrrrr�1sz/Distribution.fetch_build_egg.<locals>.<genexpr>Nr�rZsetup�xTF)
�args�install_dirZexclude_scriptsZalways_copyZbuild_directoryZeditableZupgradeZ
multi_versionZ	no_report�user)
Zsetuptools.command.easy_installr��	__class__�get_option_dict�clear�updater2r}r�Zensure_finalized)r5r�r�rE�optsZlinksr��cmdrrrr�*s(
zDistribution.fetch_build_eggc	Cs�g}|jj�}x�|jj�D]�\}}|j|d�|j|�|jr|j}d}d}|j�s^||}}d|dd||fd|dd||ff}|j	|�d||d|<qW||j
|_
|_||_|_dS)z;Add --with-X/--without-X options based on optional
featuresNz
 (default)rIzwith-zinclude zwithout-zexclude
)
�negative_opt�copyrzr2�_set_feature�validate�optional�description�include_by_default�extend�global_optionsZfeature_optionsZfeature_negopt)	r5Zgo�nor[�feature�descrZincdefZexcdef�newrrrr�Gs"



z+Distribution._set_global_opts_from_featurescCs�xJ|jj�D]<\}}|j|�}|s2|dkr|j�r|j|�|j|d�qWx6|jj�D](\}}|j|�sX|j|�|j|d�qXWdS)z9Add/remove
features and resolve dependencies between
themNrr)rzr2�feature_is_includedr��
include_inr��exclude_from)r5r[r�Zenabledrrrr�bs



zDistribution._finalize_featurescCs`||jkr|j|Stjd|�}x:|D]&}|j|jd�|j�|j|<}|SWtj||�SdS)z(Pluggable
version of
get_command_class()zdistutils.commands)r�N)�cmdclassr=r�r�r�r�r��get_command_class)r5�commandZepsrGr�rrrr�ss


zDistribution.get_command_classcCs>x2tjd�D]$}|j|jkr|j�}||j|j<qWtj|�S)Nzdistutils.commands)r=r�r[r�r�r��print_commands)r5rGr�rrrr��s
zDistribution.print_commandscCs>x2tjd�D]$}|j|jkr|j�}||j|j<qWtj|�S)Nzdistutils.commands)r=r�r[r�r�r��get_command_list)r5rGr�rrrr��s
zDistribution.get_command_listcCst||j|�|�dS)zSet
feature's inclusion
statusN)r�r�)r5r[Zstatusrrrr��szDistribution._set_featurecCst||j|��S)zAReturn
1 if feature is included, 0 if excluded, 'None' if unknown)r
r�)r5r[rrrr��sz
Distribution.feature_is_includedcCsF|j|�dkr&|j|j}t|d��|j|j|�|j|d�dS)z)Request
inclusion of feature named 'name'rz2 is required, but was
excluded or is not
availablerN)r�rzr�rr�r�)r5r[r�rrr�include_feature�s
zDistribution.include_featurecKsDx>|j�D]2\}}t|d|d�}|r0||�q
|j||�q
WdS)a�Add items to distribution that are named in keyword arguments

        For example, 'dist.exclude(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)r2r
�
_include_misc)r5rvrlrm�includerrrr��s

zDistribution.includecsf�d�|jr&��fdd�|jD�|_|jrD��fdd�|jD�|_|jrb��fdd�|jD�|_dS)z9Remove
packages, modules, and extensions in named
packagerKcs$g|]}|�kr|j��r|�qSr)�
startswith)r�r�)�package�pfxrrr��sz0Distribution.exclude_package.<locals>.<listcomp>cs$g|]}|�kr|j��r|�qSr)r�)r�r�)r�r�rrr��scs(g|]
}|j�kr|jj��r|�qSr)r[r�)r�r�)r�r�rrr��sN)�packages�
py_modules�ext_modules)r5r�r)r�r�r�exclude_package�szDistribution.exclude_packagecCs4|d}x&|j�D]}||ks(|j|�rdSqWdS)z<Return
true if 'exclude_package(package)' would do
somethingrKTN)�iter_distribution_namesr�)r5r�r�r�rrrrL�szDistribution.has_contents_forcs�t�t�std|�f��yt||�}Wn
tk
rHtd|��YnX|dk	rlt|t�rlt|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)z %s: No such distribution settingNz4:
this setting cannot be changed via
include/excludecsg|]}|�kr|�qSrr)r��item)rFrrr��sz.Distribution._exclude_misc.<locals>.<listcomp>)rb�sequencerr
rDr�)r5r[rF�oldr)rFr�
_exclude_misc�s
zDistribution._exclude_miscc
s�t|t�std||f��yt||��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)z %s: No such distribution settingNz4: this
setting cannot be changed via
include/excludecsg|]}|�kr|�qSrr)r�r�)r�rrr��sz.Distribution._include_misc.<locals>.<listcomp>)rbr�rr
rDr�)r5r[rFr�r)r�rr��s

zDistribution._include_misccKsDx>|j�D]2\}}t|d|d�}|r0||�q
|j||�q
WdS)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)r2r r�)r5rvrlrm�excluderrrr�s

zDistribution.excludecCs,t|t�std|f��tt|j|��dS)Nz.packages:
setting must be a list or tuple
(%r))rbr�rrSrr�)r5r�rrr�_exclude_packagess
zDistribution._exclude_packagesc
Cs�|jj|_|jj|_|d}|jd�}xB||krh||\}}||=ddl}|j|d�|dd�<|d}q(Wtj|||�}|j|�}	t	|	dd�r�d|f|j|�d<|dk	r�gS|S)Nr�aliasesTrZcommand_consumes_argumentszcommand
liner�)
r�r�r�r��shlexr�r��_parse_command_optsr�r )
r5�parserr�r�r��src�aliasr��nargsZ	cmd_classrrrr�
s"




z
Distribution._parse_command_optscCs�i}x�|jj�D]�\}}x�|j�D]�\}\}}|dkr8q"|jdd�}|dkr�|j|�}|jj�}|jt|di��x<|j�D]\}	}
|
|kr||	}d}Pq|Wtd��n|dkr�d}||j	|i�|<q"WqW|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.
        zcommand liner�r�rr�NzShouldn't be able to get
herer)
r�r2r�Zget_command_objr�r�r�r
rAr�)r5�dr�r��optr��valZcmdobjZneg_opt�neg�posrrr�get_cmdline_options:s(



z Distribution.get_cmdline_optionsccs�x|jp
fD]
}|VqWx|jp$fD]
}|Vq&WxH|jp>fD]:}t|t�rX|\}}n|j}|jd�rt|dd�}|Vq@WdS)z@Yield
all packages, modules, and extension names in
distribution�moduleN�i����)r�r�r�rb�tupler[�endswith)r5ZpkgrZextr[Z	buildinforrrr�bs




z$Distribution.iter_distribution_namescCs�ddl}tjs|jr
tj||�Sddl}t|j|j	�sBtj||�S|jj
j�dkr^tj||�S|jj
}|jj}|j
dkr|dp~d}|jj}|j	|jj�d|||�|_ztj||�S|j	|jj�||||�|_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�utf-8�utf8Zwin32�
)r	r
)�sysr	r0Z
help_commandsr��handle_display_options�iorb�stdout�
TextIOWrapper�encodingrr�errorsr:�line_buffering�detach)r5Zoption_orderrrrr�newlinerrrrr
ts$z#Distribution.handle_display_options)N)NF)*�__name__�
__module__�__qualname__�__doc__rcrdrrurxr�r�r��staticmethodr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rLr�r�r�r�r�rr�r
rrrrrsLB
;

	(c@sPeZdZdZedd��Zdddfffdd�Zdd	�Zd
d�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)rrr)�msgrrrr��szFeature.warn_deprecatedFTc	Ks�|j�||_||_||_||_t|ttf�r4|f}dd�|D�|_dd�|D�}|r^||d<t|t�rn|f}||_	||_
|r�|r�|r�td��dS)NcSsg|]}t|t�r|�qSr)rbrj)r�r�rrrr��sz$Feature.__init__.<locals>.<listcomp>cSsg|]}t|t�s|�qSr)rbrj)r�r�rrrr��sr{zgFeature
%s: must define 'require_features', 'remove', or at
least one of 'packages', 'py_modules',
etc.)r�r��standard�	availabler�rbrjrr{�remover@r)	r5r�rrr�r{r
r@Zerrrrr��s$
zFeature.__init__cCs|jo
|jS)z+Should this feature be included by
default?)rr)r5rrrr��szFeature.include_by_defaultcCs@|jst|jd��|jf|j�x|jD]}|j|�q*WdS)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)rrr�r�r@r{r�)r5rEr�rrrr��s	zFeature.include_incCs2|jf|j�|jr.x|jD]}|j|�qWdS)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)r�r@r
r�)r5rEr�rrrr�s	zFeature.exclude_fromcCs2x,|jD]"}|j|�std|j||f��qWdS)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
rLrr�)r5rEr�rrrr�s

zFeature.validateN)rrrrrr�r�r�r�r�r�rrrrr��s7	r�)>�__all__ror�rr�Z
distutils.logrNZdistutils.coreZ
distutils.cmdZdistutils.distrT�collectionsrZdistutils.errorsrrrZdistutils.utilrZdistutils.versionrZsetuptools.externr	r
Zsetuptools.extern.six.movesrrr
Zsetuptools.dependsrZ
setuptoolsrZsetuptools.monkeyrZsetuptools.configrr=Z
py36compatr�
__import__rr#r<rrSr�rHrJrRrWrVr`rerfrhrirnrqZcorerr�r�rrrr�<module>s`G