-
<c       s    d  Z    h  d d <d d <d d <d d <d	 d
 <d d <d d <Z - y . e d i d  d Z Wn / 0 d Z n X5 d k Z 6 d k Z 7 d k Z 8 y 9 d k l Z Wn : ; d k l Z n X< d k	 Z	 = d k
 Z
 B d k Z C d k l Z I d e f d     YZ W e i i e i d  Z X e i i e  Z d e
 i
 f d     YZ  e d j oQ  d k Z  e i d   d k Z  e i i e i     d k Z n d S(   s4   Define a class to handle pluggable module loading.

s   $RCSfile: pluginloader.py,v $s   module_names    Doug Hellmann <doug@hellfly.net>s   creators   HappyDocs   projects   Sat, 03-Jun-2000 19:23:48 EDTs   createds   $Author: doughellmann $s   authors   $Revision: 1.4 $s   versions   $Date: 2002/03/31 22:15:35 $s   dates    i   s   0.0N(   s   StringIO(   s   traces   PluginExceptionc      s   I K d   Z  P d   Z RS(   Nc    s&   K L | |  _ M | |  _ N d  Sd  S(   N(   s
   pluginNames   selfs   _plugin_names   wrappedExceptions   _wrapped_exception(   s   selfs   wrappedExceptions
   pluginName(    (    sV   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_1/happydoclib/pluginloader.pys   __init__K s   c    s   P Q d |  i |  i f Sd  S(   Ns   Problem with %s
%s(   s   selfs   _plugin_names   _wrapped_exception(   s   self(    (    sV   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_1/happydoclib/pluginloader.pys   __str__P s   (   s   __init__s   __str__(    (    (    sV   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_1/happydoclib/pluginloader.pys   PluginExceptionI s   i    s   PluginLoaderc      s2   Z d  Z  [ ] d   Z  d   Z  d   Z RS(   s+   A class to handle pluggable module loading.c  	  s  ] k l t  i d d m d | n d | o d | s t i i |   w | i d  }
 x t
 |
  d j o y d i |
 d  } n z | |  _  | |  _  | |  _  |  i   }  | i    x| D ]}  t  i d d  d	 |  | i t i  }
  |
 d
 }  |
 d }  | |  i j o  d | |  i f GHn  |
 d }  t  i d |   t i i |  }  |  i o  d |  i | | f } n  d | | f }  t  i d |   y'  t  i d |   t |  }	 WnW t j
 oH}  t! t i" i# d d   o  t$   }  | i d   t& i' d |   t  i d  d |  t  i | i(     t  i)    | i d   t  i)    t* | i(   |   n}  t! t i" i# d d   o  t  i)    q nG  t+ i, i d   t& i'    t+ i, i d   t  i)    q n X | i d  }  xm | d D ]^ }  y  t/ |	 |  }	 Wn<  t0 j
 o-  t+ i, i d | |	 i1 f     n Xq|W y  |	 i2   } WnP  t0 j
 oA  t+ i, i d |   t+ i, i d t4 |	      n X |  i5 |   t  i)   q W t  i)    d Sd S(   s  Create a PluginLoader.

        Parameters

          moduleName -- The imported module, from which we get name, path,
          etc. to find the sub-modules.

          modulePath -- The path to the module, and therefore the
          parent directory of the plugins.

          parentModulePrefix -- The prefix of parent names to be added
          to moduleName.  For example 'happydoclib'.
          
        s   PluginLoaders   __init__s
   moduleNames
   modulePaths   parentModulePrefixs   .i   s   __init__:Loops   _module_nameiis3   EEEE Got local plugin set name "%s" instead of "%s"is   parent_package_names   %s.%s.%ss   %s.%ss   _import_names   Importing %ss   PLUGIN_DEBUGs   0s   
--- Plugin Module Error ---
s   files   PluginLoaderPlugin module errors   ---------------------------

s   PLUGIN_SILENT_ERRORSs%   ERROR: Could not retrieve %s from %s
s+   ERROR: Could not call entryPoint() from %s
s   %s
N(6   s   TRACEs   intos
   moduleNames
   modulePaths   parentModulePrefixs   UserDicts   __init__s   selfs   splits   module_name_partss   lens   joins   plugin_set_names
   plugin_dirs   parent_module_prefixs   getModuleLists   _module_lists   sorts   _module_names   oss   seps   module_base_names   parent_package_names   writeVars   happydoclibs   paths   basenames   _import_names   writes
   __import__s   _modules	   Exceptions   msgs   ints   environs   gets   StringIOs   buffers	   tracebacks	   print_excs   getvalues   outofs   PluginExceptions   syss   stderrs   import_name_partss
   sub_modules   getattrs   AttributeErrors   __name__s
   entryPoints   infos   dirs   addEntryPoint(   s   selfs
   moduleNames
   modulePaths   parentModulePrefixs   infos   parent_package_names   module_base_names   import_name_partss
   sub_modules   _modules   module_name_partss   plugin_set_names   buffers   _module_lists   _module_names   msgs   _import_name(    (    sV   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_1/happydoclib/pluginloader.pys   __init__] s   		
 	
 	 c    s      t  i i |  i  d |  i  }  t i |  }  g  i	 } | D ]  } | t i i |  d  qN ~ }  g  }  x5 | D ]* }  | | j o  | i	 |  n q W | Sd S(   s4   Return a list of module names to be used as plugins.s   %s_*i    N(   s   happydoclibs   paths   joins   selfs
   plugin_dirs   plugin_set_names   glob_patterns   globs	   all_filess   appends   _[1]s   xs   oss   splitexts   all_basenamess   unique_moduless   module(   s   selfs   all_basenamess   modules   unique_moduless   _[1]s   glob_patterns	   all_filess   x(    (    sV   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_1/happydoclib/pluginloader.pys   getModuleList s    ,	
 	c    s      d |  i i  d S(   sy   Add an entry point into a module to our lookup tables.

        This method must be implemented by the subclass.
        s   Not implemented for %sN(   s   selfs	   __class__s   __name__(   s   selfs   infoDict(    (    sV   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_1/happydoclib/pluginloader.pys   addEntryPoint s   (   s   __doc__s   __init__s   getModuleLists   addEntryPoint(    (    (    sV   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_1/happydoclib/pluginloader.pys   PluginLoaderZ s   	vs   __main__s   TestCases/test_plugin_loader(   s   __doc__s   __rcs_info__s   splits   __version__s   globs   oss   syss	   cStringIOs   StringIOs	   tracebacks   UserDicts   happydoclib.paths   happydoclibs   happydoclib.traces   traces   TRACEs	   Exceptions   PluginExceptions   paths   dirnames   argvs   APP_HOME_DIRs   appends   PluginLoaders   __name__s   chdirs   getcwds   runtest(   s   PluginLoaders   __version__s   TRACEs   StringIOs   UserDicts   globs	   tracebacks   APP_HOME_DIRs   syss   runtests   PluginExceptions   oss   happydoclibs   __rcs_info__(    (    sV   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_1/happydoclib/pluginloader.pys   ? s4   H