
    09oe
                        d Z ddlZddlZddlZddlZddlZddlmZ 	 ddlZn# e	$ r dZY nw xY wddl
mZmZmZmZ ddlmZmZ ddlmZmZmZ ddlmZ ddlmZ  ej        d	          Zd
 Z G d d          Z G d d          Zd ZdS )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_]*)$c                    t          | t                    rnrt          | t                    s]t          |           j        }d} |j        di t                      }t          j        t          j        |           t          |           } | S )Nz>Warning: '{fieldname}' should be a list, got type '{typename}' )	
isinstancestrlisttype__name__formatlocalsr   WARN)value	fieldnametypenamemsgs       SD:\Python Project\StaffProfile\venv\Lib\site-packages\setuptools/_distutils/dist.py_ensure_listr   %   s}    % 
 	t$$ ;;'Ncj$$688$$#UL    c                   "   e Zd ZdZg dZdZg dZd eD             ZddiZd+d	Z	d
 Z
d,dZd Zd Zd+dZd Zd Zd Zd Zddg fdZd Zd Zd Zd Zd Zd Zd-dZd+dZd.dZej        fd Zd! Z d" Z!d# Z"d$ Z#d% Z$d& Z%d' Z&d( Z'd) Z(d* Z)dS )/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vzrun verbosely (default)   )quietqz!run quietly (turns verbosity off))zdry-runnzdon't actually do anything)helphzshow detailed help message)zno-user-cfgNz-ignore pydistutils.cfg in your home directoryzCommon commands: (see '--help-commands' for more)

  setup.py build      will build the package underneath 'build/'
  setup.py install    will install the package
))zhelp-commandsNzlist all available commands)nameNzprint package name)versionVzprint package version)fullnameNzprint <package name>-<version>)authorNzprint the author's name)author-emailNz print the author's email address)
maintainerNzprint the maintainer's name)zmaintainer-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)urlNzprint the URL for this package)licenseNz print the license of the package)licenceNzalias for --license)descriptionNzprint the package description)zlong-descriptionNz"print the long package description)	platformsNzprint the list of platforms)classifiersNzprint the list of classifiers)keywordsNzprint 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 obsoletec                 8    g | ]}t          |d                    S r   r	   ).0xs     r   
<listcomp>zDistribution.<listcomp>w   s%    MMM-ad33MMMr    r&   r#   Nc           	         d| _         d| _        d| _        | j        D ]}t	          | |d           t                      | _        | j        j        D ]+}d|z   }t	          | |t          | j        |                     ,i | _	        d| _
        d| _        d| _        i | _        g | _        d| _        i | _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        i | _        i | _        |r|                    d          }|S|d= |                                D ];\  }}|                      |          }|                                D ]\  }	}
d|
f||	<   <d|v rN|d         |d	<   |d= d
}tB          tC          j"        |           n"tF          j$        %                    |dz              |                                D ]\  }}
tM          | j        d|z             r" t          | j        d|z             |
           ?tM          | j        |          rt	          | j        ||
           ktM          | |          rt	          | ||
           dtO          |          z  }tC          j"        |           d| _(        | j        0| j        D ](}|)                    d          s n|dk    r	d| _(         n)| *                                 dS )a0  Construct 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()'.
        r%   r   get_N optionszsetup scriptr5   r4   z:'licence' distribution option is deprecated; use 'license'
set_zUnknown 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_options
dist_filespackagespackage_datapackage_dir
py_modules	librariesheadersext_modulesext_packageinclude_dirs
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basenamemethod_namerF   commandcmd_optionsopt_dictoptvalr   keyargs                 r   __init__zDistribution.__init__~   si    	- 	# 	#DD$"""" -..7 	L 	LH 8+KD+wt}k'J'JKKKK  !%
    " 
      !	'
 ii	**G")$.5mmoo > >*Wk#33G<<H&1&7&7&9&9 > >
c)7(=> E!!#(#3i )$R'M#&&&&J$$S4Z000 $kkmm 	' 	'
c4=&3,77 '8GDM6C<88====T]C00 'DM34444T3'' 'D#s++++;d3iiGCM#&&&& "''  ~~c** E/))).D&E * 	r    c                 V    | j                             |          }|i x}| j         |<   |S )zGet 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.
        )rU   rf   )rs   rx   dicts      r   rh   zDistribution.get_option_dict  s6     #''00<355D4'0r    rE   c                    ddl m} |&t          | j                                                  }||                     ||z              |dz   }|s|                     |dz              d S |D ]}| j                            |          }||                     |d|z  z              :|                     |d|z  z               ||          }|                    d          D ]}|                     |dz   |z              d S )Nr   )pformatz  zno commands known yetzno option dict for '%s' commandzoption dict for '%s' command:rG   )pprintr   sortedrU   keysannouncerf   split)	rs   headercommandsindentr   cmd_namerz   outlines	            r   dump_option_dictszDistribution.dump_option_dicts'  s=   """"""d27799::HMM&6/***d]F 	MM&#::;;;F  	8 	8H+//99Hf'H8'SSTTTTf'F'QQRRRgh''IIdOO 8 8DMM&4-$"677778	8 	8r    c                     t                       d |                                 D             }t          r+|                     dd                    |          z             |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
        c                 j    g | ]0}t           j                            |          !t          |          1S r   )ospathisfiler   )r@   r   s     r   rB   z2Distribution.find_config_files.<locals>.<listcomp>Q  s1    QQQtBGNN4<P<PQTQQQr    zusing config files: %sz, )r
   
_gen_pathsr   r   join)rs   filess     r   find_config_fileszDistribution.find_config_filesA  s\     	QQt'8'8QQQ 	GMM2TYYu5E5EEFFFr    c              #     K   t          j        t          j        d         j                  j        }|dz  V  dt          j        dk    z  }|dz   }| j        r+t          j        d          	                                |z  V  t          j        d          V  t          j        t                    5  t          j        t          j        d                    V  d d d            d S # 1 swxY w Y   d S )	N	distutilszdistutils.cfg.posixzpydistutils.cfg~z	setup.cfgDIST_EXTRA_CONFIG)pathlibPathrk   modules__file__parentr   r+   rp   
expanduser
contextlibsuppress	TypeErrorgetenv)rs   sys_dirprefixfilenames       r   r   zDistribution._gen_pathsX  s3     ,s{;7@AAH'''' 7*+-- 	<,s##..008;;;; l;'''''  ++ 	? 	?,ry)<==>>>>>	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	?s   1)C''C+.C+c                    ddl m} t          j        t          j        k    rg d}ng }t          |          }||                                 }t          r|                     d            |            }|D ]}t          r|                     d|z             |	                    |           |
                                D ]n}|                    |          }|                     |          }|D ]?}	|	dk    r7|	|vr3|                    ||	          }
|	                    dd          }	||
f||	<   @o|                                 d	| j        v r| j        d	                                         D ]\  }	\  }}
| j                            |	          }	 |r t'          | |t)          |
                      n4|	d
v rt'          | |	t)          |
                     nt'          | |	|
           z# t*          $ r}t-          |          d }~ww xY wd S d S )Nr   )ConfigParser)zinstall-basezinstall-platbasezinstall-libzinstall-platlibzinstall-purelibzinstall-headerszinstall-scriptszinstall-datar   zexec-prefixhomeuserrootz"Distribution.parse_config_files():z  reading %sr   rI   _global)r#   rJ   )configparserr   rk   r   base_prefix	frozensetr   r   r   readsectionsrF   rh   rf   replacer   rU   rg   negative_optrL   r   
ValueErrorr   )rs   	filenamesr   ignore_optionsparserr   sectionrF   rz   r{   r|   srcaliasr   s                 r   parse_config_fileszDistribution.parse_config_filesj  so   ------ :((  NN   N">22..00I 	@MM>???! 	 	H 9nx7888KK!!!!??,, 8 8 ..11//88" 8 8Cj((S-F-F$jj#66!kk#s33)13	8 OO
 t+++%)%9(%C%I%I%K%K 
4 
4!jsC)--c224 0e3-?@@@@ 666c9S>>::::c3///! 4 4 4.s3334 ,+
4 
4s   AG%%
H/G>>Hc                 l   |                                  }g | _        t          || j        z             }|                    | j                   |                    ddi           |                    | j        |           }|	                                }t          j        | j                   |                     |          rdS |r|                     ||          }|dS || j        r5|                     |t#          | j                  dk    | j                   dS | j        st%          d          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).
        r5   r4   )argsobjectNr   display_optionsr   zno commands suppliedT)_get_toplevel_optionsr   r   r   set_negative_aliasesr   set_aliasesgetoptrT   get_option_orderr   set_verbosityr#   handle_display_options_parse_command_optsr)   
_show_helplenr   )rs   toplevel_optionsr   r   option_orders        r   parse_command_linezDistribution.parse_command_line  sW   .  5577 -0DDEE##D$5666Iy1222}}$"24}@@..00$,''' &&|44 	F 	++FD99D|  	 9 	OODM(:(:a(?$-     F } 	<#$:;;; tr    c                     | j         dgz   S )zReturn 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.
        )zcommand-packages=Nz0list of packages that provide distutils commands)global_optionsrs   s    r   r   z"Distribution._get_toplevel_options  s     "&
 
 	
r    c                    ddl m} |d         }t                              |          st	          d|z            | j                            |           	 |                     |          }n!# t          $ r}t          |          d}~ww xY wt          ||          st          d|z            t          |d          rt          |j        t                    sd}t          ||z            | j        }t          |d          r.|                                }|                    |j                   t          |d	          r/t          |j        t                    rt)          |j                  }ng }|                    | j        |j        z   |z              |                    |           |                    |d
d                   \  }}	t          |	d          r"|	j        r|                     |d|g           dS t          |d	          rt          |j        t                    rjd}
|j        D ]\\  }}}}t          |	|                    |                    r2d
}
t9          |          r |             Ft          d|d|d          ]|
rdS |                     |          }t=          |	                                          D ]\  }}d|f||<   |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   Commandzinvalid 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_optionsr%   r)   r   zinvalid help function z for help option 'z-': must be a callable object (function, etc.)zcommand line) distutils.cmdr   
command_rematch
SystemExitr   appendget_command_classr   r   
issubclassr   rn   r   r   r   r   copyupdater   fix_help_optionsset_option_tabler   r   r   r)   r   get_attr_namecallablerh   varsrg   )rs   r   r   r   rx   	cmd_classr   r   r   optshelp_option_foundhelp_optionshortdescfuncrz   r+   r   s                     r   r   z Distribution._parse_command_opts  s]    	*))))) q'(( 	D87BCCCW%%%
	)..w77II# 	) 	) 	)#C(((	)
 )W-- 	%89D   I~..	791488	7
>  &cIo666 (9n-- 	8',,..L	 6777 9n-- 	*"D3
 3
 	 ,I,BCCLLL 	)"88<G	
 	
 	
 	##L111}}T!""X..t4   	TY 	OOFAOLLLF9n-- 	*"D3
 3
 	 !"4=4J 
 
0eT44!5!5k!B!BCC 	()%~~ 11  $tt[[[2  	 !  ''00!$ZZ--// 	5 	5MT5,e4HTNNs   A, ,
B
6BB
c                     dD ]d}t          | j        |          }|t          |t                    r5d |                    d          D             }t          | j        ||           edS )zSet final values for all the options on the Distribution
        instance, analogous to the .finalize_options() method of Command
        objects.
        r9   r7   Nc                 6    g | ]}|                                 S r   strip)r@   elms     r   rB   z1Distribution.finalize_options.<locals>.<listcomp>l  s     AAAAAAr    ,)rP   rN   r   r   r   rL   )rs   ru   r   s      r   rr   zDistribution.finalize_optionsb  s|    
 . 	4 	4DDM400E}%%% 4AAC0@0@AAAtU333	4 	4r    r%   c                 h   ddl m} ddlm} |r_|r|                                 }n| j        }|                    |           |                    | j        dz              t          d           |r>|                    | j
                   |                    d           t          d           | j        D ]}t          |t                    rt          ||          r|}	n|                     |          }	t!          |	d          rJt          |	j        t$                    r0|                    |	j        t)          |	j                  z              n|                    |	j                   |                    d|	j        z             t          d           t           || j                             d	S )
ab  Show 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:rE   zKInformation display options (just display information, ignore any commands)r   zOptions for '%s' command:N)distutils.corer   r   r   r   r   r   
print_helpcommon_usageprintr   r   r   r   r   r   rn   r   r   r   r   r   rS   )
rs   r   r   r   r   r   r   rF   rx   klasss
             r   r   zDistribution._show_helpo  s    	-,,,,,)))))) 	 .4466-##G,,,d/2EEFFF"III 	##D$89996   "III} 	 	G'4(( 8Z-I-I 8..w77un-- <*U=OQU2V2V <''&)9%:L)M)MM    ''(:;;;9ENJKKK"IIIIii())*****r    c                 0   ddl m} | j        rB|                                  t	          d           t	           || j                             dS d}i }| j        D ]}d||d         <   |D ]\  }}|r|                    |          rt          |          } t          | j
        d|z                         }|dv r#t	          d                    |                     n6|dv r#t	          d	                    |                     nt	          |           d}|S )
zIf 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   rE   r%   rD   r   r   )r8   r:   r;   r<   rG   )r   r   help_commandsprint_commandsr   rS   r   rf   r	   rP   rN   r   )	rs   r   r   any_display_optionsis_display_optionoptionr{   r|   r   s	            r   r   z#Distribution.handle_display_options  sU    	-,,,,,
  	!!!"III))D,--...1
  * 	- 	-F+,fQi((& 
	( 
	(JS# 	((,,S11 	(',,<v|<<>>333#((5//****PPP$))E**++++%LLL&'#""r    c                     t          |dz              |D ]c}| j                            |          }|s|                     |          }	 |j        }n# t
          $ r d}Y nw xY wt          d|||fz             ddS )zZPrint a subset of the list of all commands -- used by
        'print_commands()'.
        :(no description available)z
  %-*s  %sN)r   rQ   rf   r   r6   AttributeError)rs   r   r   
max_lengthcmdr   r6   s          r   print_command_listzDistribution.print_command_list  s     	fsl 		A 		ACM%%c**E 4..s33;#/! ; ; ;:; ,*c;!??@@@@		A 		As   	AA A c                    ddl }|j        j        }i }|D ]}d||<   g }| j                                        D ],}|                    |          s|                    |           -d}||z   D ]$}t          |          |k    rt          |          }%|                     |d|           |r't                       |                     |d|           dS dS )an  Print 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'.
        r   Nr%   zStandard commandszExtra commands)
distutils.commandrx   __all__rQ   r   rf   r   r   r  r   )rs   r   std_commandsis_stdr  extra_commandsr
  s          r   r  zDistribution.print_commands  s    	!    (0 	 	CF3KK=%%'' 	+ 	+C::c?? +%%c***
.0 	& 	&C3xx*$$ XX
.A:NNN 	RGGG##N4DjQQQQQ	R 	Rr    c                    ddl }|j        j        }i }|D ]}d||<   g }| j                                        D ],}|                    |          s|                    |           -g }||z   D ]e}| j                            |          }|s|                     |          }	 |j        }n# t          $ r d}Y nw xY w|                    ||f           f|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'.
        r   Nr%   r  )
r  rx   r  rQ   r   rf   r   r   r6   r	  )	rs   r   r  r  r  r  rvr   r6   s	            r   get_command_listzDistribution.get_command_list  s    	!    (0 	 	CF3KK=%%'' 	+ 	+C::c?? +%%c***.0 	* 	*CM%%c**E 4..s33;#/! ; ; ;:;IIsK())))	s    B((B76B7c                     | j         }t          |t                    sD|d}d |                    d          D             }d|vr|                    dd           || _         |S )z9Return a list of packages from which commands are loaded.NrE   c                 B    g | ]}|d k    |                                 S )rE   r   )r@   pkgs     r   rB   z5Distribution.get_command_packages.<locals>.<listcomp>   s%    HHHCcRiiCIIKKiiir    r   zdistutils.commandr   )rR   r   r   r   insert)rs   pkgss     r   get_command_packagesz!Distribution.get_command_packages  sp    $$%% 	)|HH4::c??HHHD"$..A2333$(D!r    c                    | j                             |          }|r|S |                                 D ]}d                    ||          }|}	 t	          |           t
          j        |         }n# t          $ r Y Iw xY w	 t          ||          }n'# t          $ r t          d|d|d|d          w xY w|| j         |<   |c S t          d|z            )ao  Return 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{}.{}zinvalid command 'z' (no class 'z' in module 'z')zinvalid command '%s')rQ   rf   r  r   
__import__rk   r   ImportErrorrP   r	  r   )rs   rx   r   pkgnamemodule_name
klass_namemodules          r   r   zDistribution.get_command_class&  s#    !!'** 	L0022 	 	G!..'::K J;'''[1   
33!   **ww


KKK9   &+DM'"LLL"#9G#CDDDs   !A00
A=<A=B$B6c                 L   | j                             |          }|s|rt          r|                     d|z             |                     |          } ||           x}| j         |<   d| j        |<   | j                            |          }|r|                     ||           |S )a  Return 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   )rd   rf   r   r   r   re   rU   _set_command_options)rs   rx   createcmd_objr   rF   s         r   get_command_objzDistribution.get_command_objM  s     "&&w// 	<6 	< 35<=  
 **733E27%++=Gd&w/%&DM'" *..w77G <))'7;;;r    c           
      @   |                                 }||                     |          }t          r|                     d|z             |                                D ]=\  }\  }}t          r*|                     d                    |||                     	 d |j        D             }n# t          $ r g }Y nw xY w	 |j        }n# t          $ r i }Y nw xY w	 t          |t                    }	||v r(|	r&t          |||         t          |                      n`||v r!|	rt          ||t          |                     n;t          ||          rt          |||           nt          d|d|d|d          # t          $ r}
t          |
          d}
~
ww xY wdS )	ay  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').
        Nz#  setting options for '%s' command:z    {} = {} (from {})c                 ,    g | ]}t          |          S r   r?   )r@   os     r   rB   z5Distribution._set_command_options.<locals>.<listcomp>}  s!    WWWa.q11WWWr    z	error in z: command 'z' has no such option '')get_command_namerh   r   r   rg   r   boolean_optionsr	  r   r   r   rL   r   rn   r   r   )rs   rd   option_dictcommand_namer  sourcer   	bool_optsneg_opt	is_stringr   s              r   r$  z!Distribution._set_command_optionsj  s    #3355..|<<K 	PMM?,NOOO)4):):)<)< 	0 	0%V_fe U5<<VUFSSTTTWW;;VWWW		!   			%2!   0&uc22	W$$$Ki>N>N:NOOOOy((Y(K51A1ABBBB[&11 K7777..!66<<<9    0 0 0*3///03	0 	0s=   B,,B;:B;?CCCB!E==
FFFr   c                 n   ddl m} t          ||          s|}|                     |          }n|                                }|j        s|S |                                 d|_        d| j        |<   |                     |           |r-|	                                D ]}| 
                    ||           |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,  	finalizedinitialize_optionsre   r$  get_sub_commandsreinitialize_command)rs   rx   reinit_subcommandsr   r/  subs         r   r8  z!Distribution.reinitialize_command  s    & 	*)))))'7++ 	6"L**<88GG"3355L  	N""$$$&'l#!!'*** 	C//11 C C))#/ABBBBr    c                 0    t          j         ||           d S Nr   )rs   r   levels      r   r   zDistribution.announce  s    sr    c                 D    | j         D ]}|                     |           dS )zRun 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)rs   r  s     r   run_commandszDistribution.run_commands  s6    
 = 	" 	"CS!!!!	" 	"r    c                     | j                             |          rdS t          j        d|           |                     |          }|                                 |                                 d| j         |<   dS )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%   )re   rf   r   infor'  ensure_finalizedrun)rs   rx   r&  s      r   r?  zDistribution.run_command  sw     =W%% 	Fw'''&&w//  """!"gr    c                 D    t          | j        p| j        pg           dk    S Nr   )r   rW   rZ   r   s    r   has_pure_moduleszDistribution.has_pure_modules  s#    4=9DO9r::Q>>r    c                 @    | j         ot          | j                   dk    S rF  )r]   r   r   s    r   has_ext_moduleszDistribution.has_ext_modules  s     =C(8$9$9A$==r    c                 @    | j         ot          | j                   dk    S rF  )r[   r   r   s    r   has_c_librarieszDistribution.has_c_libraries  s    ~9#dn"5"5"99r    c                 R    |                                  p|                                 S r<  )rG  rI  r   s    r   has_moduleszDistribution.has_modules  s%    $$&&@$*>*>*@*@@r    c                 @    | j         ot          | j                   dk    S rF  )r\   r   r   s    r   has_headerszDistribution.has_headers      |5DL 1 1A 55r    c                 @    | j         ot          | j                   dk    S rF  )ra   r   r   s    r   has_scriptszDistribution.has_scripts  rP  r    c                 @    | j         ot          | j                   dk    S rF  )rb   r   r   s    r   has_data_fileszDistribution.has_data_files  s    ;3t#7#7!#;;r    c                 ~    |                                  o)|                                  o|                                  S r<  )rG  rI  rK  r   s    r   is_purezDistribution.is_pure  sD    !!## +((***+((***	
r    r<  )NNrE   )r%   r>   )*r   
__module____qualname____doc__r   r   r   rK   r   r   rh   r   r   r   r   r   r   r   rr   r   r   r  r  r  r  r   r'  r$  r8  r   INFOr   r@  r?  rG  rI  rK  rM  rO  rR  rT  rV  r   r    r   r"   r"   4   s        *  NL  O6 NM_MMM Y'L\  \  \  \ |	 	 	8 8 8 84  .? ? ?$@4 @4 @4 @4HA A AF
 
 
a a aF4 4 4 121r 0+ 0+ 0+ 0+d%# %# %#NA A A"R R R<  F
 
 
%E %E %EN   :)0 )0 )0 )0V& & & &T #&(    " " "# # #(? ? ?> > >: : :A A A6 6 66 6 6< < <
 
 
 
 
r    r"   c                       e Zd ZdZdZd#dZd Zd Zd Zd Z	d	 Z
d
 Zd Zd Zd Zd Zd Zd Zd Zd Zd ZeZd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d  Z"d! Z#d" Z$dS )$rM   z]Dummy class to hold the distribution meta-data: name, version,
    author, and so forth.
    )r+   r,   r/   author_emailr1   maintainer_emailr3   r4   r6   long_descriptionr9   r7   r.   r2   contact_emailr8   download_urlr:   r;   r<   Nc                 @   |$|                      t          |                     d S d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _	        d | _
        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d S r<  )read_pkg_fileopenr+   r,   r/   r\  r1   r]  r3   r4   r6   r^  r9   r7   r8   r`  r:   r;   r<   )rs   r   s     r   r   zDistributionMetadata.__init__!  s    tDzz*****DIDLDK $D"DO$(D!DHDL#D$(D! DM!DN#D $D DM DM!DNNNr    c                    t          |          fd}fd}d         } |d          | _         |d          | _         |d          | _         |d          | _        d| _         |d	          | _        d| _         |d
          | _         |d          | _	        dv r |d          | _
        nd| _
         |d          | _         |d          | _        dv r# |d                              d          | _         |d          | _         |d          | _        |dk    r2 |d          | _         |d          | _         |d          | _        dS d| _        d| _        d| _        dS )z-Reads the metadata values from a file object.c                 0    |          }|r|dk    r|S d S d S NUNKNOWNr   )r+   r   r   s     r   _read_fieldz7DistributionMetadata.read_pkg_file.<locals>._read_field<  s3    IE )++ ++r    c                 D                         | d           }|g k    rd S |S r<  )get_all)r+   valuesr   s     r   
_read_listz6DistributionMetadata.read_pkg_file.<locals>._read_listA  s)    [[t,,F||tMr    zmetadata-versionr+   r,   summaryr/   Nr0   z	home-pager4   zdownload-urlr6   r9   r   platform
classifier1.1r;   r:   r<   )r   r+   r,   r6   r/   r1   r\  r]  r3   r4   r`  r^  r   r9   r7   r8   r;   r:   r<   )rs   filerh  rl  metadata_versionr   s        @r   rb  z"DistributionMetadata.read_pkg_file8  s   %%	 	 	 	 	
	 	 	 	 	 12K''	"{9--&;y11!k(++'K77 $;{++"{9--S   +N ; ;D $D +M : :&;y11'K
3399#>>DM#J//%:l33 u$$&Jz22DM&Jz22DM'Z44DNNN DM DM!DNNNr    c                     t          t          j                            |d          dd          5 }|                     |           ddd           dS # 1 swxY w Y   dS )z.Write the PKG-INFO file into the release tree.zPKG-INFOwzUTF-8)encodingN)rc  r   r   r   write_pkg_file)rs   base_dirpkg_infos      r   write_pkg_infoz#DistributionMetadata.write_pkg_infok  s    GLL:..g
 
 
 	*)))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*s   AAAc                    d}| j         s| j        s| j        s| j        s| j        rd}                    d|z                                 d|                                 z                                 d|                                 z             fd} |d|                                             |d| 	                                            |d	| 
                                            |d
|                                             |d|                                             |d| j                    |dt          |                                 pd                      |dd                    |                                                      |                     d|                                            |                     d|                                            |                     d|                                            |                     d|                                            |                     d|                                            dS )z0Write the PKG-INFO format data to a file object.z1.0rp  zMetadata-Version: %s
z	Name: %s
zVersion: %s
c                 F    |r                     |  d| d           d S d S )Nz: rG   )rm   )r   r|   rq  s     r   maybe_writez8DistributionMetadata.write_pkg_file.<locals>.maybe_write  s>     1

f/////000001 1r    Summaryz	Home-pageAuthorzAuthor-emailLicensezDownload-URLDescriptionrE   Keywordsr   Platform
ClassifierRequiresProvides	ObsoletesN)r:   r;   r<   r8   r`  rm   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)rs   rq  r,   r|  s    `  r   rv  z#DistributionMetadata.write_pkg_filer  sy   M	}	 ~	 		
  	 G 	

+g5666

<$--//1222

?T%5%5%7%77888	1 	1 	1 	1 	1
 	It3355666K000Hd..00111ND$:$:$<$<===It//11222ND$5666M=1J1J1L1L1RPR#S#STTTJ):):)<)< = =>>>z4+=+=+?+?@@@|T-A-A-C-CDDD 	z4+<+<+>+>???z4+<+<+>+>???{D,>,>,@,@AAAAAr    c                 j    |pg }|D ]+}|                     d                    ||                     ,d S )Nz{}: {}
)rm   r   )rs   rq  r+   rk  r   s        r   r  z DistributionMetadata._write_list  sI    2 	7 	7EJJz((u556666	7 	7r    c                     | j         pdS rf  )r+   r   s    r   r  zDistributionMetadata.get_name  s    y%I%r    c                     | j         pdS )Nz0.0.0)r,   r   s    r   r  z DistributionMetadata.get_version  s    |&w&r    c                 v    d                     |                                 |                                           S )Nz{}-{})r   r  r  r   s    r   get_fullnamez!DistributionMetadata.get_fullname  s*    ~~dmmoot/?/?/A/ABBBr    c                     | j         S r<  )r/   r   s    r   
get_authorzDistributionMetadata.get_author  s
    {r    c                     | j         S r<  )r\  r   s    r   get_author_emailz%DistributionMetadata.get_author_email        r    c                     | j         S r<  )r1   r   s    r   get_maintainerz#DistributionMetadata.get_maintainer  s
    r    c                     | j         S r<  )r]  r   s    r   get_maintainer_emailz)DistributionMetadata.get_maintainer_email      $$r    c                     | j         p| j        S r<  )r1   r/   r   s    r   r  z DistributionMetadata.get_contact  s    -$+-r    c                     | j         p| j        S r<  )r]  r\  r   s    r   r  z&DistributionMetadata.get_contact_email  s    $9(99r    c                     | j         S r<  )r3   r   s    r   r  zDistributionMetadata.get_url  s	    xr    c                     | j         S r<  )r4   r   s    r   r  z DistributionMetadata.get_license  s
    |r    c                     | j         S r<  )r6   r   s    r   r  z$DistributionMetadata.get_description  s    r    c                     | j         S r<  )r^  r   s    r   r  z)DistributionMetadata.get_long_description  r  r    c                     | j         pg S r<  )r9   r   s    r   r  z!DistributionMetadata.get_keywords      }""r    c                 0    t          |d          | _        d S )Nr9   )r   r9   rs   r   s     r   set_keywordsz!DistributionMetadata.set_keywords  s    $UJ77r    c                     | j         S r<  )r7   r   s    r   r  z"DistributionMetadata.get_platforms  s
    ~r    c                 0    t          |d          | _        d S )Nr7   )r   r7   r  s     r   set_platformsz"DistributionMetadata.set_platforms  s    %e[99r    c                     | j         pg S r<  )r8   r   s    r   r  z$DistributionMetadata.get_classifiers  s    %2%r    c                 0    t          |d          | _        d S )Nr8   )r   r8   r  s     r   set_classifiersz$DistributionMetadata.set_classifiers  s    '}==r    c                     | j         S r<  )r`  r   s    r   get_download_urlz%DistributionMetadata.get_download_url  r  r    c                     | j         pg S r<  )r;   r   s    r   r  z!DistributionMetadata.get_requires  r  r    c                 t    dd l }|D ]}|j                            |           t          |          | _        d S rF  )distutils.versionpredicateversionpredicateVersionPredicater   r;   rs   r   r   r$   s       r   set_requiresz!DistributionMetadata.set_requires  sH    )))) 	; 	;A&77::::Ur    c                     | j         pg S r<  )r:   r   s    r   r  z!DistributionMetadata.get_provides  r  r    c                 r    d |D             }|D ] }dd l }|j                            |           !|| _        d S )Nc                 6    g | ]}|                                 S r   r   )r@   r$   s     r   rB   z5DistributionMetadata.set_provides.<locals>.<listcomp>  s     ***q***r    r   )r  r  split_provisionr:   )rs   r   r$   r   s       r   set_providesz!DistributionMetadata.set_provides  sU    **E*** 	: 	:A----&66q9999r    c                     | j         pg S r<  )r<   r   s    r   r  z"DistributionMetadata.get_obsoletes  s    ~##r    c                 t    dd l }|D ]}|j                            |           t          |          | _        d S rF  )r  r  r  r   r<   r  s       r   set_obsoletesz"DistributionMetadata.set_obsoletes  sH    )))) 	; 	;A&77::::er    r<  )%r   rW  rX  rY  rO   r   rb  ry  rv  r  r  r  r  r  r  r  r  r  r  r  r  get_licencer  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r    r   rM   rM     s        0" " " ".1" 1" 1"f* * *%B %B %BN7 7 7& & &' ' 'C C C  ! ! !  % % %. . .: : :     K     % % %# # #8 8 8  : : :& & &> > >! ! !# # #$ $ $# # #  $ $ $% % % % %r    rM   c                 N    g }| D ]}|                     |dd                     |S )zConvert a 4-tuple 'help_options' list as found in various command
    classes to the 3-tuple form required by FancyGetopt.
    r      )r   )rF   new_options
help_tuples      r   r   r     s=     K , ,
:ac?++++r    ) rY  rk   r   rer   r   emailr   ri   r  distutils.errorsr   r   r   r   distutils.fancy_getoptr   r	   distutils.utilr
   r   r   r   r   distutils.debugr   compiler   r   r"   rM   r   r   r    r   <module>r     s    


 				 				      # # # # # #OOOO   HHH            B A A A A A A A B B B B B B B B B B       ! ! ! ! ! ! RZ455
  F
 F
 F
 F
 F
 F
 F
 F
`x% x% x% x% x% x% x% x%v    s   # --