-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/bzrlib/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/bzrlib/plugin.pyc


:Nc@@sdZddlmZddlZddlZddlmZddlmZee	ddZea
eaiZdZdZed	Zd
ZdZddZd
ZdZdZdZdZddZdZeZdZdZdZ dZ!dZ"dZ#de$fdYZ%de$fdYZ&de$fdYZ'd e$fd!YZ(e(Z)ej*j+e)dS("sbzr python plugin support.

When load_plugins() is invoked, any python module in any directory in
$BZR_PLUGIN_PATH will be imported.  The module will be imported as
'bzrlib.plugins.$BASENAME(PLUGIN)'.  In the plugin's main body, it should
update any bzrlib registries it wants to extend.

See the plugin-api developer documentation for information about writing
plugins.

BZR_PLUGIN_PATH is also honoured for any plugins imported via
'import bzrlib.plugins.PLUGINNAME', as long as set_plugins_path has been
called.
i(tabsolute_importN(tosutils(tlazy_imports
import imp
import re
import types

from bzrlib import (
    _format_version_tuple,
    config,
    debug,
    errors,
    trace,
    )
from bzrlib.i18n import gettext
from bzrlib import plugins as _mod_plugins
cC@stS(N(t_plugins_disabled(((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pytare_plugins_disabledCscC@statgdS(sRDisable loading plugins.

    Future calls to load_plugins() will be ignored.
    N(tTrueRtload_plugins(((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pytdisable_pluginsGsc
c@s0ddlm}t}ttt|jtj}x|D]}||kr||}|j}|dkrd}nd||fV||j	}|r|j
dd}nd}d|V|rd	|jVn~n	d
|V|tkr#x"t|D]}	d|	dVq	WndVqHWdS(
sGenerate text description of plugins.

    Includes both those that have loaded, and those that failed to 
    load.

    :param show_paths: If true,
    :returns: Iterator of text lines (including newlines.)
    i(tgetdoctunknownts%s %s
s
s(no description)s  %s
s   %s
s%s (failed to load)
s  ** N(tinspectRtpluginstsortedtlisttsettkeystplugin_warningst__version__tmoduletsplittpath(
t
show_pathsRtloaded_pluginst	all_namestnametplugintversiontdtdoctline((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pytdescribe_pluginsQs0			

				cC@s
|jdS(Ns\/(trstrip(R((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyt_strip_trailing_sepvscC@s|s
gSg}xs|jtjD]_}y|jd\}}Wn*tk
rntjtd|nX|j||fq#W|S(sReturns the plugin paths from a string describing the associations.

    :param paths: A string describing the paths associated with the plugins.

    :returns: A list of (plugin name, path) tuples.

    For example, if paths is my_plugin@/test/my-test:her_plugin@/production/her,
    [('my_plugin', '/test/my-test'), ('her_plugin', '/production/her')] 
    will be returned.

    Note that ':' in the example above depends on the os.
    t@s<"%s" is not a valid <plugin_name>@<plugin_path> description (Rtostpathsept
ValueErrorterrorstBzrCommandErrortgettexttappend(tpathstspecstspecRR((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyt_get_specific_plugin_pathszs

	cC@s|dkrt}n|t_tjtjjdd}|dk	rx1|j	tj
D]}tjjd|q_Wnx:t
tjjddD]\}}|tjd|<qW|S(sSet the path for plugins to be loaded from.

    :param path: The list of paths to search for plugins.  By default,
        path will be determined using get_standard_plugins_path.
        if path is [], no plugins can be loaded.
    tBZR_DISABLE_PLUGINSsbzrlib.plugins.tBZR_PLUGINS_ATsbzrlib.plugins.%sN(tNonetget_standard_plugins_patht_mod_pluginst__path__tPluginImportertresetR#tenvirontgetRR$t	blacklisttaddR-tspecific_paths(Rtdisabled_pluginsRtplugin_nametplugin_path((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pytset_plugins_paths	
cC@s,|dk	r(||kr(|j|n|S(s2Append a new path if it set and not already known.N(R0R)(R*tnew_path((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyt_append_new_pathscC@sdd}tttdd}|rKtjtjtjtd}nt	j
jtj}|S(Ntfrozens../../../plugins(R0tbooltgetattrtsysRtabspathtpathjointdirnamet__file__R#RR2(t	core_pathtbzr_exe((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pytget_core_plugin_pathscC@s]tjdkrdSd}yddlm}Wntk
r@nXtj|dd}|S(s0Returns the path for the site installed plugins.twin32i(tget_python_libtbzrlibRN(RDtplatformR0tdistutils.sysconfigRMtImportErrorRRF(t	site_pathRM((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pytget_site_plugin_paths
cC@stjtjdS(NR(RRFtconfigt
config_dir(((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pytget_user_plugin_pathscC@stjjddjtj}ddg}tdtdtdt}xJ|j	D]<\}}d|}||kr^|j
|d||<q^q^Wg}xW||D]K}|jd	ry||d
}Wqt
k
rqXnt||qWtt|}|S(s1Determine a plugin path suitable for general use.tBZR_PLUGIN_PATHs+users+cores+sitetcoretsitetusers-%st+iN(R#R6R7RR$tdictRKRSRVt	iteritemstremoveR0t
startswithtKeyErrorR@tmapR!(t	env_pathstdefaultstrefstktvtremovedR*tp((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyR1s(!	


cC@s$tr
dStatt|dS(sCLoad bzrlib plugins.

    The environment variable BZR_PLUGIN_PATH is considered a delimited
    set of paths to look through. Each entry is searched for `*.py`
    files (and whatever other extensions are used in the platform,
    such as `*.pyd`).

    load_from_path() provides the underlying mechanism and is called with
    the default directory list to provide the normal behaviour.

    :param path: The list of paths to search for plugins.  By default,
        path will be determined using get_standard_plugins_path.
        if path is [], no plugins can be loaded.
    N(t_loadedRtload_from_pathR>(R((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyRscC@sx:tjjD])\}}|td}t||qWtt|t_xI|D]A}|shqVnt	j
d|tjj
|rVt|qVqVWdS(sLoad bzrlib plugins found in each dir in dirs.

    Loading a plugin means importing it into the python interpreter.
    The plugin is expected to make calls to register commands when
    it's loaded (or perhaps access other hooks in future.)

    Plugins are loaded into bzrlib.plugins.NAME, and can be found there
    for future reference.

    The python module path for bzrlib.plugins will be modified to be 'dirs'.
    sbzrlib.plugins.slooking for plugins in %sN(R4R:R]tlent_load_plugin_moduleRaR!R2R3ttracetmutterR#Rtisdirt
load_from_dir(tdirstfullnameRRR((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyRj*s

cC@s8tj||}tjj|rxtjD]k\}}}|tjtjfkr^q1ntj|d|}tjj	|r1|||||ffSq1WnxtjD]w\}}}|j
|r|t| }|tjkr|j
dr|td }n|||||ffSqWdddfS(sCheck if there is a valid python module that can be loaded as a plugin.

    :param dir: The directory where the search is performed.
    :param path: An existing file path, either a python file or a package
        directory.

    :return: (name, path, description) name is the module name, path is the
        file to load and description is the tuple returned by
        imp.get_suffixes().
    t__init__RN(NNN(RRFR#RRotimptget_suffixest	PY_SOURCEtPY_COMPILEDtisfiletendswithRktC_EXTENSIONR0(tdirRRtsuffixtmodetkindt	init_path((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyt_find_plugin_moduleNscC@s*tj|tj|gj|dS(N(RmRnRt
setdefaultR)(R<twarning_message((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pytrecord_plugin_warningps
cB@s^d|ejkrdSyd|iUWn0ek
r=nejk
r}d||j|j|j|jf}e	||ne
k
rY}ejd|e
jd|r
e
jdd|}|jd	r|ed	}nejd
|||fne	|d||fejdejkrZejejejqZnXdS(
sLoad plugin name from dir.

    :param name: The plugin name in the bzrlib.plugins namespace.
    :param dir: The directory the plugin is loaded from for error messages.
    sbzrlib.plugins.%sNsimport bzrlib.plugins.%ssUnable to load plugin %r. It requested API version %s of module %s but the minimum exported version is %s, and the maximum is %ss%ss\.|-| s[-. ]t_tbzr_skUnable to load %r in %r as a plugin because the file path isn't a valid module name; try renaming it to %r.s Unable to load plugin %r from %rterror(R4R8tKeyboardInterruptR&tIncompatibleAPItwantedtapitminimumtcurrentRt	ExceptionRmtwarningtretsearchtsubR_Rktlog_exception_quietlytdebugtdebug_flagstprint_exceptionRDtexc_infotstderr(RR{teRtsanitised_name((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyRlus0
"	
cC@st}xtj|D]w}t||\}}}|dk	r|dkrUqqtt|ddk	rtjd|q|j	|qqWx|D]}t
||qWdS(sLoad the plugins in directory d.

    d must be in the plugins module path already.
    This function is called once for each directory in the module path.
    RssPlugin name %s already loadedN(RR#tlistdirRR0RCR2RmRnR9Rl(Rtplugin_namesRhRRtdesc((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyRps	
cC@sRi}xEtjjD]4\}}t|tjrt||||<qqW|S(s]Return a dictionary of the plugins.

    Each item in the dictionary is a PlugIn object.
    (R2t__dict__titemst
isinstancettypest
ModuleTypetPlugIn(tresultRR((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyRs
cC@sSg}x=ttjD]&\}}|jd||jfqWdj|S(sIReturn a string holding a concise list of plugins and their version.
    s%s[%s]s, (R
RRR)Rtjoin(RRta_plugin((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pytformat_concise_plugin_lists
"	tPluginsHelpIndexcB@s eZdZdZdZRS(s2A help index that returns help topics for plugins.cC@s
d|_dS(Nsplugins/(tprefix(tself((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyRsscC@ss|s
gS|j|jr2|t|j}nd|}ytj|}Wntk
ragSXt|gSdS(sSearch for topic in the loaded plugins.

        This will not trigger loading of new plugins.

        :param topic: A topic to search for.
        :return: A list which is either empty or contains a single
            RegisteredTopic entry.
        sbzrlib.plugins.%sN(R_RRkRDtmodulesR`tModuleHelpTopic(Rttopictplugin_module_nameR((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyt
get_topicss	

(t__name__t
__module__t__doc__RsR(((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyRs	RcB@s/eZdZdZdedZdZRS(s6A help topic which returns the docstring for a module.cC@s
||_dS(s\Constructor.

        :param module: The module for which help should be generated.
        N(R(RR((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyRsscC@so|jjsd|jj}n|jj}|ddkrH|d7}nddlm}||j|7}|S(sReturn a string with the help for this topic.

        :param additional_see_also: Additional help topics to be
            cross-referenced.
        sPlugin '%s' has no docstring.
is
i(thelp_topics(RRRRNRt_format_see_also(Rtadditional_see_alsotverboseRR((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyt
get_help_texts
cC@s|jjtdS(s+Return the module help topic: its basename.sbzrlib.plugins.(RRRk(R((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pytget_help_topicsN(RRRRsR0RRR(((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyRs	RcB@s_eZdZdZdZdZeZdZdZdZ	dZ
ee
ZRS(svThe bzrlib representation of a plugin.

    The PlugIn object provides a way to manipulate a given plugin module.
    cC@s||_||_dS(sConstruct a plugin for module.N(RR(RRR((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyRss	cC@st|jdddk	r5tjj|jjdSt|jdddk	rtjj|jj}|dd	kr|d d}tjj|r|}qn|St	|jSdS(
s.Get the path that this plugin was loaded from.R3iRHis.pycs.pyos.pyN(s.pycs.pyo(
RCRR0R#RRER3RHRxtrepr(RRtpypath((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyRscC@s/d|jj|jjt||j|jfS(Ns(<%s.%s object at %s, name=%s, module=%s>(t	__class__RRtidRR(R((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyt__str__!scC@s0t|jdddk	r(|jjSdSdS(sReturn the plugin's test suite.t
test_suiteN(RCRR0R(R((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyR(s
cC@s3t|jdddk	r+|j|jSdSdS(sReturn the adapted plugin's test suite.

        :param loader: The custom loader that should be used to load additional
            tests.

        t
load_testsN(RCRR0tloadTestsFromModule(Rtloader((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pytload_plugin_tests/scC@st|jdd}|dk	ryMt|tjrH|jd}n%t|dkrmt|d}nWqt	k
r}t
j|f}qXn|S(s5Return the plugin's version_tuple or None if unknown.tversion_infot.itfinaliN(sfinali(RCRR0RRt
StringTypeRRkttuplet	TypeErrorRmR(RRR((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyR;s
cC@s|j}|dks*t|dkr.dSyt|}Wn>tttfk
r~}tjdj	t
t|}nX|S(NiR	R(RR0Rkt_format_version_tupleR%Rt
IndexErrorRmRRRatstr(RRtversion_stringR((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyt_get__version__Js
(
RRRRsRRt__repr__RRRRtpropertyR(((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyRs							
t_PluginImportercB@s5eZdZdZdZddZdZRS(sAn importer tailored to bzr specific needs.

    This is a singleton that takes care of:
    - disabled plugins specified in 'blacklist',
    - plugins that needs to be loaded from specific directories.
    cC@s|jdS(N(R5(R((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyRsbscC@st|_i|_dS(N(RR8R:(R((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyR5escC@sL|jdsdS||jkr5td|n||jkrH|SdS(sSearch a plugin module.

        Disabled plugins raise an import error, plugins with specific paths
        returns a specific loader.

        :return: None if the plugin doesn't need special handling, self
            otherwise.
        sbzrlib.plugins.s%s is disabledN(R_R0R8RQR:(RRrtparent_path((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pytfind_moduleis	c
C@s|j|}d}tjj|rxtjD]t\}}}|tjtjfkr_q2nt	j
|d|}tjj|r2|}d}d}tj}Pq2q2Wn9x6tjD](\}}}|j
|r|}PqqW|dkrtd||fn|tjkr#d}nt||}z2tj||||||f}	||	_|	SWd|dk	r|jnXdS(s2Load a plugin from a specific directory (or file).RsR
s%s cannot be loaded from %sN(R:R0R#RRoRtRuRvRwRRFRxt
PKG_DIRECTORYRyRQtopentload_modulet__package__tclose(
RRrR=tloading_pathR|R}R~Rtftmod((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyRzs<
			N(RRRRsR5R0RR(((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyRZs
		(,Rt
__future__RR#RDRNRtbzrlib.lazy_importRtglobalsR0tDEFAULT_PLUGIN_PATHtFalseRiRRRRRR!R-R>R@RKRSRVR1RRjtload_from_dirsRRRlRpRRtobjectRRRRR4t	meta_pathR)(((s1/usr/lib/python2.7/dist-packages/bzrlib/plugin.pyt<module>sJ			
%							2	!	"		%			RJ	

Copyright © 2017 || Recoded By Mr.Bumblebee