B ¨#a_¦ã@sªdgZddlZddlZddlZddlZddlZddlZddlZddl Zddl Zddl Zddl Zddl mZddlmZddlmZddlmZddlZddlZddlmZmZmZddlmZdd lmZdd lm Z m!Z!dd l m"Z"dd l#m$Z$dd l%m&Z&ddl%m'Z'ddl(m)Z)ddl*m+Z+ddl,Z,ddl-Z,ddl,m.Z.ddl/m0Z0ddl1m2Z2ddl3Z3erpddl4m5Z5e6dƒe6dƒdd„Z7dd„Z8e9e9dœdd„Z:de9ee9d œd!d"„Z;de9ee9d œd#d$„Zd*d+„Z?d,d-„Z@d.d/„ZAeBeCfZDd0d1„ZEd2d3„ZFd4d5„ZGd6d7„ZHd8d9„ZId:d;„ZJdd?„ZLd@dA„ZMdBdC„ZNdDdE„ZOdFdG„ZPe0ejQjRƒZSGdHd„deSƒZRGdIdJ„dJe+ƒZTdS)KÚ DistributionéN)Ú strtobool)ÚDEBUG)Útranslate_longopt)Úiglob)ÚListÚOptionalÚ TYPE_CHECKING)Ú defaultdict)Úmessage_from_file)ÚDistutilsOptionErrorÚDistutilsSetupError)Ú rfc822_escape)Ú StrictVersion)Ú packaging)Ú ordered_set)Úunique_everseené)ÚSetuptoolsDeprecationWarning)Úwindows_support)Ú get_unpatched)Úparse_configuration)ÚMessagez&setuptools.extern.packaging.specifiersz#setuptools.extern.packaging.versioncCst dt¡t|ƒS)NzDo not call this function)ÚwarningsÚwarnÚDistDeprecationWarningr)Úcls©rú6/tmp/pip-target-jgxl_w8r/lib/python/setuptools/dist.pyÚ_get_unpatched2s rcCs&t|ddƒ}|dkr"tdƒ}||_|S)NÚmetadata_versionz2.1)Úgetattrrr )ÚselfÚmvrrrÚget_metadata_version7s  r$)ÚcontentÚreturnc CsJ| ¡}t|ƒdkr |d ¡Sd |d ¡t d |dd…¡¡f¡S)zFReverse RFC-822 escaping by removing leading whitespaces from content.rrÚ N)Ú splitlinesÚlenÚlstripÚjoinÚtextwrapÚdedent)r%ÚlinesrrrÚrfc822_unescape?s    r/r)ÚmsgÚfieldr&cCs||}|dkrdS|S)zRead Message header field.ÚUNKNOWNNr)r0r1ÚvaluerrrÚ_read_field_from_msgIsr4cCst||ƒ}|dkr|St|ƒS)z4Read Message header field and apply rfc822_unescape.N)r4r/)r0r1r3rrrÚ_read_field_unescaped_from_msgQs r5cCs| |d¡}|gkrdS|S)z9Read Message header field and return all results as list.N)Úget_all)r0r1ÚvaluesrrrÚ_read_list_from_msgYs r8)r0r&cCs| ¡ ¡}|dkrdS|S)Nr2)Ú get_payloadÚstrip)r0r3rrrÚ_read_payload_from_msgas r;cCsVt|ƒ}t|dƒ|_t|dƒ|_t|dƒ|_t|dƒ|_t|dƒ|_d|_t|dƒ|_ d|_ t|dƒ|_ t |d ƒ|_ d |krŒt|d ƒ|_nd|_t |d ƒ|_|jdkrÀ|jtd ƒkrÀt|ƒ|_t|dƒ|_d |kræt|d ƒ d¡|_t|dƒ|_t|dƒ|_|jtdƒkr4t|dƒ|_t|dƒ|_t|dƒ|_nd|_d|_d|_t|dƒ|_dS)z-Reads the metadata values from a file object.zmetadata-versionÚnameÚversionÚsummaryÚauthorNz author-emailz home-pageÚlicensez download-urlÚ descriptionz2.1Úkeywordsú,ÚplatformÚ classifierz1.1ÚrequiresÚprovidesÚ obsoletesz license-file)r rr r4r<r=rAr?Ú maintainerÚ author_emailÚmaintainer_emailÚurlr5r@Ú download_urlÚlong_descriptionr;ÚsplitrBr8Ú platformsÚ classifiersrFrGrHÚ license_files)r"Úfiler0rrrÚ read_pkg_filehs<              rTcCs"d|krt d¡| dd¡}|S)Nr'z1newlines not allowed and will break in the futureú )rrÚreplace)ÚvalrrrÚ single_line•s  rXc sÚ| ¡}‡fdd„}|dt|ƒƒ|d| ¡ƒ|d| ¡ƒ|dt| ¡ƒƒ|d| ¡ƒd}x.|D]&\}}t||d ƒ}|d k rh|||ƒqhWt|  ¡ƒ}|d |ƒ|j rº|d |j ƒx |j   ¡D]} |d d | ƒqÆWd  | ¡¡} | rø|d| ƒx| ¡D]} |d| ƒqW| ˆd| ¡¡| ˆd| ¡¡| ˆd| ¡¡| ˆd| ¡¡t|dƒrv|d|jƒ|jrŠ|d|jƒ|jr®x|jD]} |d| ƒqšW| ˆd|jpÀg¡ˆ d| ¡¡d S)z5Write the PKG-INFO format data to a file object. csˆ d||f¡dS)Nz%s: %s )Úwrite)Úkeyr3)rSrrÚ write_field¤sz#write_pkg_file..write_fieldzMetadata-VersionÚNameÚVersionZSummaryz Home-page))ZAuthorr?)z Author-emailrJ)Z MaintainerrI)zMaintainer-emailrKNZLicensez Download-URLz Project-URLz%s, %srCZKeywordsÚPlatformÚ ClassifierÚRequiresÚProvidesÚ ObsoletesÚpython_requireszRequires-PythonzDescription-Content-TypezProvides-Extraz License-Filez %s )r$ÚstrÚget_nameÚ get_versionrXÚget_descriptionÚget_urlr!rÚ get_licenserMÚ project_urlsÚitemsr+Ú get_keywordsÚ get_platformsÚ _write_listÚget_classifiersÚ get_requiresÚ get_providesÚ get_obsoletesÚhasattrrcÚlong_description_content_typeÚprovides_extrasrRrYÚget_long_description) r"rSr=r[Zoptional_fieldsr1ÚattrZattr_valr@Ú project_urlrBrDÚextrar)rSrÚwrite_pkg_fileŸsL         rzc Cs`ytj d|¡}|jrt‚Wn<ttttfk rZ}ztd||fƒ|‚Wdd}~XYnXdS)Nzx=z4%r must be importable 'module:attrs' string (got %r)) Ú pkg_resourcesÚ EntryPointÚparseÚextrasÚAssertionErrorÚ TypeErrorÚ ValueErrorÚAttributeErrorr )Údistrwr3ÚepÚerrrÚcheck_importableäs r†c Csjy(t|ttfƒst‚d |¡|ks&t‚Wn<ttttfk rd}ztd||fƒ|‚Wdd}~XYnXdS)z"Verify that value is a string listÚz%%r must be a list of strings (got %r)N) Ú isinstanceÚlistÚtuplerr+r€rr‚r )rƒrwr3r…rrrÚassert_string_listïs r‹cCsh|}t|||ƒxR|D]J}| |¡s4tdd|ƒ‚| d¡\}}}|r||krtj d||¡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)r‹Úhas_contents_forr Ú rpartitionÚ distutilsÚlogr)rƒrwr3Z ns_packagesÚnspÚparentÚsepÚchildrrrÚ check_nspýs     r•c CsPytt t| ¡¡ƒWn2tttfk rJ}ztdƒ|‚Wdd}~XYnXdS)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) r‰Ú itertoolsÚstarmapÚ _check_extrarkr€rr‚r )rƒrwr3r…rrrÚ check_extrass r™cCs<| d¡\}}}|r*t |¡r*td|ƒ‚tt |¡ƒdS)Nú:zInvalid environment marker: )Ú partitionr{Úinvalid_markerr r‰Úparse_requirements)ryÚreqsr<r“Úmarkerrrrr˜s r˜cCs&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}))rwr3N)Úboolr Úformat)rƒrwr3ÚtmplrrrÚ assert_bool"s r£c Csly(tt |¡ƒt|ttfƒr&tdƒ‚Wn>ttfk rf}zd}t|j ||dƒ|‚Wdd}~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})rwÚerrorN) r‰r{rrˆÚdictÚsetr€rr r¡)rƒrwr3r¤r¢rrrÚcheck_requirements)s r§c CsXytj |¡WnBtjjtfk rR}zd}t|j||dƒ|‚Wdd}~XYnXdS)z.Verify that value is a valid version specifierzF{attr!r} must be a string containing valid version specifiers; {error})rwr¤N)rÚ specifiersÚ SpecifierSetÚInvalidSpecifierr‚r r¡)rƒrwr3r¤r¢rrrÚcheck_specifier9sr«c CsBytj |¡Wn,tk r<}zt|ƒ|‚Wdd}~XYnXdS)z)Verify that entry_points map is parseableN)r{r|Ú parse_maprr )rƒrwr3r…rrrÚcheck_entry_pointsGsr­cCst|tƒstdƒ‚dS)Nztest_suite must be a string)rˆrdr )rƒrwr3rrrÚcheck_test_suiteOs r®cCs^t|tƒstd |¡ƒ‚x@| ¡D]4\}}t|tƒsDtd ||¡ƒ‚t|d |¡|ƒq"WdS)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)rˆr¥r r¡rkrdr‹)rƒrwr3ÚkÚvrrrÚcheck_package_dataTs   r±cCs,x&|D]}t d|¡stj d|¡qWdS)Nz \w+(\.\w+)*z[WARNING: %r not a valid package name; please use only .-separated package names in setup.py)ÚreÚmatchrrr)rƒrwr3ÚpkgnamerrrÚcheck_packagescs   rµc@szeZdZdZdd„eejdd„dd„dœZdZdd „Z dUd d „Z d d „Z e dd„ƒZ e dd„ƒZdd„Zdd„Ze dd„ƒZdd„Zdd„Zdd„Ze dd„ƒZdVd d!„Zd"d#„Zd$d%„Zd&d'„ZdWd(d)„ZdXd+d,„Zd-d.„Zd/d0„Zd1d2„Zd3d4„Zd5d6„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+dMdN„Z,dOdP„Z-dQdR„Z.dSdT„Z/dS)YraG Distribution with support for 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. '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. cCsdS)NrrrrrÚ¤ózDistribution.cCsdS)Nrrrrrr¶§r·cCsdS)Nrrrrrr¶¨r·)rtrjruÚ license_filerRNcCsl|rd|ksd|krdSt t|dƒ¡ ¡}tjj |¡}|dk rh| d¡sht t|dƒ¡|_ ||_ dS)Nr<r=zPKG-INFO) r{Ú safe_namerdÚlowerÚ working_setÚby_keyÚgetÚ has_metadataÚ safe_versionÚ_versionÚ _patched_dist)r"ÚattrsrZrƒrrrÚpatch_missing_pkg_info­sz#Distribution.patch_missing_pkg_infocsÈtˆdƒ}|siˆ_|pi}gˆ_| dd¡ˆ_ˆ |¡| dg¡ˆ_| dg¡ˆ_x$t  d¡D]}t ˆƒ  |j d¡qbWt  ˆ‡fdd„| ¡Dƒ¡ˆ |¡ˆ ˆ ˆjj¡¡ˆj_ˆ ¡dS)NÚ package_dataÚsrc_rootÚdependency_linksÚsetup_requireszdistutils.setup_keywordscs i|]\}}|ˆjkr||“qSr)Ú_DISTUTILS_UNSUPPORTED_METADATA)Ú.0r¯r°)r"rrú Çsz)Distribution.__init__..)rsrÄÚ dist_filesÚpoprÅrÃrÆrÇr{Úiter_entry_pointsÚvarsÚ setdefaultr<Ú _DistributionÚ__init__rkÚ_set_metadata_defaultsÚ_normalize_versionÚ_validate_versionÚmetadatar=Ú_finalize_requires)r"rÂZhave_package_datar„r)r"rrѺs"   zDistribution.__init__cCs8x2|j ¡D]$\}}t|jƒ || ||ƒ¡¡q WdS)zä Fill-in missing metadata fields not supported by distutils. Some fields may have been set by other tools (e.g. pbr). Those fields (vars(self.metadata)) take precedence to supplied attrs. N)rÈrkrÎrÕrÏr½)r"rÂÚoptionÚdefaultrrrrÒÒsz#Distribution._set_metadata_defaultscCsPt|tjƒs|dkr|Sttj |¡ƒ}||krLd}t |j ft ƒŽ¡|S|S)Nz)Normalizing '{version}' to '{normalized}') rˆÚ setuptoolsÚsicrdrr=r]rrr¡Úlocals)r=Ú normalizedr¢rrrrÓÜszDistribution._normalize_versionc Csbt|tjƒrt|ƒ}|dk r^ytj |¡Wn0tjjtfk r\t   d|¡t   |¡SX|S)Nz¦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.) rˆÚnumbersÚNumberrdrr=r]ÚInvalidVersionr€rrrÙrÚ)r=rrrrÔès  zDistribution._validate_versioncCsjt|ddƒr|j|j_t|ddƒrVx2|j ¡D]$}| d¡d}|r.|jj |¡q.W| ¡|  ¡dS)z€ Set `metadata.python_requires` and fix environment markers in `install_requires` and `extras_require`. rcNÚextras_requireršr) r!rcrÕràÚkeysrOruÚaddÚ_convert_extras_requirementsÚ"_move_install_requirements_markers)r"ryrrrrÖûs   zDistribution._finalize_requirescCspt|ddƒpi}ttƒ|_xP| ¡D]D\}}|j|x0t |¡D]"}| |¡}|j|| |¡qBWq$WdS)z¡ Convert requirements in `extras_require` of the form `"extra": ["barbazquux; {marker}"]` to `"extra:{marker}": ["barbazquux"]`. ràN) r!r r‰Ú_tmp_extras_requirerkr{rÚ _suffix_forÚappend)r"Z 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šr‡)rŸrd)ÚreqrrrræszDistribution._suffix_forcs–dd„}tˆddƒpd}tt |¡ƒ}t||ƒ}t ||¡}ttt|ƒƒˆ_ x&|D]}ˆj dt|j ƒ  |¡qRWt ‡fdd„ˆ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_req0szFDistribution._move_install_requirements_markers..is_simple_reqÚinstall_requiresNrršc3s,|]$\}}|dd„tˆj|ƒDƒfVqdS)cSsg|] }t|ƒ‘qSr)rd)rÉrérrrú <szMDistribution._move_install_requirements_markers...N)ÚmapÚ _clean_req)rÉr¯r°)r"rrú <szBDistribution._move_install_requirements_markers..)r!r‰r{rÚfilterr–Ú filterfalserïrdrírårŸrçr¥rkrà)r"rìZspec_inst_reqsZ inst_reqsZ simple_reqsZ complex_reqsrér)r"rrä&s     z/Distribution._move_install_requirements_markerscCs d|_|S)zP Given a Requirement, remove environment markers and return it. N)rŸ)r"rërrrrð@szDistribution._clean_reqcCs`|jj}|r|ng}|jj}|r2||kr2| |¡|dkrF|dkrFd}tt| |¡ƒƒ|j_dS)z>> list(Distribution._expand_patterns(['LICENSE'])) ['LICENSE'] >>> list(Distribution._expand_patterns(['setup.cfg', 'LIC*'])) ['setup.cfg', 'LICENSE'] css:|]2}tt|ƒƒD] }| d¡stj |¡r|VqqdS)ú~N)ÚsortedrÚendswithÚosÚpathÚisfile)rÉÚpatternrûrrrrñbs z0Distribution._expand_patterns..r)rõrrrrôYs zDistribution._expand_patternsc Csàddlm}tjtjkrgnddddddd d d d d ddg }t|ƒ}|dkrR| ¡}tr`| d¡|ƒ}t |_ xÆ|D]¾}t j |dd(}trž| dj ftƒŽ¡| |¡WdQRXxt| ¡D]h}| |¡}| |¡} xN|D]F} | dksÚ| |krðqÚ| || ¡} | | |¡} | | |¡} || f| | <qÚWq¼W| ¡qrWd|jkrDdSx–|jd ¡D]„\} \} } |j | ¡} | r~t| ƒ } n| dkrt| ƒ} yt|| pž| | ƒWn.tk rÔ}zt|ƒ|‚Wdd}~XYnXqTWdS)z£ Adapted from distutils.dist.Distribution.parse_config_files, this method provides the same functionality in subtly-improved ways. r)Ú ConfigParserz install-basezinstall-platbasez install-libzinstall-platlibzinstall-purelibzinstall-headerszinstall-scriptsz install-dataÚprefixz exec-prefixÚhomeÚuserÚrootNz"Distribution.parse_config_files():zutf-8)Úencodingz reading {filename}Ú__name__Úglobal)ÚverboseÚdry_run)Ú configparserrþÚsysrÿÚ base_prefixÚ frozensetÚfind_config_filesrÚannouncerdÚ optionxformÚioÚopenr¡rÛÚ read_fileÚsectionsÚoptionsÚget_option_dictr½Úwarn_dash_deprecationÚmake_option_lowercaserÑÚcommand_optionsrkÚ negative_optrÚsetattrrr )r"Ú filenamesrþÚignore_optionsÚparserÚfilenameÚreaderrèrÚopt_dictÚoptrWÚsrcÚaliasr…rrrÚ_parse_config_filesjsR               z Distribution._parse_config_filescCsd|dkr |S| dd¡}tjj| ¡}| d¡sF|dkrF||krF|Sd|kr`t d||f¡|S)N)zoptions.extras_requirezoptions.data_filesú-Ú_rrÕzrUsage of dash-separated '%s' will not be supported in future versions. Please use the underscore name '%s' instead)rVrÚcommandÚ__all__Ú_setuptools_commandsÚ startswithrr)r"r rèZunderscore_optÚcommandsrrrr¬s  z"Distribution.warn_dash_deprecationcCs4yt d¡}t| d¡ƒStjk r.gSXdS)NrÙzdistutils.commands)r{Úget_distributionr‰Ú get_entry_mapÚDistributionNotFound)r"rƒrrrr(¿s  z!Distribution._setuptools_commandscCs4|dks| ¡r|S| ¡}t d|||f¡|S)NrÕzlUsage of uppercase key '%s' in '%s' will be deprecated in future versions. Please use lowercase '%s' instead)Úislowerrºrr)r"r rèZ lowercase_optrrrrÇsz"Distribution.make_option_lowercasec Csd| ¡}|dkr| |¡}tr,| d|¡x0| ¡D]"\}\}}tr^| d|||f¡ydd„|jDƒ}Wntk rŠg}YnXy |j}Wntk r®i}YnXy|t|t ƒ} ||krà| ràt |||t |ƒ ƒnJ||krþ| rþt ||t |ƒƒn,t ||ƒrt |||ƒnt d|||fƒ‚Wq8tk rZ} zt | ƒ| ‚Wdd} ~ XYq8Xq8WdS)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|ƒ‘qSr)r)rÉÚorrrrîësz5Distribution._set_command_options..z1error in %s: command '%s' has no such option '%s')Úget_command_namerrr rkÚboolean_optionsr‚rrˆrdrrrsr r) r"Ú command_objÚ option_dictÚ command_namer×Úsourcer3Ú bool_optsÚneg_optÚ is_stringr…rrrÚ_set_command_optionsÔs>           z!Distribution._set_command_optionsFcCs0|j|dt||j|d| ¡| ¡dS)zYParses configuration files from various levels and loads configuration. )r)Úignore_option_errorsN)r#rrrÖrö)r"rr:rrrÚparse_config_filess  zDistribution.parse_config_filescCs<tjjt |¡|jdd}x|D]}tjj|ddq W|S)zResolve pre-setup requirementsT)Ú installerÚreplace_conflicting)rV)r{r»ÚresolverÚfetch_build_eggrâ)r"rFZresolved_distsrƒrrrÚfetch_build_eggss zDistribution.fetch_build_eggscCsBd}dd„}tdd„t |¡ƒ}xt||dD] }||ƒq.WdS)zè Allow plugins to apply arbitrary operations to the distribution. Each hook may optionally define a 'order' to influence the order of execution. Smaller numbers go first and the default is 0. z(setuptools.finalize_distribution_optionscSs t|ddƒS)NÚorderr)r!)ÚhookrrrÚby_order#sz/Distribution.finalize_options..by_ordercSs| ¡S)N)Úload)r…rrrr¶%r·z/Distribution.finalize_options..)rZN)rïr{rÍrø)r"ÚgrouprCÚepsr„rrrÚfinalize_optionss zDistribution.finalize_optionscCsNxHt d¡D]:}t||jdƒ}|dk r |j|jd| ¡||j|ƒq WdS)Nzdistutils.setup_keywords)r<)r{rÍr!r<Úrequirer?rD)r"r„r3rrrÚ_finalize_setup_keywords)s z%Distribution._finalize_setup_keywordscCs*t|ddƒr dd„|jDƒ|_ng|_dS)NÚconvert_2to3_doctestscSsg|]}tj |¡‘qSr)rúrûÚabspath)rÉÚprrrrî4sz8Distribution._finalize_2to3_doctests..)r!rJ)r"rrrÚ_finalize_2to3_doctests0s z$Distribution._finalize_2to3_doctestsc Csvtj tjd¡}tj |¡srt |¡t |¡tj |d¡}t|dƒ$}|  d¡|  d¡|  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ûr+ÚcurdirÚexistsÚmkdirrZ hide_filerrY)r"Z egg_cache_dirZreadme_txt_filenameÚfrrrÚget_egg_cache_dir:s      zDistribution.get_egg_cache_dircCsddlm}|||ƒS)z Fetch an egg needed for buildingr)r?)Zsetuptools.installerr?)r"rër?rrrr?Is zDistribution.fetch_build_eggcCs`||jkr|j|St d|¡}x:|D]&}|j|jd| ¡|j|<}|SWt ||¡SdS)z(Pluggable version of get_command_class()zdistutils.commands)r<N)Úcmdclassr{rÍrHr?rDrÐÚget_command_class)r"r&rFr„rTrrrrUNs    zDistribution.get_command_classcCs>x2t d¡D]$}|j|jkr | ¡}||j|j<q Wt |¡S)Nzdistutils.commands)r{rÍr<rTr>rÐÚprint_commands)r"r„rTrrrrV[s  zDistribution.print_commandscCs>x2t d¡D]$}|j|jkr | ¡}||j|j<q Wt |¡S)Nzdistutils.commands)r{rÍr<rTr>rÐÚget_command_list)r"r„rTrrrrWcs  zDistribution.get_command_listcKsDx>| ¡D]2\}}t|d|dƒ}|r0||ƒq | ||¡q WdS)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)rkr!Ú _include_misc)r"rÂr¯r°ÚincluderrrrYks  zDistribution.includecsfˆd‰|jr&‡‡fdd„|jDƒ|_|jrD‡‡fdd„|jDƒ|_|jrb‡‡fdd„|jDƒ|_dS)z9Remove packages, modules, and extensions in named packagerŒcs"g|]}|ˆkr| ˆ¡s|‘qSr)r))rÉrL)ÚpackageÚpfxrrrî‡sz0Distribution.exclude_package..cs"g|]}|ˆkr| ˆ¡s|‘qSr)r))rÉrL)rZr[rrrîscs&g|]}|jˆkr|j ˆ¡s|‘qSr)r<r))rÉrL)rZr[rrrî“sN)ÚpackagesÚ py_modulesÚ ext_modules)r"rZr)rZr[rÚexclude_packageszDistribution.exclude_packagecCs4|d}x&| ¡D]}||ks(| |¡rdSqWdS)z.)rˆÚsequencer r!r‚r)r"r<r3Úoldr…r)r3rÚ _exclude_misc s  zDistribution._exclude_miscc s®t|tƒstd||fƒ‚yt||ƒ‰Wn0tk rX}ztd|ƒ|‚Wdd}~XYnXˆdkrpt|||ƒn:tˆtƒsˆt|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Éra)rcrrrîÇsz.Distribution._include_misc..)rˆrbr r!r‚r)r"r<r3r…Únewr)rcrrX³s    zDistribution._include_misccKsDx>| ¡D]2\}}t|d|dƒ}|r0||ƒq | ||¡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)rkr!rd)r"rÂr¯r°ÚexcluderrrrfÊs  zDistribution.excludecCs,t|tƒstd|fƒ‚tt|j|ƒƒdS)Nz.packages: setting must be a list or tuple (%r))rˆrbr r‰rïr_)r"r\rrrÚ_exclude_packagesás  zDistribution._exclude_packagesc Cs°|jj|_|jj|_|d}| d¡}xB||krh||\}}||=ddl}| |d¡|dd…<|d}q(Wt |||¡}| |¡} t | ddƒr¬d|f| |¡d<|dk r¬gS|S)NrÚaliasesTrZcommand_consumes_argumentsz command lineÚargs) Ú __class__Úglobal_optionsrrÚshlexrOrÐÚ_parse_command_optsrUr!) r"rrir&rhr!r"rlÚnargsÚ cmd_classrrrrmès"        z Distribution._parse_command_optsc CsÌi}xÂ|j ¡D]´\}}xª| ¡D]ž\}\}}|dkr8q"| dd¡}|dkr¤| |¡}|j ¡}| t|diƒ¡x<| ¡D]\} } | |kr|| }d}Pq|Wtdƒ‚n |dkr°d}||  |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) rrkrVÚget_command_objrÚcopyÚupdater!rrÏ) r"ÚdÚcmdÚoptsr r!rWZcmdobjr7ÚnegÚposrrrÚget_cmdline_optionss(     z Distribution.get_cmdline_optionsccs‚x|jp dD] }|Vq Wx|jp$dD] }|Vq&WxH|jp>dD]:}t|tƒrX|\}}n|j}| d¡rt|dd…}|Vq@WdS)z@Yield all packages, modules, and extension names in distributionrÚmoduleNiúÿÿÿ)r\r]r^rˆrŠr<rù)r"ÚpkgryÚextr<Z buildinforrrr`*s      z$Distribution.iter_distribution_namesc CsÂddl}|jrt ||¡St|jtjƒs4t ||¡S|jj  ¡dkrPt ||¡S|jj}|jj }|j dkrndppd}|jj }t |j  ¡d|||¡|_z t ||¡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)zutf-8Úutf8Úwin32r'zutf-8)r Ú help_commandsrÐÚhandle_display_optionsrˆÚstdoutrÚ TextIOWrapperrrºÚerrorsrDÚline_bufferingÚdetach)r"Ú option_orderr rr‚Únewlinerƒrrrr<s"    z#Distribution.handle_display_options)N)N)N)NF)0rÚ __module__Ú __qualname__Ú__doc__r¥rZ OrderedSetrÈrÁrÃrÑrÒÚ staticmethodrÓrÔrÖrãrærärðrörôr#rr(rr9r;r@rGrIrMrSr?rUrVrWrYr_rrdrXrfrgrmrxr`rrrrrrosZ2      B /     (c@seZdZdZdS)rzrClass for warning about deprecations in dist in setuptools. Not ignored by default, unlike DeprecationWarning.N)rr‡rˆr‰rrrrr_sr)Ur'rr r²rúrrÝZ distutils.logrÚdistutils.coreÚ distutils.cmdÚdistutils.distÚdistutils.commandÚdistutils.utilrÚdistutils.debugrÚdistutils.fancy_getoptrÚglobrr–r,Útypingrrr Ú collectionsr Úemailr Údistutils.errorsr r rZdistutils.versionrZsetuptools.externrrZ setuptools.extern.more_itertoolsrr‡rrÙZsetuptools.commandrZsetuptools.monkeyrZsetuptools.configrr{Ú email.messagerÚ __import__rr$rdr/r4r5r8r;rTrXrzrŠr‰rbr†r‹r•r™r˜r£r§r«r­r®r±rµÚcorerrÐrrrrrÚsˆ                 - B   u