ž «ÿf³¾c @sdZddlZddlZddlZddlmZyddlZWnek rdeZYnXddl Tddl m Z m Z ddl mZmZmZddlmZddlmZejd ƒZGd d „d ƒZGd d „d ƒZdd„ZdS(u}distutils.dist Provides the Distribution class, which represents the module distribution being built/installed/distributed. iN(umessage_from_file(u*(u FancyGetoptutranslate_longopt(u check_environu strtoboolu rfc822_escape(ulog(uDEBUGu^[a-zA-Z]([a-zA-Z0-9_]*)$cBs&|EeZdZdZd|d}d~dgZdZd€dd‚dƒd„d…d†d‡dˆd‰dŠd‹dŒddŽddd‘d’d“d”gZd;d<„eDƒZidd6Z d{d=d>„Z d?d@„Z d{d{dAdBdC„Z dDdE„Z d{dFdG„ZdHdI„ZdJdK„ZdLdM„ZdNdO„ZddgdPdQ„ZdRdS„ZdTdU„ZdVdW„ZdXdY„ZdZd[„Zd\d]„Zdd^d_„Zd{d`da„Zdbdcdd„Zejdedf„Zdgdh„Z didj„Z!dkdl„Z"dmdn„Z#dodp„Z$dqdr„Z%dsdt„Z&dudv„Z'dwdx„Z(dydz„Z)d{S(•u Distributionu½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. uverboseuvurun verbosely (default)iuquietuqu!run quietly (turns verbosity off)udry-rununudon't actually do anythinguhelpuhushow detailed help messageu£Common commands: (see '--help-commands' for more) setup.py build will build the package underneath 'build/' setup.py install will install the package u help-commandsulist all available commandsunameuprint package nameuversionuVuprint package versionufullnameuprint -uauthoruprint the author's nameu author-emailu print the author's email addressu maintaineruprint the maintainer's nameumaintainer-emailu$print the maintainer's email addressucontactu7print the maintainer's name if known, else the author'su contact-emailu@print the maintainer's email address if known, else the author'suurluprint the URL for this packageulicenseu print the license of the packageulicenceualias for --licenseu descriptionuprint the package descriptionulong-descriptionu"print the long package descriptionu platformsuprint the list of platformsu classifiersuprint the list of classifiersukeywordsuprint the list of keywordsuprovidesu+print the list of packages/modules providedurequiresu+print the list of packages/modules requiredu obsoletesu0print the list of packages/modules made obsoletecCs g|]}t|dƒ‘qS(i(utranslate_longopt(u.0ux((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu os uDistribution.c Csd|_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ƒ}|d k rÉ|d=xY|j ƒD]H\}}|j!|ƒ}x*|j ƒD]\} } d| f|| Fs u1Distribution.finalize_options..u,N(ukeywordsu platforms(ugetattrumetadatauNoneu isinstanceustrusplitusetattr(uselfuattruvalue((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyufinalize_options<s  uDistribution.finalize_optionsc Csvddlm}ddlm}|rr|r;|jƒ}n |j}|j|ƒ|j|jdƒt dƒn|r¦|j|j ƒ|jddƒt dƒnx¶|j D]«}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( ubShow 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'. i(u gen_usage(uCommandu Global options:uu*Information display options (just display u!information, ignore any commands)u help_optionsuOptions for '%s' command:N(udistutils.coreu gen_usageu distutils.cmduCommandu_get_toplevel_optionsuglobal_optionsuset_option_tableu print_helpu common_usageuprintudisplay_optionsucommandsu isinstanceutypeu issubclassuget_command_classuhasattru help_optionsulistu user_optionsufix_help_optionsu__name__u script_name( uselfuparseruglobal_optionsudisplay_optionsucommandsu gen_usageuCommanduoptionsucommanduklass((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu _show_helpIs6      uDistribution._show_helpc Csddlm}|jrD|jƒtdƒt||jƒƒdSd}i}x|jD]}d||dGet 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'. iNiu(no description available)( udistutils.commanducommandu__all__ucmdclassukeysugetuappenduget_command_classu descriptionuAttributeError( uselfu distutilsu std_commandsuis_stducmduextra_commandsurvuklassu description((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyuget_command_listÕs(      uDistribution.get_command_listcCsx|j}t|tƒst|dkr-d}ndd„|jdƒDƒ}d|krh|jddƒn||_n|S(u9Return a list of packages from which commands are loaded.ucSs(g|]}|dkr|jƒ‘qS(u(ustrip(u.0upkg((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu ýs u5Distribution.get_command_packages..u,udistutils.commandiN(ucommand_packagesu isinstanceulistuNoneusplituinsert(uselfupkgs((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyuget_command_packages÷s     u!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(uoReturn 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. u%s.%su3invalid command '%s' (no class '%s' in module '%s')uinvalid command '%s'N( ucmdclassugetuget_command_packagesu __import__usysumodulesu ImportErrorugetattruAttributeErroruDistutilsModuleError(uselfucommanduklassupkgnameu module_nameu klass_nameumodule((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyuget_command_classs(     uDistribution.get_command_classcCsž|jj|ƒ}| rš|rštr9|jd|ƒn|j|ƒ}||ƒ}|j|Xs u5Distribution._set_command_options..u1error in %s: command '%s' has no such option '%s'N(uget_command_nameuNoneuget_option_dictuDEBUGuannounceuitemsuboolean_optionsuAttributeErroru negative_optu isinstanceustrusetattru strtobooluhasattruDistutilsOptionErroru ValueError( uselfu command_obju option_dictu command_nameuoptionusourceuvalueu bool_optsuneg_optu is_stringumsg((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu_set_command_optionsDs>        u!Distribution._set_command_optionsicCs±ddlm}t||ƒs7|}|j|ƒ}n |jƒ}|jsP|S|jƒd|_d|j|<|j|ƒ|r­x'|j ƒD]}|j ||ƒqWn|S(u³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. i(uCommand( u distutils.cmduCommandu isinstanceuget_command_objuget_command_nameu finalizeduinitialize_optionsuhave_runu_set_command_optionsuget_sub_commandsureinitialize_command(uselfucommandureinit_subcommandsuCommandu command_nameusub((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyureinitialize_commandps      u!Distribution.reinitialize_commandcCstj||ƒdS(N(ulog(uselfumsgulevel((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyuannounce™suDistribution.announcecCs%x|jD]}|j|ƒq WdS(u¶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(ucommandsu run_command(uselfucmd((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu run_commandsœsuDistribution.run_commandscCsZ|jj|ƒrdStjd|ƒ|j|ƒ}|jƒ|jƒd|j|-(uauthorNuprint the author's name(u author-emailNu print the author's email address(u maintainerNuprint the maintainer's name(umaintainer-emailNu$print the maintainer's email address(ucontactNu7print the maintainer's name if known, else the author's(u contact-emailNu@print the maintainer's email address if known, else the author's(uurlNuprint the URL for this package(ulicenseNu print the license of the package(ulicenceNualias for --license(u descriptionNuprint the package description(ulong-descriptionNu"print the long package description(u platformsNuprint the list of platforms(u classifiersNuprint the list of classifiers(ukeywordsNuprint the list of keywords(uprovidesNu+print the list of packages/modules provided(urequiresNu+print the list of packages/modules required(u obsoletesNu0print the list of packages/modules made obsolete(*u__name__u __module__u __qualname__u__doc__uglobal_optionsu common_usageuNoneudisplay_optionsudisplay_option_namesu negative_optu__init__uget_option_dictudump_option_dictsufind_config_filesuparse_config_filesuparse_command_lineu_get_toplevel_optionsu_parse_command_optsufinalize_optionsu _show_helpuhandle_display_optionsuprint_command_listuprint_commandsuget_command_listuget_command_packagesuget_command_classuget_command_obju_set_command_optionsureinitialize_commanduloguINFOuannounceu run_commandsu run_commanduhas_pure_modulesuhas_ext_modulesuhas_c_librariesu has_modulesu has_headersu has_scriptsuhas_data_filesuis_pure(u __locals__((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu Distributions¢     ‘  ): C \ 1 (  ! " &,)        u DistributioncBsy|EeZdZdZdOZdNdd„Zdd„Zdd„Zdd„Z dd„Z d d!„Z d"d#„Z d$d%„Z d&d'„Zd(d)„Zd*d+„Zd,d-„Zd.d/„Zd0d1„Zd2d3„Zd4d5„ZeZd6d7„Zd8d9„Zd:d;„Zd<d=„Zd>d?„Zd@dA„ZdBdC„ZdDdE„ZdFdG„ZdHdI„Z dJdK„Z!dLdM„Z"dNS(PuDistributionMetadatau]Dummy class to hold the distribution meta-data: name, version, author, and so forth. unameuversionuauthoru author_emailu maintainerumaintainer_emailuurlulicenseu descriptionulong_descriptionukeywordsu platformsufullnameucontactu contact_emailu classifiersu download_urluprovidesurequiresu obsoletescCs¿|dk r"|jt|ƒƒn™d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_d|_d|_d|_dS(N(uNoneu read_pkg_fileuopenunameuversionuauthoru author_emailu maintainerumaintainer_emailuurlulicenseu descriptionulong_descriptionukeywordsu platformsu classifiersu download_urluprovidesurequiresu obsoletes(uselfupath((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu__init__ës&                 uDistributionMetadata.__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|_dS(u-Reads the metadata values from a file object.csˆ|}|dkrdS|S(NuUNKNOWN(uNone(unameuvalue(umsg(u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu _read_fields  u7DistributionMetadata.read_pkg_file.._read_fieldcs&ˆj|dƒ}|gkr"dS|S(N(uget_alluNone(unameuvalues(umsg(u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu _read_list s u6DistributionMetadata.read_pkg_file.._read_listumetadata-versionunameuversionusummaryuauthoru author-emailu home-pageulicenseu download-urlu descriptionukeywordsu,uplatformu classifieru1.1urequiresuprovidesu obsoletesN(umessage_from_fileunameuversionu descriptionuauthoruNoneu maintaineru author_emailumaintainer_emailuurlulicenseu download_urlulong_descriptionusplitukeywordsu platformsu classifiersurequiresuprovidesu obsoletes(uselfufileu _read_fieldu _read_listumetadata_version((umsgu3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu read_pkg_files:          u"DistributionMetadata.read_pkg_filec Cs>ttjj|dƒdddƒ}|j|ƒWdQXdS(u7Write the PKG-INFO file into the release tree. uPKG-INFOuwuencodinguUTF-8N(uopenuosupathujoinuwrite_pkg_file(uselfubase_dirupkg_info((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyuwrite_pkg_info6s u#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(u9Write the PKG-INFO format data to a file object. u1.0u1.1uMetadata-Version: %s u Name: %s u Version: %s u Summary: %s uHome-page: %s u Author: %s uAuthor-email: %s u License: %s uDownload-URL: %s uDescription: %s u,u Keywords: %s uPlatformu ClassifieruRequiresuProvidesu ObsoletesN(uprovidesurequiresu obsoletesu classifiersu download_urluwriteuget_nameu get_versionuget_descriptionuget_urlu get_contactuget_contact_emailu get_licenseu rfc822_escapeuget_long_descriptionujoinu get_keywordsu _write_listu get_platformsuget_classifiersu get_requiresu get_providesu get_obsoletes(uselfufileuversionu long_descukeywords((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyuwrite_pkg_file=s0  u#DistributionMetadata.write_pkg_filecCs,x%|D]}|jd||fƒqWdS(Nu%s: %s (uwrite(uselfufileunameuvaluesuvalue((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu _write_list_s u DistributionMetadata._write_listcCs |jp dS(NuUNKNOWN(uname(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyuget_nameesuDistributionMetadata.get_namecCs |jp dS(Nu0.0.0(uversion(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu get_versionhsu DistributionMetadata.get_versioncCsd|jƒ|jƒfS(Nu%s-%s(uget_nameu get_version(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu get_fullnameksu!DistributionMetadata.get_fullnamecCs |jp dS(NuUNKNOWN(uauthor(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu get_authornsuDistributionMetadata.get_authorcCs |jp dS(NuUNKNOWN(u author_email(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyuget_author_emailqsu%DistributionMetadata.get_author_emailcCs |jp dS(NuUNKNOWN(u maintainer(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyuget_maintainertsu#DistributionMetadata.get_maintainercCs |jp dS(NuUNKNOWN(umaintainer_email(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyuget_maintainer_emailwsu)DistributionMetadata.get_maintainer_emailcCs|jp|jpdS(NuUNKNOWN(u maintaineruauthor(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu get_contactzsu DistributionMetadata.get_contactcCs|jp|jpdS(NuUNKNOWN(umaintainer_emailu author_email(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyuget_contact_email}su&DistributionMetadata.get_contact_emailcCs |jp dS(NuUNKNOWN(uurl(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyuget_url€suDistributionMetadata.get_urlcCs |jp dS(NuUNKNOWN(ulicense(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu get_licenseƒsu DistributionMetadata.get_licensecCs |jp dS(NuUNKNOWN(u description(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyuget_description‡su$DistributionMetadata.get_descriptioncCs |jp dS(NuUNKNOWN(ulong_description(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyuget_long_descriptionŠsu)DistributionMetadata.get_long_descriptioncCs |jp gS(N(ukeywords(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu get_keywordssu!DistributionMetadata.get_keywordscCs|jpdgS(NuUNKNOWN(u platforms(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu get_platformssu"DistributionMetadata.get_platformscCs |jp gS(N(u classifiers(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyuget_classifiers“su$DistributionMetadata.get_classifierscCs |jp dS(NuUNKNOWN(u download_url(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyuget_download_url–su%DistributionMetadata.get_download_urlcCs |jp gS(N(urequires(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu get_requiresšsu!DistributionMetadata.get_requirescCs:ddl}x|D]}|jj|ƒqW||_dS(Ni(udistutils.versionpredicateuversionpredicateuVersionPredicateurequires(uselfuvalueu distutilsuv((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu set_requiress  u!DistributionMetadata.set_requirescCs |jp gS(N(uprovides(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu get_provides£su!DistributionMetadata.get_providescCsMdd„|Dƒ}x*|D]"}ddl}|jj|ƒqW||_dS(NcSsg|]}|jƒ‘qS((ustrip(u.0uv((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu §s u5DistributionMetadata.set_provides..i(udistutils.versionpredicateuversionpredicateusplit_provisionuprovides(uselfuvalueuvu distutils((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu set_provides¦s   u!DistributionMetadata.set_providescCs |jp gS(N(u obsoletes(uself((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu get_obsoletes­su"DistributionMetadata.get_obsoletescCs:ddl}x|D]}|jj|ƒqW||_dS(Ni(udistutils.versionpredicateuversionpredicateuVersionPredicateu obsoletes(uselfuvalueu distutilsuv((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyu set_obsoletes°s  u"DistributionMetadata.set_obsoletesN(unameuversionuauthoru author_emailu maintainerumaintainer_emailuurlulicenseu descriptionulong_descriptionukeywordsu platformsufullnameucontactu contact_emailulicenseu classifiersu download_urluprovidesurequiresu obsoletes(#u__name__u __module__u __qualname__u__doc__u_METHOD_BASENAMESuNoneu__init__u read_pkg_fileuwrite_pkg_infouwrite_pkg_fileu _write_listuget_nameu get_versionu get_fullnameu get_authoruget_author_emailuget_maintaineruget_maintainer_emailu get_contactuget_contact_emailuget_urlu get_licenseu get_licenceuget_descriptionuget_long_descriptionu get_keywordsu get_platformsuget_classifiersuget_download_urlu get_requiresu set_requiresu get_providesu set_providesu get_obsoletesu set_obsoletes(u __locals__((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyuDistributionMetadataÜsJ 4  "                       uDistributionMetadatacCs2g}x%|D]}|j|dd…ƒq W|S(uConvert a 4-tuple 'help_options' list as found in various command classes to the 3-tuple form required by FancyGetopt. ii(uappend(uoptionsu new_optionsu help_tuple((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyufix_help_options¶s ufix_help_options(u__doc__usysuosureuemailumessage_from_fileuwarningsu ImportErroruNoneudistutils.errorsudistutils.fancy_getoptu FancyGetoptutranslate_longoptudistutils.utilu check_environu strtoboolu rfc822_escapeu distutilsulogudistutils.debuguDEBUGucompileu command_reu DistributionuDistributionMetadataufix_help_options(((u3/opt/alt/python33/lib64/python3.3/distutils/dist.pyus$$   ÿÿÿÃÚ