{fc@s&dZdZddlZddlZddlZddlmZyddlZWnek rie ZnXddl m Z m Z m Z mZddlmZmZddlmZmZmZddlmZdd lmZd Zejd Zd fd YZdfdYZdZdS(s}distutils.dist Provides the Distribution class, which represents the module distribution being built/installed/distributed. s$Id$iN(tmessage_from_file(tDistutilsOptionErrortDistutilsArgErrortDistutilsModuleErrortDistutilsClassError(t FancyGetoptttranslate_longopt(t check_environt strtoboolt rfc822_escape(tlog(tDEBUGsutf-8s^[a-zA-Z]([a-zA-Z0-9_]*)$t DistributioncBseZdZd]d^d_d`dbgZdZdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwgZed<eZidd6Z dad=Z d>Z dadad?d@Z dAZ dadBZdCZdDZdEZdFZddgdGZdHZdIZdJZdKZdLZdMZddNZdadOZdPdQZejdRZdSZ dTZ!dUZ"dVZ#dWZ$dXZ%dYZ&dZZ'd[Z(d\Z)RS(xsThe 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. tverbosetvsrun verbosely (default)itquiettqs!run quietly (turns verbosity off)sdry-runtnsdon't actually do anythingthelpthsshow detailed help messages no-user-cfgs-ignore pydistutils.cfg in your home directorysCommon commands: (see '--help-commands' for more) setup.py build will build the package underneath 'build/' setup.py install will install the package s help-commandsslist all available commandstnamesprint package nametversiontVsprint package versiontfullnamesprint -tauthorsprint the author's names author-emails print the author's email addresst maintainersprint the maintainer's namesmaintainer-emails$print the maintainer's email addresstcontacts7print the maintainer's name if known, else the author'ss contact-emails@print the maintainer's email address if known, else the author'sturlsprint the URL for this packagetlicenses print the license of the packagetlicencesalias for --licenset descriptionsprint the package descriptionslong-descriptions"print the long package descriptiont platformssprint the list of platformst classifierssprint the list of classifierstkeywordssprint the list of keywordstprovidess+print the list of packages/modules providedtrequiress+print the list of packages/modules requiredt obsoletess0print the list of packages/modules made obsoletecCst|dS(Ni(R(tx((s&/usr/lib64/python2.7/distutils/dist.pytwtcCsid|_d|_d|_x!|jD]}t||dq%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|| 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'. iNis(no description available)( RR]RR3RiRIR~RRR( RXRtRRRRtrvRR((s&/usr/lib64/python2.7/distutils/dist.pytget_command_lists(      cCs|j}t|ts|dkr-d}ng|jdD]}|dkr=|j^q=}d|kr|jddn||_n|S(s9Return a list of packages from which commands are loaded.R'Rsdistutils.commandiN(R5RRR4RlRtinsert(RXtpkgstpkg((s&/usr/lib64/python2.7/distutils/dist.pytget_command_packagess   4  cCs|jj|}|r|Sx|jD]}d||f}|}yt|tj|}Wntk rvq)nXyt||}Wn'tk rt d|||fnX||j|<|SWt d|dS(soReturn 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. s%s.%ss3invalid command '%s' (no class '%s' in module '%s')sinvalid command '%s'N( R3RIRt __import__RNRzt ImportErrorR2RR(RXR]Rtpkgnamet module_namet klass_nametmodule((s&/usr/lib64/python2.7/distutils/dist.pyRs(     cCs|jj|}| r|rtr9|jd|n|j|}||}|j|R(RX((s&/usr/lib64/python2.7/distutils/dist.pythas_c_librariesscCs|jp|jS(N(RR(RX((s&/usr/lib64/python2.7/distutils/dist.pyt has_modulesscCs|jot|jdkS(Ni(R?R(RX((s&/usr/lib64/python2.7/distutils/dist.pyt has_headersscCs|jot|jdkS(Ni(RDR(RX((s&/usr/lib64/python2.7/distutils/dist.pyt has_scriptsscCs|jot|jdkS(Ni(RER(RX((s&/usr/lib64/python2.7/distutils/dist.pythas_data_filesscCs$|jo#|j o#|j S(N(RRR(RX((s&/usr/lib64/python2.7/distutils/dist.pytis_pures  (R Rsrun verbosely (default)i(RRs!run quietly (turns verbosity off)(sdry-runRsdon't actually do anything(RRsshow detailed help messageN(s no-user-cfgNs-ignore pydistutils.cfg in your home directory(s help-commandsNslist all available commands(RNsprint package name(RRsprint package version(RNsprint -(RNsprint the author's name(s author-emailNs print the author's email address(RNsprint the maintainer's name(smaintainer-emailNs$print the maintainer's email address(RNs7print the maintainer's name if known, else the author's(s contact-emailNs@print the maintainer's email address if known, else the author's(RNsprint the URL for this package(RNs print the license of the package(RNsalias for --license(RNsprint the package description(slong-descriptionNs"print the long package description(RNsprint the list of platforms(R Nsprint the list of classifiers(R!Nsprint the list of keywords(R"Ns+print the list of packages/modules provided(R#Ns+print the list of packages/modules required(R$Ns0print the list of packages/modules made obsolete(*Rt __module__t__doc__R4RRRRR-RReRKRsRRRRRRWRRRRRRRRRRR tINFORkRRRRRRRRRR(((s&/usr/lib64/python2.7/distutils/dist.pyR "s         0 . C ]  1 (  ! # '  + )        R/cBs+eZdZd3Zd4dZdZdZdZdZ dZ dZ dZ dZ dZdZd Zd!Zd"Zd#Zd$Zd%Zd&ZeZd'Zd(Zd)Zd*Zd+Zd,Zd-Zd.Zd/Z d0Z!d1Z"d2Z#RS(5s]Dummy class to hold the distribution meta-data: name, version, author, and so forth. RRRt author_emailRtmaintainer_emailRRRtlong_descriptionR!RRRt contact_emailR t download_urlR"R#R$cCs|dk r"|jt|nd|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_d|_d|_d|_dS(N(R4t read_pkg_filetopenRRRR RR RRRR R!RR RR"R#R$(RXRx((s&/usr/lib64/python2.7/distutils/dist.pyRes&                 cst|fd}fd}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|_|dkru|d|_|d|_|d|_nd|_d|_d|_dS(s-Reads the metadata values from a file object.cs|}|dkrdS|S(NtUNKNOWN(R4(RR(Rb(s&/usr/lib64/python2.7/distutils/dist.pyt _read_fields  cs&j|d}|gkr"dS|S(N(tget_allR4(Rtvalues(Rb(s&/usr/lib64/python2.7/distutils/dist.pyt _read_list#s smetadata-versionRRtsummaryRs author-emails home-pageRs download-urlRR!Rtplatformt classifiers1.1R#R"R$N(RRRRRR4RR R RRRR RlR!RR R#R"R$(RXtfileRRtmetadata_version((Rbs&/usr/lib64/python2.7/distutils/dist.pyRs:          cCsAttjj|dd}z|j|Wd|jXdS(s7Write the PKG-INFO file into the release tree. sPKG-INFOtwN(RRwRxR|twrite_pkg_filetclose(RXtbase_dirtpkg_info((s&/usr/lib64/python2.7/distutils/dist.pytwrite_pkg_infoMscCsd}|js3|js3|js3|js3|jr<d}n|j|d||j|d|j|j|d|j|j|d|j|j|d|j |j|d|j |j|d |j |j|d |j |jr |j|d |jnt |j}|j|d |d j|j}|rv|j|d|n|j|d|j|j|d|j|j|d|j|j|d|j|j|d|jdS(s9Write the PKG-INFO format data to a file object. s1.0s1.1sMetadata-VersiontNametVersiontSummarys Home-pagetAuthors Author-emailtLicenses Download-URLt DescriptionRtKeywordstPlatformt ClassifiertRequirestProvidest ObsoletesN(R"R#R$R Rt _write_fieldtget_namet get_versiontget_descriptiontget_urlt get_contacttget_contact_emailt get_licenseR tget_long_descriptionR|t get_keywordst _write_listt get_platformstget_classifierst get_requirest get_providest get_obsoletes(RXRRt long_descR!((s&/usr/lib64/python2.7/distutils/dist.pyRVs0  cCs$|jd||j|fdS(Ns%s: %s (RPt _encode_field(RXRRR((s&/usr/lib64/python2.7/distutils/dist.pyR.xscCs(x!|D]}|j|||qWdS(N(R.(RXRRRR((s&/usr/lib64/python2.7/distutils/dist.pyR8{s cCs6|dkrdSt|tr,|jtSt|S(N(R4RtunicodetencodetPKG_INFO_ENCODINGR(RXR((s&/usr/lib64/python2.7/distutils/dist.pyR?s   cCs |jp dS(NR(R(RX((s&/usr/lib64/python2.7/distutils/dist.pyR/scCs |jp dS(Ns0.0.0(R(RX((s&/usr/lib64/python2.7/distutils/dist.pyR0scCsd|j|jfS(Ns%s-%s(R/R0(RX((s&/usr/lib64/python2.7/distutils/dist.pyt get_fullnamescCs|j|jpdS(NR(R?R(RX((s&/usr/lib64/python2.7/distutils/dist.pyt get_authorscCs |jp dS(NR(R (RX((s&/usr/lib64/python2.7/distutils/dist.pytget_author_emailscCs|j|jpdS(NR(R?R(RX((s&/usr/lib64/python2.7/distutils/dist.pytget_maintainerscCs |jp dS(NR(R (RX((s&/usr/lib64/python2.7/distutils/dist.pytget_maintainer_emailscCs(|j|jp'|j|jp'dS(NR(R?RR(RX((s&/usr/lib64/python2.7/distutils/dist.pyR3scCs|jp|jpdS(NR(R R (RX((s&/usr/lib64/python2.7/distutils/dist.pyR4scCs |jp dS(NR(R(RX((s&/usr/lib64/python2.7/distutils/dist.pyR2scCs |jp dS(NR(R(RX((s&/usr/lib64/python2.7/distutils/dist.pyR5scCs|j|jpdS(NR(R?R(RX((s&/usr/lib64/python2.7/distutils/dist.pyR1scCs|j|jpdS(NR(R?R (RX((s&/usr/lib64/python2.7/distutils/dist.pyR6scCs |jp gS(N(R!(RX((s&/usr/lib64/python2.7/distutils/dist.pyR7scCs|jpdgS(NR(R(RX((s&/usr/lib64/python2.7/distutils/dist.pyR9scCs |jp gS(N(R (RX((s&/usr/lib64/python2.7/distutils/dist.pyR:scCs |jp dS(NR(R(RX((s&/usr/lib64/python2.7/distutils/dist.pytget_download_urlscCs |jp gS(N(R#(RX((s&/usr/lib64/python2.7/distutils/dist.pyR;scCs:ddl}x|D]}|jj|qW||_dS(Ni(tdistutils.versionpredicatetversionpredicatetVersionPredicateR#(RXRRtR((s&/usr/lib64/python2.7/distutils/dist.pyt set_requiress  cCs |jp gS(N(R"(RX((s&/usr/lib64/python2.7/distutils/dist.pyR<scCsYg|D]}|j^q}x*|D]"}ddl}|jj|q&W||_dS(Ni(RRIRJtsplit_provisionR"(RXRRRt((s&/usr/lib64/python2.7/distutils/dist.pyt set_providess   cCs |jp gS(N(R$(RX((s&/usr/lib64/python2.7/distutils/dist.pyR=scCs:ddl}x|D]}|jj|qW||_dS(Ni(RIRJRKR$(RXRRtR((s&/usr/lib64/python2.7/distutils/dist.pyt set_obsoletess  (RRRR RR RRRR R!RRRRRR RR"R#R$N($RRR R1R4ReRR!RR.R8R?R/R0RCRDRERFRGR3R4R2R5t get_licenceR1R6R7R9R:RHR;RLR<RNR=RO(((s&/usr/lib64/python2.7/distutils/dist.pyR/sN  4 "                        cCs/g}x"|D]}|j|dd!q W|S(sConvert a 4-tuple 'help_options' list as found in various command classes to the 3-tuple form required by FancyGetopt. ii(R~(R)t new_optionst help_tuple((s&/usr/lib64/python2.7/distutils/dist.pyRs ( R t __revision__RNRwtretemailRRLRR4tdistutils.errorsRRRRtdistutils.fancy_getoptRRtdistutils.utilRRR RtR tdistutils.debugR RBtcompileRR R/R(((s&/usr/lib64/python2.7/distutils/dist.pyts($  "