1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
3

Q'íc¦ã@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*dd„Z+e,e-fZ.dd„Z/dd„Z0dd„Z1d d!„Z2d"d#„Z3d$d%„Z4d&d'„Z5d(d)„Z6d*d+„Z7d,d-„Z8d.d/„Z9d0d1„Z:e!ej;j<ƒZ=Gd2d„de&e=ƒZ<Gd3d4„d4ƒZ>dS)5Ú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ú5/tmp/pip-build-l_bcah40/setuptools/setuptools/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ÚgetattrÚprovidesÚrequiresÚ	obsoletesÚclassifiersÚdownload_url)Zdist_mdrrrÚget_metadata_version(s

r&cCsTt|ƒ}|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rPx"t|jƒD]}|jd"|ƒq8WdS)(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
ÚPlatformÚ
ClassifierÚRequiresÚProvidesÚ	ObsoletesrzRequires-Python: %s
zDescription-Content-Type: %s
zProvides-Extra: %s
©r'r(©r)r*©r+r©r,r)r3r4r5r6) r&ÚwriteÚget_nameÚget_versionÚget_descriptionÚget_urlrÚget_contactÚget_contact_emailr r	ÚPY2Z
_encode_fieldÚget_licenser%Úproject_urlsÚitemsrÚget_long_descriptionÚjoinÚget_keywordsÚ
get_platformsÚ_write_listÚget_classifiersÚget_requiresÚget_providesÚ
get_obsoletesÚhasattrrrrÚsorted)ÚselfÚfileÚversionZoptional_fieldsÚfieldÚattrZattr_valZproject_urlÚ	long_descÚkeywordsÚplatformÚextrarrrÚwrite_pkg_file7s\


rVc	Cs2ttjj|dƒddd}|j|ƒWdQRXdS)z3Write the PKG-INFO file into the release tree.
    zPKG-INFOÚwzUTF-8)ÚencodingN)ÚopenÚosÚpathrCrV)rMÚbase_dirÚpkg_inforrrÚwrite_pkg_infos
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)ÚdistrQÚvalueÚeprrrÚcheck_importableŠsrjcCsHydj|ƒ|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)rCrcrdrerfr)rgrQrhrrrÚassert_string_list•s
rlcCsh|}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)rlÚhas_contents_forrÚ
rpartitionÚ	distutilsÚlogr)rgrQrhZns_packagesÚnspÚparentÚsepÚchildrrrÚ	check_nspŸs

rvc
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_extrarArdrerfr)rgrQrhrrrÚcheck_extras±s
r{cCs<|jdƒ\}}}|r*tj|ƒr*td|ƒ‚ttj|ƒƒdS)Nú:zInvalid environment marker: )Ú	partitionr_Úinvalid_markerrrwÚparse_requirements)rUÚreqsÚnamertÚmarkerrrrrz½srzcCs&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}))rQrhN)ÚboolrÚformat)rgrQrhÚ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})rQÚerrorN)
rwr_rÚ
isinstanceÚdictÚsetrdrerr„)rgrQrhr‡r…rrrÚcheck_requirementsËsr‹cCsRytjj|ƒ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})rQr‡N)r
Ú
specifiersÚSpecifierSetÚInvalidSpecifierrr„)rgrQrhr‡r…rrrÚcheck_specifierÙs
rcCs@ytjj|ƒWn*tk
r:}zt|ƒ‚WYdd}~XnXdS)z)Verify that entry_points map is parseableN)r_r`Ú	parse_maprer)rgrQrhÚerrrÚcheck_entry_pointsåsr’cCst|tjƒstdƒ‚dS)Nztest_suite must be a string)rˆr	Ústring_typesr)rgrQrhrrrÚcheck_test_suiteísr”c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)rˆr‰rAÚstrÚiterrdr)rgrQrhÚkÚvrrrÚcheck_package_dataòs

r™cCs,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Úmatchrprqr)rgrQrhÚpkgnamerrrÚcheck_packagess

rc@s$eZdZdZdZdd„ZdFdd„Zdd„Zd	d
„Ze	dd„ƒZ
d
d„Zdd„ZdGdd„Z
dd„Zdd„Zdd„Zdd„Zdd„Zdd„Zd d!„Zd"d#„Zd$d%„Zd&d'„Zd(d)„Zd*d+„Zd,d-„Zd.d/„Zd0d1„Zd2d3„Zd4d5„Zd6d7„Zd8d9„Z d:d;„Z!d<d=„Z"d>d?„Z#d@dA„Z$dBdC„Z%dDdE„Z&dS)Hra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.
    NcCsp|sd|ksd|krdStjt|dƒƒjƒ}tjjj|ƒ}|dk	rl|jdƒrltjt|dƒƒ|_	||_
dS)NrrOzPKG-INFO)r_Ú	safe_namer•ÚlowerÚworking_setÚby_keyÚgetÚhas_metadataÚsafe_versionÚ_versionÚ
_patched_dist)rMÚattrsÚkeyrgrrrÚpatch_missing_pkg_infoVsz#Distribution.patch_missing_pkg_infocCs¦t|dƒ}|si|_|pi}d|ks,d|kr4tjƒg|_i|_g|_|jddƒ|_|j	|ƒ|j
diƒ|_|jdgƒ|_|jdgƒ|_
x$tjdƒD]}t|ƒj|jdƒq”Wtj||ƒt|jd|jƒ|j_|j
d	ƒ|j_t|jd
tƒƒ|j_t|jjtjƒrt|jjƒ|j_|jjdk	ršyHtjj |jjƒ}t|ƒ}|jj|krft!j"d|jj|fƒ||j_Wn0tjj#t$fk
r˜t!j"d|jjƒYnX|j%ƒdS)
NÚpackage_dataÚfeaturesÚrequire_featuresÚsrc_rootr@Údependency_linksÚsetup_requireszdistutils.setup_keywordsrrzNormalizing '%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.)&rKrªÚFeatureÚwarn_deprecatedr¬r«Ú
dist_filesÚpopr­r©r¢r@r®r¯r_Úiter_entry_pointsÚvarsÚ
setdefaultrÚ
_DistributionÚ__init__r ÚmetadatarrŠrrˆrOÚnumbersÚNumberr•r
ÚVersionrrÚInvalidVersionrdÚ_finalize_requires)rMr§Zhave_package_datariÚverZnormalized_versionrrrr¸csP



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_requirer|r)
r rr¹rÀÚkeysÚsplitrÚaddÚ_convert_extras_requirementsÚ"_move_install_requirements_markers)rMrUrrrr¾š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 rrwÚ_tmp_extras_requirerAr_rÚ_suffix_forÚappend)rMZ
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.
        r|rk)r‚r•)Ú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_requiresNr|c3s,|]$\}}|dd„tˆj|ƒDƒfVqdS)cSsg|]}t|ƒ‘qSr)r•)Ú.0rÊrrrú
<listcomp>ÛszMDistribution._move_install_requirements_markers.<locals>.<genexpr>.<listcomp>N)rÚ
_clean_req)rÏr—r˜)rMrrú	<genexpr>ÛszBDistribution._move_install_requirements_markers.<locals>.<genexpr>)r rwr_rrr
rr•rÎrÆr‚rÈr‰rArÀ)rMrÍZspec_inst_reqsZ	inst_reqsZsimple_reqsZcomplex_reqsrÊr)rMrrÅÅs




z/Distribution._move_install_requirements_markerscCs
d|_|S)zP
        Given a Requirement, remove environment markers and return it.
        N)r‚)rMrÌ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¾)rMrÓrÔrrrrÕæszDistribution.parse_config_filescCstj|ƒ}|jr|jƒ|S)z3Process features after parsing command line options)r·Úparse_command_liner«Ú_finalize_features)rMÚresultrrrr×ñs
zDistribution.parse_command_linecCsd|jddƒS)z;Convert feature name to corresponding option attribute nameZwith_ú-Ú_)Úreplace)rMrrrrÚ_feature_attrnameøszDistribution._feature_attrnamecCs<tjjtj|ƒ|jdd}x|D]}tjj|ddq W|S)zResolve pre-setup requirementsT)Ú	installerÚreplace_conflicting)rÜ)r_r ÚresolverÚfetch_build_eggrÃ)rMr"Zresolved_distsrgrrrÚ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)rZr[Úabspath)rÏÚprrrrÐsz1Distribution.finalize_options.<locals>.<listcomp>)r·Úfinalize_optionsr«Ú_set_global_opts_from_featuresr_r´r rÚrequireráÚloadrã)rMrirhrrrræs
zDistribution.finalize_optionsc	Csvtjjtjdƒ}tjj|ƒsrtj|ƒtj|ƒtjj|dƒ}t|dƒ$}|j	dƒ|j	dƒ|j	dƒWdQRX|S)Nz.eggsz
README.txtrWzcThis 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.

)
rZr[rCÚcurdirÚexistsÚmkdirrZ	hide_filerYr7)rMZ
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_installÚscript_argsrïcss"|]\}}|dkr||fVqdS)Ú
find_linksÚ	site_dirsÚ	index_urlÚoptimizeÚallow_hostsN)rñròrórôròrõr)rÏr—r˜rrrrÒ0sz/Distribution.fetch_build_egg.<locals>.<genexpr>NrñrÚsetupÚxTF)
ÚargsÚinstall_dirZexclude_scriptsZalways_copyZbuild_directoryÚeditableÚupgradeZ
multi_versionZ	no_reportÚuser)
Zsetuptools.command.easy_installrïÚ	__class__Úget_option_dictÚclearÚupdaterAr®rîÚensure_finalized)rMrÌrïrgÚoptsÚlinksrùÚ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)rkzwith-zinclude zwithout-zexclude )
Únegative_optÚcopyr«rAÚ_set_featureÚvalidateÚoptionalÚdescriptionÚinclude_by_defaultÚextendÚglobal_optionsZfeature_optionsZfeature_negopt)	rMZgoÚnorÚfeatureÚdescrZincdefZexcdefÚnewrrrrçFs"



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)r«rAÚfeature_is_includedrÚ
include_inrÚexclude_from)rMrrZenabledrrrrØas



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)rMÚcommandZepsrirrrrrrs


zDistribution.get_command_classcCs>x2tjdƒD]$}|j|jkr|jƒ}||j|j<qWtj|ƒS)Nzdistutils.commands)r_r´rrràr·Úprint_commands)rMrirrrrrs
zDistribution.print_commandscCs>x2tjdƒD]$}|j|jkr|jƒ}||j|j<qWtj|ƒS)Nzdistutils.commands)r_r´rrràr·Úget_command_list)rMrirrrrr‡s
zDistribution.get_command_listcCst||j|ƒ|ƒdS)zSet feature's inclusion statusN)ÚsetattrrÝ)rMrÚstatusrrrrszDistribution._set_featurecCst||j|ƒƒS)zAReturn 1 if feature is included, 0 if excluded, 'None' if unknown)r rÝ)rMr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)rr«r
rrr)rMrrrrrÚ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)rAr Ú
_include_misc)rMr§r—r˜Úincluderrrr¢s

zDistribution.includecsfˆd‰|jr&‡‡fdd„|jDƒ|_|jrD‡‡fdd„|jDƒ|_|jrb‡‡fdd„|jDƒ|_dS)z9Remove packages, modules, and extensions in named packagermcs$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)rMr 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 somethingrmTN)Úiter_distribution_namesr)rMr r!rårrrrnÎ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)rhrrrÐèsz.Distribution._exclude_misc.<locals>.<listcomp>)rˆÚsequencerr rfr)rMrrhÚoldr)rhrÚ
_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>)rˆr(rr rfr)rMrrhrr)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)rAr r*)rMr§r—r˜Úexcluderrrr+s

zDistribution.excludecCs,t|tƒstd|fƒ‚tt|j|ƒƒdS)Nz.packages: setting must be a list or tuple (%r))rˆr(rrwrr%)rMr"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
rrþÚshlexrÂr·Ú_parse_command_optsrr )
rMÚparserrørr-ÚsrcÚaliasr.ÚnargsÚ	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ÚrrNzShouldn't be able to get herer)
rÖrArÜÚget_command_objrrrr rcr¶)rMÚdrrÚoptr1ÚvalZcmdobjÚneg_optÚnegÚposrrrÚget_cmdline_options9s(



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$rˆÚtuplerÚendswith)rMÚpkgr=ÚextrZ	buildinforrrr&as




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Úutf8Úwin32Ú
)rCrD)Úsysr	r>Ú
help_commandsr·Úhandle_display_optionsÚiorˆÚstdoutÚ
TextIOWrapperrXrŸÚerrorsrTÚline_bufferingÚdetach)rMÚoption_orderrGrJrXrMÚnewlinerNrrrrIss$z#Distribution.handle_display_options)N)NF)'Ú__name__Ú
__module__Ú__qualname__Ú__doc__r¦r©r¸r¾rÄÚstaticmethodrÇrÅrÑrÕr×rÝrârærîrárçrØrrrrrrrr%rnr*rr+r,r/r<r&rIrrrrrsFB
7

	(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)rˆr•)rÏrÊrrrrÐåsz$Feature.__init__.<locals>.<listcomp>cSsg|]}t|tƒs|‘qSr)rˆr•)rÏrÊrrrrÐçsr¬zgFeature %s: must define 'require_features', 'remove', or at least one of 'packages', 'py_modules', etc.)r±r
ÚstandardÚ	availabler	rˆr•rr¬Úremoverbr)	rMr
rZr[r	r¬r\rbZerrrrr¸Øs$
zFeature.__init__cCs|jo
|jS)z+Should this feature be included by default?)r[rZ)rMrrrrö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)r[rr
rrbr¬r)rMrgrí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+rbr\r%)rMrgr'rrrrs	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\rnrr
)rMrgr'rrrrs

zFeature.validateN)rRrSrTrUrVr±r¸rrrrrrrrr°—s7	r°)?Ú__all__ršrZrrºZ
distutils.logrpÚdistutils.coreÚ
distutils.cmdÚdistutils.distrxÚcollectionsrZdistutils.errorsrrrÚdistutils.utilrZdistutils.versionrZsetuptools.externr	r
Zsetuptools.extern.six.movesrrr
Zsetuptools.dependsrÚ
setuptoolsrZsetuptools.monkeyrZsetuptools.configrr_Z
py36compatrÚ
__import__rr&rVr^r?rwr(rjrlrvr{rzr†r‹rr’r”r™rÚcorerr·r°rrrrÚ<module>sbH