AlkantarClanX12

Your IP : 3.133.145.17


Current Path : /opt/alt/python34/lib64/python3.4/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/distutils/__pycache__/dist.cpython-34.pyo

�
i fz��@sdZddlZddlZddlZddlmZyddlZWnek
rddZYnXddlTddl	m
Z
mZddlm
Z
mZmZddlmZddlmZejd	�ZGd
d�d�ZGdd
�d
�Zdd�ZdS)z}distutils.dist

Provides the Distribution class, which represents the module distribution
being built/installed/distributed.
�N)�message_from_file)�*)�FancyGetopt�translate_longopt)�
check_environ�	strtobool�
rfc822_escape)�log)�DEBUGz^[a-zA-Z]([a-zA-Z0-9_]*)$c@s%eZdZdZd~dd�d�d�gZdZd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�gZd>d?�eD�Zidd6Zdd@dA�Z	dBdC�Z
dddDdEdF�ZdGdH�ZddIdJ�Z
dKdL�ZdMdN�ZdOdP�ZdQdR�ZddgdSdT�ZdUdV�ZdWdX�ZdYdZ�Zd[d\�Zd]d^�Zd_d`�Zddadb�Zddcdd�Zdedfdg�Zejdhdi�Zdjdk�Zdldm�Z dndo�Z!dpdq�Z"drds�Z#dtdu�Z$dvdw�Z%dxdy�Z&dzd{�Z'd|d}�Z(dS)��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�v�run verbosely (default)��quiet�q�!run quietly (turns verbosity off)�dry-run�n�don't actually do anything�help�h�show detailed help message�no-user-cfgN�-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
�
help-commands�list all available commands�name�print package name�version�V�print package version�fullname�print <package name>-<version>�author�print the author's name�author-email� print the author's email address�
maintainer�print the maintainer's name�maintainer-email�$print the maintainer's email address�contact�7print the maintainer's name if known, else the author's�
contact-email�@print the maintainer's email address if known, else the author's�url�print the URL for this package�license� print the license of the package�licence�alias for --license�description�print the package description�long-description�"print the long package description�	platforms�print the list of platforms�classifiers�print the list of classifiers�keywords�print the list of keywords�provides�+print the list of packages/modules provided�requires�+print the list of packages/modules required�	obsoletes�0print the list of packages/modules made obsoletecCs g|]}t|d��qS)r)r)�.0�x�rH�3/opt/alt/python34/lib64/python3.4/distutils/dist.py�
<listcomp>qs	zDistribution.<listcomp>cCsid|_d|_d|_x!|jD]}t||d�q%Wt�|_x:|jjD],}d|}t||t|j|��qXWi|_	d|_
d|_d|_i|_
g|_d|_i|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_i|_i|_|r|jd�}|dk	r�|d=xY|j�D]H\}}|j |�}x*|j�D]\}	}
d|
f||	<q�WqzWnd|kr#|d|d	<|d=d
}t!dk	rt!j"|�q#t#j$j%|d�nx�|j�D]�\}}
t&|jd|�rot|jd|�|
�q0t&|j|�r�t|j||
�q0t&||�r�t|||
�q0d
t'|�}t!dk	r�t!j"|�q0t#j$j%|d�q0Wnd|_(|jdk	r[x@|jD]2}
|
j)d�s;Pn|
dkr"d|_(Pq"q"Wn|j*�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 scriptr4r2z:'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_dataZpackage_dir�
py_modules�	libraries�headers�ext_modulesZext_packageZinclude_dirsZ
extra_path�scripts�
data_filesZpassword�command_obj�have_run�get�items�get_option_dict�warnings�warn�sys�stderr�write�hasattr�repr�
want_user_cfg�
startswith�finalize_options)�selfZattrs�attr�basenameZmethod_namerM�commandZcmd_options�opt_dict�opt�val�msg�key�argrHrHrI�__init__ys�			
 																							zDistribution.__init__cCs6|jj|�}|dkr2i}|j|<n|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)r[re)rrru�dictrHrHrIrgszDistribution.get_option_dictrLc	Csddlm}|dkr4t|jj��}n|dk	r^|j||�|d}n|sy|j|d�dSx�|D]�}|jj|�}|dkr�|j|d|�q�|j|d|�||�}x,|jd�D]}|j|d|�q�Wq�WdS)Nr)�pformatz  zno commands known yetzno option dict for '%s' commandzoption dict for '%s' command:rN)�pprintr~�sortedr[�keys�announcere�split)	rr�header�commands�indentr~Zcmd_namerv�out�linerHrHrI�dump_option_dicts%s&

		zDistribution.dump_option_dictscCsg}t�tjjtjdj�}tjj|d�}tjj|�r`|j	|�ntj
dkrxd}nd}|jr�tjjtjjd�|�}tjj|�r�|j	|�q�nd}tjj|�r�|j	|�nt
r|jdd	j|��n|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 three possible config files: distutils.cfg in the
        Distutils installation directory (ie. 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; and setup.cfg in the current directory.

        The file in the user's home directory can be disabled with the
        --no-user-cfg option.
        �	distutilsz
distutils.cfg�posixz.pydistutils.cfgzpydistutils.cfg�~z	setup.cfgzusing config files: %sz, )r�os�path�dirnamerj�modules�__file__�join�isfile�appendrro�
expanduserr
r�)rr�filesZsys_dirZsys_fileZ
user_filenameZ	user_fileZ
local_filerHrHrI�find_config_filesAs&		!zDistribution.find_config_filescCsTddlm}tjtjkrRddddddd	d
ddd
ddg
}ng}t|�}|dkr|j�}ntr�|jd�n|�}x�|D]�}tr�|jd|�n|j	|�x�|j
�D]�}|j|�}|j|�}x]|D]U}	|	dkr
|	|kr
|j
||	�}
|	jdd�}	||
f||	<q
q
Wq�W|j�q�Wd|jkrPx�|jdj�D]�\}	\}}
|jj
|	�}yY|r�t||t|
��n5|	dkrt||	t|
��nt||	|
�Wq�tk
rH}
zt|
��WYdd}
~
Xq�Xq�WndS)Nr)�ConfigParserzinstall-basezinstall-platbasezinstall-libzinstall-platlibzinstall-purelibzinstall-headerszinstall-scriptszinstall-data�prefixzexec-prefix�home�user�rootz"Distribution.parse_config_files():z  reading %s�__name__rO�_�globalrrP)zverbosezdry_run)Zconfigparserr�rjr��base_prefix�	frozensetr�r
r��readZsectionsrMrgre�replacer|r[rf�negative_optrRr�
ValueError�DistutilsOptionError)rr�	filenamesr�Zignore_options�parser�filenameZsectionrMrvrwrx�src�aliasryrHrHrI�parse_config_filesqsJ			


&zDistribution.parse_config_filescCs|j�}g|_t||j�}|j|j�|jidd6�|jd|jd|�}|j	�}t
j|j�|j
|�r�dSx,|r�|j||�}|dkr�dSq�W|jr�|j|dt|j�dkd|j�dS|jstd	��nd
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).
        r2r4�args�objectN�display_optionsrr�zno commands suppliedT)�_get_toplevel_optionsr�rr��set_negative_aliasesr�Zset_aliases�getoptrZZget_option_orderr	Z
set_verbosityr�handle_display_options�_parse_command_optsr�
_show_help�len�DistutilsArgError)rrZtoplevel_optionsr�r��option_orderrHrHrI�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.
        �command-packages=N�0list of packages that provide distutils commands)r�Nr�)�global_options)rrrHrHrIr��sz"Distribution._get_toplevel_optionscCs�ddlm}|d}tj|�s<td|��n|jj|�y|j|�}Wn1tk
r�}zt	|��WYdd}~XnXt
||�s�td|��nt|d�o�t
|jt�s�tdd|��n|j}t|d	�r$|j�}|j|j�nt|d
�rWt
|jt�rWt|j�}ng}|j|j|j|�|j|�|j|dd��\}}	t|	d�r�|	jr�|j|d
dd|g�dSt|d
�r}t
|jt�r}d}
xj|jD]_\}}}
}t|	|j|��r
d}
t|�rS|�qltd||f��q
q
W|
r}dSn|j|�}x0t|	�j�D]\}}d|f||<q�W|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_optionszcommand class %s must provide z+'user_options' attribute (a list of tuples)r��help_optionsrrr�r�zYinvalid help function %r for help option '%s': must be a callable object (function, etc.)zcommand line) �
distutils.cmdr��
command_re�match�
SystemExitr�r��get_command_class�DistutilsModuleErrorr��
issubclassZDistutilsClassErrorrm�
isinstancer��listr��copy�updater��fix_help_options�set_option_tabler�r�r�rr�Z
get_attr_name�callablerg�varsrf)rrr�r�r�ruZ	cmd_classryr�r�ZoptsZhelp_option_foundZhelp_optionZshortZdesc�funcrvr�valuerHrHrIr��sd


	


z Distribution._parse_command_optscCszxsdD]k}t|j|�}|dkr1qnt|t�rdd�|jd�D�}t|j||�qqWdS)z�Set final values for all the options on the Distribution
        instance, analogous to the .finalize_options() method of Command
        objects.
        r>r:NcSsg|]}|j��qSrH)�strip)rFZelmrHrHrIrJ_s	z1Distribution.finalize_options.<locals>.<listcomp>�,)zkeywordsz	platforms)rVrTr��strr�rR)rrrsr�rHrHrIrqUs
zDistribution.finalize_optionsc
Csvddlm}ddlm}|rr|r;|j�}n	|j}|j|�|j|jd�t	d�n|r�|j|j
�|jdd�t	d�nx�|jD]�}t|t
�r�t||�r�|}	n|j|�}	t|	d�r-t|	jt�r-|j|	jt|	j��n|j|	j�|jd	|	j�t	d�q�Wt	||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_usage)r�z
Global options:rLz*Information display options (just display z!information, ignore any commands)r�zOptions for '%s' command:N)�distutils.corer�r�r�r�r�r�Z
print_help�common_usage�printr�r�r��typer�r�rmr�r�r�r�r�rY)
rrr�r�r�r�r�r�rMru�klassrHrHrIr�bs6	


	zDistribution._show_helpc	Csddlm}|jrD|j�td�t||j��dSd}i}x|jD]}d||d<qZWx�|D]�\}}|ry|j|�ryt|�}t	|j
d|��}|dkr�tdj|��n,|dkrtd
j|��n
t|�d}qyqyW|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.
        r)r�rLrrKr>r:r�r<r@rBrDrN)zkeywordsz	platforms)zclassifierszprovideszrequiresz	obsoletes)r�r�Z
help_commands�print_commandsr�rYr�rerrVrTr�)	rrr�r�Zany_display_optionsZis_display_option�optionrwrxr�rHrHrIr��s,	

	

z#Distribution.handle_display_optionscCs�t|d�xw|D]o}|jj|�}|sE|j|�}ny
|j}Wntk
rld}YnXtd|||f�qWdS)zZPrint a subset of the list of all commands -- used by
        'print_commands()'.
        �:z(no description available)z
  %-*s  %sN)r�rWrer�r6�AttributeError)rrr�r��
max_length�cmdr�r6rHrHrI�print_command_list�s


zDistribution.print_command_listcCs�ddl}|jj}i}x|D]}d||<q%Wg}x6|jj�D]%}|j|�sO|j|�qOqOWd}x3||D]'}t|�|kr�t|�}q�q�W|j|d|�|r�t	�|j|d|�ndS)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.commandru�__all__rWr�rer�r�r�r�)rrr��std_commands�is_stdr��extra_commandsr�rHrHrIr��s*
		zDistribution.print_commandsc	Cs�ddl}|jj}i}x|D]}d||<q%Wg}x6|jj�D]%}|j|�sO|j|�qOqOWg}xw||D]k}|jj|�}|s�|j|�}ny
|j}Wnt	k
r�d}YnX|j||f�q�W|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'.
        rNrz(no description available))
r�rur�rWr�rer�r�r6r�)	rrr�r�r�r�r��rvr�r6rHrHrI�get_command_list�s(	


zDistribution.get_command_listcCsx|j}t|t�st|dkr-d}ndd�|jd�D�}d|krh|jdd�n||_n|S)z9Return a list of packages from which commands are loaded.NrLcSs(g|]}|dkr|j��qS)rL)r�)rFZpkgrHrHrIrJs	z5Distribution.get_command_packages.<locals>.<listcomp>r�zdistutils.commandr)rXr�r�r��insert)rrZpkgsrHrHrI�get_command_packagess		z!Distribution.get_command_packagescCs�|jj|�}|r|Sx�|j�D]�}d||f}|}yt|�tj|}Wntk
rww)YnXyt||�}Wn+tk
r�t	d|||f��YnX||j|<|SWt	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%s.%sz3invalid command '%s' (no class '%s' in module '%s')zinvalid command '%s'N)
rWrer��
__import__rjr��ImportErrorrVr�r�)rrrur�ZpkgnameZmodule_nameZ
klass_name�modulerHrHrIr�s(



zDistribution.get_command_classcCs�|jj|�}|r�|r�tr9|jd|�n|j|�}||�}|j|<d|j|<|jj|�}|r�|j||�q�n|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.
        z<Distribution.get_command_obj(): creating '%s' command objectr)rcrer
r�r�rdr[�_set_command_options)rrru�create�cmd_objr�rMrHrHrI�get_command_objBs
	
zDistribution.get_command_objc!Cs�|j�}|dkr*|j|�}ntrD|jd|�nx}|j�D]o\}\}}tr�|jd|||f�nydd�|jD�}Wntk
r�g}YnXy
|j}Wntk
r�i}YnXy�t|t	�}	||kr%|	r%t
|||t|��nf||krP|	rPt
||t|��n;t||�rrt
|||�nt
d|||f��WqQtk
r�}
zt
|
��WYdd}
~
XqQXqQWdS)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    %s = %s (from %s)cSsg|]}t|��qSrH)r)rF�orHrHrIrJqs	z5Distribution._set_command_options.<locals>.<listcomp>z1error in %s: command '%s' has no such option '%s')�get_command_namergr
r�rfZboolean_optionsr�r�r�r�rRrrmr�r�)rrrcZoption_dict�command_namer��sourcer�Z	bool_optsZneg_optZ	is_stringryrHrHrIr�]s>		


z!Distribution._set_command_optionsrcCs�ddlm}t||�s7|}|j|�}n|j�}|jsP|S|j�d|_d|j|<|j|�|r�x'|j	�D]}|j
||�q�Wn|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.
        r)r�)r�r�r�r�r�Z	finalizedZinitialize_optionsrdr�Zget_sub_commands�reinitialize_command)rrruZreinit_subcommandsr�r��subrHrHrIr��s	
	

z!Distribution.reinitialize_commandcCstj||�dS)N)r	)rrry�levelrHrHrIr��szDistribution.announcecCs%x|jD]}|j|�q
WdS)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)r��run_command)rrr�rHrHrI�run_commands�szDistribution.run_commandscCsZ|jj|�rdStjd|�|j|�}|j�|j�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)rdrer	�infor�Zensure_finalizedZrun)rrrur�rHrHrIr��s	

zDistribution.run_commandcCs"t|jp|jpg�dkS)Nr)r�r\r])rrrHrHrI�has_pure_modules�szDistribution.has_pure_modulescCs|jot|j�dkS)Nr)r`r�)rrrHrHrI�has_ext_modules�szDistribution.has_ext_modulescCs|jot|j�dkS)Nr)r^r�)rrrHrHrI�has_c_libraries�szDistribution.has_c_librariescCs|j�p|j�S)N)r�r�)rrrHrHrI�has_modules�szDistribution.has_modulescCs|jot|j�dkS)Nr)r_r�)rrrHrHrI�has_headers�szDistribution.has_headerscCs|jot|j�dkS)Nr)rar�)rrrHrHrI�has_scripts�szDistribution.has_scriptscCs|jot|j�dkS)Nr)rbr�)rrrHrHrI�has_data_files�szDistribution.has_data_filescCs$|j�o#|j�o#|j�S)N)r�r�r�)rrrHrHrI�is_pure�s
zDistribution.is_pure)zverboser
rr)zquietrr)rrr)zhelprr)rNr)rNr)znameNr)zversionr r!)zfullnameNr#)zauthorNr%)r&Nr')z
maintainerNr))r*Nr+)r,Nr-)r.Nr/)zurlNr1)zlicenseNr3)zlicenceNr5)zdescriptionNr7)r8Nr9)z	platformsNr;)zclassifiersNr=)zkeywordsNr?)zprovidesNrA)zrequiresNrC)z	obsoletesNrE))r��
__module__�__qualname__�__doc__r�r�r�rQr�r|rgr�r�r�r�r�r�rqr�r�r�r�r�r�r�r�r�r�r	�INFOr�r�r�r�r�r�r�r�rrrrHrHrHrIrs�	
	
�0:C\
1(!"&,)
rc@sueZdZdZdOZddd�Zdd�Zdd�Zdd�Zdd �Z	d!d"�Z
d#d$�Zd%d&�Zd'd(�Z
d)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�ZeZd7d8�Zd9d:�Zd;d<�Zd=d>�Zd?d@�ZdAdB�ZdCdD�ZdEdF�ZdGdH�ZdIdJ�ZdKdL�Z dMdN�Z!dS)PrSz]Dummy class to hold the distribution meta-data: name, version,
    author, and so forth.
    rrr$�author_emailr(�maintainer_emailr0r2r6�long_descriptionr>r:r"r,�
contact_emailr<�download_urlr@rBrDNcCs�|dk	r"|jt|��n�d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
d|_d|_d|_d|_d|_dS)N)�
read_pkg_file�openrrr$rr(rr0r2r6r	r>r:r<rr@rBrD)rrr�rHrHrIr|s&																zDistributionMetadata.__init__cs�t|���fdd�}�fdd�}�d}|d�|_|d�|_|d�|_|d	�|_d
|_|d�|_d
|_|d�|_|d
�|_	d�kr�|d�|_
n	d
|_
|d�|_|d�|_d�kr!|d�jd�|_
n|d�|_|d�|_|dkr{|d�|_|d�|_|d�|_nd
|_d
|_d
|_d
S)z-Reads the metadata values from a file object.cs�|}|dkrdS|S)N�UNKNOWNrH)rr�)ryrHrI�_read_fields
z7DistributionMetadata.read_pkg_file.<locals>._read_fieldcs&�j|d�}|gkr"dS|S)N)Zget_all)r�values)ryrHrI�
_read_list%sz6DistributionMetadata.read_pkg_file.<locals>._read_listzmetadata-versionrrZsummaryr$Nzauthor-emailz	home-pager2zdownload-urlr6r>r��platformZ
classifierz1.1rBr@rD)rrrr6r$r(rrr0r2rr	r�r>r:r<rBr@rD)rr�filerrZmetadata_versionrH)ryrIrs:
					z"DistributionMetadata.read_pkg_filec	Cs>ttjj|d�ddd��}|j|�WdQXdS)z7Write the PKG-INFO file into the release tree.
        zPKG-INFO�w�encodingzUTF-8N)r
r�r�r��write_pkg_file)rrZbase_dirZpkg_inforHrHrI�write_pkg_infoOsz#DistributionMetadata.write_pkg_infocCs�d}|js3|js3|js3|js3|jr<d}n|jd|�|jd|j��|jd|j��|jd|j��|jd|j	��|jd|j
��|jd	|j��|jd
|j��|jr|jd|j�nt
|j��}|jd|�d
j|j��}|r`|jd|�n|j|d|j��|j|d|j��|j|d|j��|j|d|j��|j|d|j��dS)z9Write the PKG-INFO format data to a file object.
        z1.0z1.1zMetadata-Version: %s
z	Name: %s
zVersion: %s
zSummary: %s
zHome-page: %s
zAuthor: %s
zAuthor-email: %s
zLicense: %s
zDownload-URL: %s
zDescription: %s
r�z
Keywords: %s
ZPlatformZ
ClassifierZRequiresZProvidesZ	ObsoletesN)r@rBrDr<rrl�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)rrrrZ	long_descr>rHrHrIrVs0		z#DistributionMetadata.write_pkg_filecCs,x%|D]}|jd||f�qWdS)Nz%s: %s
)rl)rrrrrr�rHrHrIr!xs
z DistributionMetadata._write_listcCs
|jpdS)Nr)r)rrrHrHrIr~szDistributionMetadata.get_namecCs
|jpdS)Nz0.0.0)r)rrrHrHrIr�sz DistributionMetadata.get_versioncCsd|j�|j�fS)Nz%s-%s)rr)rrrHrHrI�get_fullname�sz!DistributionMetadata.get_fullnamecCs
|jpdS)Nr)r$)rrrHrHrI�
get_author�szDistributionMetadata.get_authorcCs
|jpdS)Nr)r)rrrHrHrI�get_author_email�sz%DistributionMetadata.get_author_emailcCs
|jpdS)Nr)r()rrrHrHrI�get_maintainer�sz#DistributionMetadata.get_maintainercCs
|jpdS)Nr)r)rrrHrHrI�get_maintainer_email�sz)DistributionMetadata.get_maintainer_emailcCs|jp|jpdS)Nr)r(r$)rrrHrHrIr�sz DistributionMetadata.get_contactcCs|jp|jpdS)Nr)rr)rrrHrHrIr�sz&DistributionMetadata.get_contact_emailcCs
|jpdS)Nr)r0)rrrHrHrIr�szDistributionMetadata.get_urlcCs
|jpdS)Nr)r2)rrrHrHrIr�sz DistributionMetadata.get_licensecCs
|jpdS)Nr)r6)rrrHrHrIr�sz$DistributionMetadata.get_descriptioncCs
|jpdS)Nr)r	)rrrHrHrIr�sz)DistributionMetadata.get_long_descriptioncCs
|jpgS)N)r>)rrrHrHrIr �sz!DistributionMetadata.get_keywordscCs|jpdgS)Nr)r:)rrrHrHrIr"�sz"DistributionMetadata.get_platformscCs
|jpgS)N)r<)rrrHrHrIr#�sz$DistributionMetadata.get_classifierscCs
|jpdS)Nr)r)rrrHrHrI�get_download_url�sz%DistributionMetadata.get_download_urlcCs
|jpgS)N)rB)rrrHrHrIr$�sz!DistributionMetadata.get_requirescCs:ddl}x|D]}|jj|�qW||_dS)Nr)�distutils.versionpredicate�versionpredicate�VersionPredicaterB)rrr�r�r
rHrHrI�set_requires�s
z!DistributionMetadata.set_requirescCs
|jpgS)N)r@)rrrHrHrIr%�sz!DistributionMetadata.get_providescCsMdd�|D�}x*|D]"}ddl}|jj|�qW||_dS)NcSsg|]}|j��qSrH)r�)rFr
rHrHrIrJ�s	z5DistributionMetadata.set_provides.<locals>.<listcomp>r)r-r.Zsplit_provisionr@)rrr�r
r�rHrHrI�set_provides�s

z!DistributionMetadata.set_providescCs
|jpgS)N)rD)rrrHrHrIr&�sz"DistributionMetadata.get_obsoletescCs:ddl}x|D]}|jj|�qW||_dS)Nr)r-r.r/rD)rrr�r�r
rHrHrI�
set_obsoletes�s
z"DistributionMetadata.set_obsoletes)znamezversionzauthorzauthor_emailz
maintainerzmaintainer_emailzurl�licensezdescriptionzlong_descriptionzkeywordsz	platformszfullnamezcontactr
r3zclassifierszdownload_urlzprovideszrequiresz	obsoletes)"r�rrrrUr|rrrr!rrr'r(r)r*r+rrrrZget_licencerrr r"r#r,r$r0r%r1r&r2rHrHrHrIrS�sJ4"rScCs2g}x%|D]}|j|dd��q
W|S)zConvert a 4-tuple 'help_options' list as found in various command
    classes to the 3-tuple form required by FancyGetopt.
    r�)r�)rMZnew_optionsZ
help_tuplerHrHrIr��s
r�)rrjr��reZemailrrhr�Zdistutils.errorsZdistutils.fancy_getoptrrZdistutils.utilrrrr�r	Zdistutils.debugr
�compiler�rrSr�rHrHrHrI�<module>s$$

�����