a „oeþÃã@sòdZddlZddlZddlZddlZddlZddlZddlmZz ddl Z Wne ybdZ Yn0ddl m Z m Z mZmZddlmZmZddlmZmZmZddlmZdd lmZe d ¡Zd d „ZGd d„dƒZGdd„dƒZdd„Z dS)z}distutils.dist Provides the Distribution class, which represents the module distribution being built/installed/distributed. éN)Úmessage_from_fileé)ÚDistutilsOptionErrorÚDistutilsModuleErrorÚDistutilsArgErrorÚDistutilsClassError)Ú FancyGetoptÚtranslate_longopt)Ú check_environÚ strtoboolÚ rfc822_escape©Úlog)ÚDEBUGz^[a-zA-Z]([a-zA-Z0-9_]*)$cCsLt|tƒr nWarning: '{fieldname}' should be a list, got type '{typename}') Ú isinstanceÚstrÚlistÚtypeÚ__name__ÚformatÚlocalsrZwarning)ÚvalueZ fieldnameÚtypenameÚmsg©rú;C:\Program Files\Certbot\pkgs\setuptools\_distutils\dist.pyÚ _ensure_list&s    rc@sLeZdZdZgd¢ZdZgd¢Zdd„eDƒZddiZdKd d „Z d d „Z dLdd„Z dd„Z dd„Z dMdd„Zdd„Zdd„Zdd„Zdd„Zddgfd d!„Zd"d#„Zd$d%„Zd&d'„Zd(d)„Zd*d+„Zd,d-„ZdNd.d/„ZdOd0d1„ZdPd3d4„Zejfd5d6„Zd7d8„Z d9d:„Z!d;d<„Z"d=d>„Z#d?d@„Z$dAdB„Z%dCdD„Z&dEdF„Z'dGdH„Z(dIdJ„Z)d S)QÚ Distributiona½The core of the Distutils. Most of the work hiding behind 'setup' is really done within a Distribution instance, which farms the work out to the Distutils commands specified on the command line. Setup scripts will almost never instantiate Distribution directly, unless the 'setup()' function is totally inadequate to their needs. However, it is conceivable that a setup script might wish to subclass Distribution for some specialized purpose, and then pass the subclass to 'setup()' as the 'distclass' keyword argument. If so, it is necessary to respect the expectations that 'setup' has of Distribution. See the code for 'setup()', in core.py, for details. ))ÚverboseÚvzrun verbosely (default)r)ÚquietÚqz!run quietly (turns verbosity off))zdry-runÚnzdon't actually do anything)ÚhelpÚhzshow detailed help message)z no-user-cfgNz-ignore pydistutils.cfg in your home directoryz£Common commands: (see '--help-commands' for more) setup.py build will build the package underneath 'build/' setup.py install will install the package ))z help-commandsNzlist all available commands)ÚnameNzprint package name)ÚversionÚVzprint package version)ÚfullnameNzprint -)ÚauthorNzprint the author's name)ú author-emailNz print the author's email address)Ú maintainerNzprint the maintainer's name)zmaintainer-emailNz$print the maintainer's email address)ÚcontactNz7print the maintainer's name if known, else the author's)z contact-emailNz@print the maintainer's email address if known, else the author's)ÚurlNzprint the URL for this package)ÚlicenseNz print the license of the package)ÚlicenceNzalias for --license)Ú descriptionNzprint the package description)zlong-descriptionNz"print the long package description)Ú platformsNzprint the list of platforms)Ú classifiersNzprint the list of classifiers)ÚkeywordsNzprint the list of keywords)ÚprovidesNz+print the list of packages/modules provided)ÚrequiresNz+print the list of packages/modules required)Ú obsoletesNz0print the list of packages/modules made obsoletecCsg|]}t|dƒ‘qS)r©r )Ú.0ÚxrrrÚ xózDistribution.r rNcCs\d|_d|_d|_|jD]}t||dƒqtƒ|_|jjD] }d|}t||t|j|ƒƒq:i|_ d|_ d|_ d|_ i|_ g|_d|_i|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_i|_i|_|�r| d¡}|du�r8|d=| ¡D]4\}}|  |¡}| ¡D]\} } d| f|| <�q�qd|v�r~|d|d <|d=d } t!du�rnt! "| ¡nt#j$ %| d ¡| ¡D]€\} } t&|jd | ƒ�r¶t|jd | ƒ| ƒnNt&|j| ƒ�rÔt|j| | ƒn0t&|| ƒ�rît|| | ƒnd t'| ƒ} t! "| ¡�q†d|_(|j du�rP|j D].} |  )d¡�s6�qP| dk�r d|_(�qP�q | *¡dS)a0Construct a new Distribution instance: initialize all the attributes of a Distribution, and then use 'attrs' (a dictionary mapping attribute names to values) to assign some of those attributes their "real" values. (Any attributes not mentioned in 'attrs' will be assigned to some null value: 0, None, an empty list or dictionary, etc.) Most importantly, initialize the 'command_obj' attribute to the empty dictionary; this will be filled in with real command objects by 'parse_command_line()'. rrÚget_NÚÚoptionsz setup scriptr/r.z:'licence' distribution option is deprecated; use 'license'Ú Zset_zUnknown distribution option: %sTú-z --no-user-cfgF)+rÚdry_runr#Údisplay_option_namesÚsetattrÚDistributionMetadataÚmetadataÚ_METHOD_BASENAMESÚgetattrÚcmdclassÚcommand_packagesÚ script_nameÚ script_argsÚcommand_optionsZ dist_filesÚpackagesZ package_dataZ package_dirÚ py_modulesÚ librariesÚheadersÚ ext_modulesZ ext_packageZ include_dirsZ extra_pathÚscriptsÚ data_filesÚpasswordÚ command_objÚhave_runÚgetÚitemsÚget_option_dictÚwarningsÚwarnÚsysÚstderrÚwriteÚhasattrÚreprÚ want_user_cfgÚ startswithÚfinalize_options)ÚselfÚattrsÚattrÚbasenameZ method_namer>ÚcommandZ cmd_optionsÚopt_dictÚoptÚvalrÚkeyÚargrrrÚ__init__s~                   zDistribution.__init__cCs&|j |¡}|dur"i}|j|<|S)zíGet the option dictionary for a given command. If that command's option dictionary hasn't been created yet, then create it and return the new dictionary; otherwise, return the existing option dictionary. N)rLrW)rdrhÚdictrrrrYs zDistribution.get_option_dictr=c CsÈddlm}|dur"t|j ¡ƒ}|dur@| ||¡|d}|sV| |d¡dS|D]h}|j |¡}|dur†| |d|¡qZ| |d|¡||ƒ}| d¡D]}| |d|¡qªqZdS)Nr)Úpformatz zno commands known yetzno option dict for '%s' commandzoption dict for '%s' command:r?)ZpprintrpÚsortedrLÚkeysÚannouncerWÚsplit) rdÚheaderÚcommandsÚindentrpZcmd_nameriÚoutÚlinerrrÚdump_option_dicts(s"  zDistribution.dump_option_dictscCs4tƒdd„| ¡Dƒ}tr0| dd |¡¡|S)aÖFind as many configuration files as should be processed for this platform, and return a list of filenames in the order in which they should be parsed. The filenames returned are guaranteed to exist (modulo nasty race conditions). There are multiple possible config files: - distutils.cfg in the Distutils installation directory (i.e. where the top-level Distutils __inst__.py file lives) - a file in the user's home directory named .pydistutils.cfg on Unix and pydistutils.cfg on Windows/Mac; may be disabled with the ``--no-user-cfg`` option - setup.cfg in the current directory - a file named by an environment variable cSs g|]}tj |¡rt|ƒ‘qSr)ÚosÚpathÚisfiler)r8r|rrrr:Rr;z2Distribution.find_config_files..zusing config files: %sz, )r Ú _gen_pathsrrsÚjoin)rdÚfilesrrrÚfind_config_filesBs zDistribution.find_config_filesccsšt tjdj¡j}|dVdtjdk}|d}|jrNt d¡  ¡|Vt d¡Vt   t ¡�"t t  d¡¡VWdƒn1sŒ0YdS) NÚ distutilsz distutils.cfgÚ.Úposixzpydistutils.cfgú~z setup.cfgZDIST_EXTRA_CONFIG)ÚpathlibÚPathr\ÚmodulesÚ__file__Úparentr{r%raÚ expanduserÚ contextlibÚsuppressÚ TypeErrorÚgetenv)rdZsys_dirÚprefixÚfilenamerrrr~Ys   zDistribution._gen_pathsc CsŽddlm}tjtjkr"gd¢}ng}t|ƒ}|dur>| ¡}trL| d¡|ƒ}|D]ˆ}trl| d|¡|  |¡|  ¡D]V}|  |¡}|  |¡}|D]8} | dkrš| |vrš|  || ¡} |  dd¡} || f|| <qšq~| ¡qVd |jv�rŠ|jd  ¡D]Ž\} \} } |j  | ¡} zF| �r.t|| t| ƒ ƒn(| d v�rJt|| t| ƒƒn t|| | ƒWqút�y†} zt| ƒ‚WYd} ~ qúd} ~ 00qúdS) Nr)Ú ConfigParser) z install-basezinstall-platbasez install-libzinstall-platlibzinstall-purelibzinstall-headerszinstall-scriptsz install-datar�z exec-prefixÚhomeÚuserÚrootz"Distribution.parse_config_files():z reading %srr@Ú_Úglobal)rrA)Z configparserr’r\r�Ú base_prefixÚ frozensetr�rrsÚreadZsectionsr>rYrWÚreplacernrLrXÚ negative_optrCr Ú ValueErrorr)rdÚ filenamesr’Zignore_optionsÚparserr‘Úsectionr>rirjrkÚsrcÚaliasrrrrÚparse_config_filesksD              zDistribution.parse_config_filescCsÌ| ¡}g|_t||jƒ}| |j¡| ddi¡|j|j|d�}|  ¡}t   ¡  t j d|j¡| |¡rvdS|r”| ||¡}|durvdSqv|jrº|j|t|jƒdk|jd�dS|jsÈtdƒ‚d S) a‡Parse the setup script's command line, taken from the 'script_args' instance attribute (which defaults to 'sys.argv[1:]' -- see 'setup()' in core.py). This list is first processed for "global options" -- options that set attributes of the Distribution instance. Then, it is alternately scanned for Distutils commands and options for that command. Each new command terminates the options for the previous command. The allowed options for a command are determined by the 'user_options' attribute of the command class -- thus, we have to be able to load command classes in order to parse the command line. Any error in that 'options' attribute raises DistutilsGetoptError; any error on the command-line raises DistutilsArgError. If no Distutils commands were found on the command line, raises DistutilsArgError. Return true if command-line was successfully parsed and we should carry on with executing commands; false if no errors but we shouldn't execute commands (currently, this only happens if user asks for help). r/r.)ÚargsÚobjecté Nr©Údisplay_optionsrvzno commands suppliedT)Ú_get_toplevel_optionsrvrr¨Úset_negative_aliasesrœZ set_aliasesÚgetoptrKZget_option_orderÚloggingZ getLoggerZsetLevelZWARNrÚhandle_display_optionsÚ_parse_command_optsr#Ú _show_helpÚlenr)rdZtoplevel_optionsrŸr¤Ú option_orderrrrÚparse_command_line¯s,    ÿzDistribution.parse_command_linecCs |jdgS)zÃReturn the non-display options recognized at the top level. This includes options that are recognized *only* at the top level as well as options recognized for commands. )zcommand-packages=Nz0list of packages that provide distutils commands)Úglobal_options©rdrrrr©òsÿz"Distribution._get_toplevel_optionsc Csddlm}|d}t |¡s*td|ƒ‚|j |¡z| |¡}Wn,typ}zt |ƒ‚WYd}~n d}~00t ||ƒsˆt d|ƒ‚t |dƒržt |jtƒs®d}t ||ƒ‚|j}t |dƒrÒ| ¡}| |j¡t |d ƒrôt |jtƒrôt|jƒ}ng}| |j|j|¡| |¡| |d d…¡\}} t | d ƒ�rX| j�rX|j|d|gd �dSt |d ƒ�rÎt |jtƒ�rÎd} |jD]F\} } } }t | | | ¡ƒ�r|d } t|ƒ�r°|ƒnt d || fƒ‚�q|| �rÎdS| |¡}t| ƒ ¡D]\}}d|f||<�qä|S)aÚParse the command-line options for a single command. 'parser' must be a FancyGetopt instance; 'args' must be the list of arguments, starting with the current command (whose options we are about to parse). Returns a new version of 'args' with the next command at the front of the list; will be the empty list if there are no more commands on the command line. Returns None if the user asked for help on this command. r©ÚCommandzinvalid command name '%s'Nz&command class %s must subclass CommandÚ user_optionszIcommand class %s must provide 'user_options' attribute (a list of tuples)rœÚ help_optionsrr#r§zYinvalid help function %r for help option '%s': must be a callable object (function, etc.)z command line) Ú distutils.cmdr¶Ú command_reÚmatchÚ SystemExitrvÚappendÚget_command_classrrÚ issubclassrr_rr·rrœÚcopyÚupdater¸Úfix_help_optionsÚset_option_tabler³rªr«r#r¯Z get_attr_nameÚcallablerYÚvarsrX)rdrŸr¤r¶rhZ cmd_classrrœr¸ZoptsZhelp_option_foundZ help_optionZshortZdescÚfuncrir%rrrrr®sr     ÿÿ þÿ    ÿ ÿ ÿ þÿ z Distribution._parse_command_optscCsPdD]F}t|j|ƒ}|durqt|tƒrdd„| d¡Dƒ}t|j||ƒqdS)z›Set final values for all the options on the Distribution instance, analogous to the .finalize_options() method of Command objects. ©r3r1NcSsg|] }| ¡‘qSr©Ústrip)r8Zelmrrrr:mr;z1Distribution.finalize_options..ú,)rGrErrrtrC)rdrfrrrrrccs  zDistribution.finalize_optionsrc Csddlm}ddlm}|rR|r*| ¡}n|j}| |¡| |jd¡t dƒ|rt| |j ¡| d¡t dƒ|j D]z}t |t ƒr˜t||ƒr˜|} n | |¡} t| dƒrÐt | jtƒrÐ| | jt| jƒ¡n | | j¡| d| j¡t dƒqzt ||jƒƒd S) abShow help for the setup script command-line in the form of several lists of command-line options. 'parser' should be a FancyGetopt instance; do not expect it to be returned in the same state, as its option table will be reset to make it generate the correct help text. If 'global_options' is true, lists the global options: --verbose, --dry-run, etc. If 'display_options' is true, lists the "display-only" options: --name, --version, etc. Finally, lists per-command help for every command name or command class in 'commands'. r©Ú gen_usagerµz Global options:r=zKInformation display options (just display information, ignore any commands)r¸zOptions for '%s' command:N)Údistutils.corerÌr¹r¶r©r³rÃÚ print_helpÚ common_usageÚprintr¨rvrrr¿r¾r_r¸rr·rÂrrJ) rdrŸr³r¨rvrÌr¶r>rhÚklassrrrr¯ps6     ÿ  ÿ  zDistribution._show_helpc CsÊddlm}|jr4| ¡tdƒt||jƒƒdSd}i}|jD]}d||d<qB|D]l\}}|rX| |¡rXt|ƒ}t |j d|ƒƒ}|dvr td  |¡ƒn |dvr¸td   |¡ƒnt|ƒd}qX|S) 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. rrËr=rr<rÇrÊ)r2r4r5r6r?) rÍrÌZ help_commandsÚprint_commandsrÐrJr¨rWr rGrEr) rdr±rÌZany_display_optionsZis_display_optionÚoptionrjrkrrrrr­¢s*   z#Distribution.handle_display_optionsc Csht|dƒ|D]R}|j |¡}|s.| |¡}z |j}WntyNd}Yn0td|||fƒqdS)zZPrint a subset of the list of all commands -- used by 'print_commands()'. ú:ú(no description available)z %-*s %sN)rÐrHrWr¾r0ÚAttributeError)rdrvruÚ max_lengthÚcmdrÑr0rrrÚprint_command_listÉs      zDistribution.print_command_listcCsžddl}|jj}i}|D] }d||<qg}|j ¡D]}| |¡s4| |¡q4d}||D]}t|ƒ|krZt|ƒ}qZ| |d|¡|ršt ƒ| |d|¡dS)anPrint out a help message listing all available commands with a description of each. The list is divided into "standard commands" (listed in distutils.command.__all__) and "extra commands" (mentioned in self.cmdclass, but not a standard command). The descriptions come from the command class attribute 'description'. rNrzStandard commandszExtra commands) Údistutils.commandrhÚ__all__rHrrrWr½r°rÙrÐ)rdr‚Ú std_commandsÚis_stdrØÚextra_commandsr×rrrrÒÚs"      zDistribution.print_commandsc Cs®ddl}|jj}i}|D] }d||<qg}|j ¡D]}| |¡s4| |¡q4g}||D]N}|j |¡}|sx| |¡}z |j}Wnt y˜d}Yn0| ||f¡qZ|S)a>Get a list of (command, description) tuples. The list is divided into "standard commands" (listed in distutils.command.__all__) and "extra commands" (mentioned in self.cmdclass, but not a standard command). The descriptions come from the command class attribute 'description'. rNrrÕ) rÚrhrÛrHrrrWr½r¾r0rÖ) rdr‚rÜrÝrØrÞÚrvrÑr0rrrÚget_command_listøs(          zDistribution.get_command_listcCsN|j}t|tƒsJ|durd}dd„| d¡Dƒ}d|vrD| dd¡||_|S)z9Return a list of packages from which commands are loaded.Nr=cSsg|]}|dkr| ¡‘qS)r=rÈ)r8Úpkgrrrr:!r;z5Distribution.get_command_packages..rÊzdistutils.commandr)rIrrrtÚinsert)rdZpkgsrrrÚget_command_packagess  z!Distribution.get_command_packagesc Cs´|j |¡}|r|S| ¡D]†}d ||¡}|}zt|ƒtj|}Wnty\YqYn0zt||ƒ}Wn$t y�t d|||fƒ‚Yn0||j|<|St d|ƒ‚dS)aoReturn the class that implements the Distutils command named by 'command'. First we check the 'cmdclass' dictionary; if the command is mentioned there, we fetch the class object from the dictionary and return it. Otherwise we load the command module ("distutils.command." + command) and fetch the command class from the module. The loaded class is also stored in 'cmdclass' to speed future calls to 'get_command_class()'. Raises DistutilsModuleError if the expected module could not be found, or if that module does not define the expected class. z{}.{}z3invalid command '%s' (no class '%s' in module '%s')zinvalid command '%s'N) rHrWrãrÚ __import__r\rˆÚ ImportErrorrGrÖr)rdrhrÑZpkgnameZ module_nameZ klass_nameÚmodulerrrr¾'s,      ÿÿ  zDistribution.get_command_classcCsl|j |¡}|sh|rhtr&| d|¡| |¡}||ƒ}|j|<d|j|<|j |¡}|rh| ||¡|S)aReturn the command object for 'command'. Normally this object is cached on a previous call to 'get_command_obj()'; if no command object for 'command' is in the cache, then we either create and return it (if 'create' is true) or return None. zrrrÚget_command_objNs ÿÿ    zDistribution.get_command_objc CsZ| ¡}|dur| |¡}tr,| d|¡| ¡D�]\}\}}trZ| d |||¡¡zdd„|jDƒ}Wnty„g}Yn0z |j}Wnty¦i}Yn0z|t |t ƒ} ||vrØ| rØt |||t |ƒ ƒnJ||vrö| röt ||t |ƒƒn,t ||ƒ�rt |||ƒntd|||fƒ‚Wq4t�yR} zt| ƒ‚WYd} ~ q4d} ~ 00q4dS)aySet 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'). Nz# setting options for '%s' command:z {} = {} (from {})cSsg|] }t|ƒ‘qSrr7)r8Úorrrr:~r;z5Distribution._set_command_options..z1error in %s: command '%s' has no such option '%s')Úget_command_namerYrrsrXrZboolean_optionsrÖrœrrrCr r_rr�) rdrUZ option_dictÚ command_namerÓÚsourcerZ bool_optsZneg_optZ is_stringrrrrrçks>           ÿÿz!Distribution._set_command_optionsrcCs|ddlm}t||ƒs&|}| |¡}n| ¡}|js8|S| ¡d|_d|j|<| |¡|rx|  ¡D]}|  ||¡qf|S)a³Reinitializes a command to the state it was in when first returned by 'get_command_obj()': ie., initialized but not yet finalized. This provides the opportunity to sneak option values in programmatically, overriding or supplementing user-supplied values from the config files and command line. You'll have to re-finalize the command object (by calling 'finalize_options()' or 'ensure_finalized()') before using it for real. 'command' should be a command name (string) or command object. If 'reinit_subcommands' is true, also reinitializes the command's sub-commands, as declared by the 'sub_commands' class attribute (if it has one). See the "install" command for an example. Only reinitializes the sub-commands that actually matter, ie. those whose test predicates return true. Returns the reinitialized command object. rrµ) r¹r¶rrérëZ finalizedZinitialize_optionsrVrçZget_sub_commandsÚreinitialize_command)rdrhZreinit_subcommandsr¶rìÚsubrrrrî–s      z!Distribution.reinitialize_commandcCst ||¡dS©Nr )rdrÚlevelrrrrsÀszDistribution.announcecCs|jD]}| |¡qdS)z¶Run each command that was seen on the setup script command line. Uses the list of commands found and cache of command objects created by 'get_command_obj()'. N)rvÚ run_command)rdrØrrrÚ run_commandsÃs zDistribution.run_commandscCsD|j |¡rdSt d|¡| |¡}| ¡| ¡d|j|<dS)aªDo whatever it takes to run a command (including nothing at all, if the command has already been run). Specifically: if we have already created and run the command named by 'command', return silently without doing anything. If the command named by 'command' doesn't even have a command object yet, create one. Then invoke 'run()' on that command object (or an existing one). Nz running %sr)rVrWrÚinforéZensure_finalizedÚrun)rdrhrèrrrròÍs   zDistribution.run_commandcCst|jp|jpgƒdkS©Nr)r°rMrNr´rrrÚhas_pure_modulesászDistribution.has_pure_modulescCs|jot|jƒdkSrö)rQr°r´rrrÚhas_ext_modulesäszDistribution.has_ext_modulescCs|jot|jƒdkSrö)rOr°r´rrrÚhas_c_librariesçszDistribution.has_c_librariescCs| ¡p| ¡Srð)r÷rør´rrrÚ has_modulesêszDistribution.has_modulescCs|jot|jƒdkSrö)rPr°r´rrrÚ has_headersíszDistribution.has_headerscCs|jot|jƒdkSrö)rRr°r´rrrÚ has_scriptsðszDistribution.has_scriptscCs|jot|jƒdkSrö)rSr°r´rrrÚhas_data_filesószDistribution.has_data_filescCs| ¡o| ¡ o| ¡ Srð)r÷rørùr´rrrÚis_pureös ÿýzDistribution.is_pure)N)NNr=)N)r)N)r)*rÚ __module__Ú __qualname__Ú__doc__r³rÏr¨rBrœrnrYrzr�r~r£r²r©r®rcr¯r­rÙrÒràrãr¾rérçrîr¬ÚINFOrsróròr÷rørùrúrûrürýrþrrrrr5sL    DCc 2'# '  + * rc@seZdZdZdZdBdd„Zdd„Zdd „Zd d „Zd d „Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd„Zd d!„Zd"d#„ZeZd$d%„Zd&d'„Zd(d)„Zd*d+„Zd,d-„Zd.d/„Zd0d1„Zd2d3„Zd4d5„Zd6d7„Zd8d9„Z d:d;„Z!dd?„Z#d@dA„Z$dS)CrDz]Dummy class to hold the distribution meta-data: name, version, author, and so forth. )r%r&r)Ú author_emailr+Úmaintainer_emailr-r.r0Úlong_descriptionr3r1r(r,Z contact_emailr2Ú download_urlr4r5r6NcCs‚|dur| t|ƒ¡nfd|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_d|_d|_dSrð)Ú read_pkg_fileÚopenr%r&r)rr+rr-r.r0rr3r1r2rr4r5r6)rdr|rrrrn"s&zDistributionMetadata.__init__cst|ƒ‰‡fdd„}‡fdd„}ˆd}|dƒ|_|dƒ|_|dƒ|_|d ƒ|_d |_|d ƒ|_d |_|d ƒ|_|d ƒ|_ dˆvrŽ|dƒ|_ nd |_ |dƒ|_ |dƒ|_dˆvrÀ|dƒ  d¡|_ |dƒ|_|dƒ|_|dkrü|dƒ|_|dƒ|_|dƒ|_nd |_d |_d |_d S)z-Reads the metadata values from a file object.csˆ|}|r|dkr|SdS©NZUNKNOWNr)r%r©rrrÚ _read_field=s z7DistributionMetadata.read_pkg_file.._read_fieldcsˆ |d¡}|gkrdS|Srð)Zget_all)r%Úvaluesr rrÚ _read_listBs z6DistributionMetadata.read_pkg_file.._read_listzmetadata-versionr%r&Zsummaryr)Nr*z home-pager.z download-urlr0r3rÊÚplatformZ classifierú1.1r5r4r6)rr%r&r0r)r+rrr-r.rrrtr3r1r2r5r4r6)rdÚfiler r Zmetadata_versionrr rr9s:                 z"DistributionMetadata.read_pkg_filecCsFttj |d¡ddd��}| |¡Wdƒn1s80YdS)z.Write the PKG-INFO file into the release tree.zPKG-INFOÚwzUTF-8)ÚencodingN)rr{r|rÚwrite_pkg_file)rdÚbase_dirZpkg_inforrrÚwrite_pkg_infols ÿz#DistributionMetadata.write_pkg_infocs>d}|js"|js"|js"|js"|jr&d}ˆ d|¡ˆ d| ¡¡ˆ d| ¡¡‡fdd„}|d| ¡ƒ|d |  ¡ƒ|d |  ¡ƒ|d |  ¡ƒ|d |  ¡ƒ|d |jƒ|dt | ¡pÆdƒƒ|dd | ¡¡ƒ| ˆd| ¡¡| ˆd| ¡¡| ˆd| ¡¡| ˆd| ¡¡| ˆd| ¡¡dS)z0Write the PKG-INFO format data to a file object.z1.0rzMetadata-Version: %s z Name: %s z Version: %s cs|rˆ |›d|›d�¡dS)Nz: r?)r^)rurk©rrrÚ maybe_write„sz8DistributionMetadata.write_pkg_file..maybe_writeZSummaryz Home-pageZAuthorz Author-emailZLicensez Download-URLZ Descriptionr=ZKeywordsrÊZPlatformZ ClassifierZRequiresZProvidesZ ObsoletesN)r4r5r6r2rr^Úget_nameÚ get_versionÚget_descriptionÚget_urlÚ get_contactÚget_contact_emailÚ get_licenser Úget_long_descriptionrÚ get_keywordsÚ _write_listÚ get_platformsÚget_classifiersÚ get_requiresÚ get_providesÚ get_obsoletes)rdrr&rrrrrss:ÿþýüû  z#DistributionMetadata.write_pkg_filecCs(|pg}|D]}| d ||¡¡q dS)Nz{}: {} )r^r)rdrr%r rrrrr!šsz DistributionMetadata._write_listcCs |jpdSr )r%r´rrrr¡szDistributionMetadata.get_namecCs |jpdS)Nz0.0.0)r&r´rrrr¤sz DistributionMetadata.get_versioncCsd | ¡| ¡¡S)Nz{}-{})rrrr´rrrÚ get_fullname§sz!DistributionMetadata.get_fullnamecCs|jSrð)r)r´rrrÚ get_authorªszDistributionMetadata.get_authorcCs|jSrð)rr´rrrÚget_author_email­sz%DistributionMetadata.get_author_emailcCs|jSrð)r+r´rrrÚget_maintainer°sz#DistributionMetadata.get_maintainercCs|jSrð)rr´rrrÚget_maintainer_email³sz)DistributionMetadata.get_maintainer_emailcCs |jp |jSrð)r+r)r´rrrr¶sz DistributionMetadata.get_contactcCs |jp |jSrð)rrr´rrrr¹sz&DistributionMetadata.get_contact_emailcCs|jSrð)r-r´rrrr¼szDistributionMetadata.get_urlcCs|jSrð)r.r´rrrr¿sz DistributionMetadata.get_licensecCs|jSrð)r0r´rrrrÄsz$DistributionMetadata.get_descriptioncCs|jSrð)rr´rrrrÇsz)DistributionMetadata.get_long_descriptioncCs |jpgSrð)r3r´rrrr Êsz!DistributionMetadata.get_keywordscCst|dƒ|_dS)Nr3)rr3©rdrrrrÚ set_keywordsÍsz!DistributionMetadata.set_keywordscCs|jSrð)r1r´rrrr"Ðsz"DistributionMetadata.get_platformscCst|dƒ|_dS)Nr1)rr1r,rrrÚ set_platformsÓsz"DistributionMetadata.set_platformscCs |jpgSrð)r2r´rrrr#Ösz$DistributionMetadata.get_classifierscCst|dƒ|_dS)Nr2)rr2r,rrrÚset_classifiersÙsz$DistributionMetadata.set_classifierscCs|jSrð)rr´rrrÚget_download_urlÜsz%DistributionMetadata.get_download_urlcCs |jpgSrð)r5r´rrrr$àsz!DistributionMetadata.get_requirescCs,ddl}|D]}|j |¡q t|ƒ|_dSrö)Údistutils.versionpredicateÚversionpredicateÚVersionPredicaterr5©rdrr‚rrrrÚ set_requiresãsz!DistributionMetadata.set_requirescCs |jpgSrð)r4r´rrrr%êsz!DistributionMetadata.get_providescCs6dd„|Dƒ}|D]}ddl}|j |¡q||_dS)NcSsg|] }| ¡‘qSrrÈ)r8rrrrr:îr;z5DistributionMetadata.set_provides..r)r1r2Zsplit_provisionr4)rdrrr‚rrrÚ set_providesís z!DistributionMetadata.set_providescCs |jpgSrð)r6r´rrrr&õsz"DistributionMetadata.get_obsoletescCs,ddl}|D]}|j |¡q t|ƒ|_dSrö)r1r2r3rr6r4rrrÚ set_obsoletesøsz"DistributionMetadata.set_obsoletes)N)%rrÿrrrFrnrrrr!rrr'r(r)r*r+rrrrZ get_licencerrr r-r"r.r#r/r0r$r5r%r6r&r7rrrrrDsD 3'rDcCs$g}|D]}| |dd…¡q|S)zConvert a 4-tuple 'help_options' list as found in various command classes to the 3-tuple form required by FancyGetopt. ré)r½)r>Z new_optionsZ help_tuplerrrrÂsrÂ)!rr\r{Úrer†rŒr¬ZemailrrZråÚerrorsrrrrZ fancy_getoptrr Úutilr r r Z_logrÚdebugrÚcompilerºrrrDrÂrrrrÚs:       W|