‰.
uZ–0c      sí    d  Z  E d  G d Z X d Z Z k Z k Z k Z k Z k Z k Z k	 Z	 k
 Z
 [ y \ k Z Wn" ] e j
 o ^ e d ‚ n X` k l l l l a d Z c h  d e <d e <d e <d e <d	 e <Z l y l e i Wn" m e j
 o n h  e _ n Xt d
 Z u d Z v d Z w e e ƒ Z x d Z z e
 Z { e e i d <| e i e i e <~ e Z   d „  Z! Œ d „  Z" ” e e e e d „ Z# d „  Z$ d d „ Z% Wd „  Z& ¨e d „ Z' ád „  Z( ód „  Z) d „  Z* !d „  Z+ :d d „ Z, Gd „  Z- id „  Z. wd „  Z/ ‡e Z0 ˆd „  Z1 ²g  Z2 ³d  „  Z3 Êd! „  Z4 Üd# d" „ Z5 ßd$ f  d% „  ƒ  YZ6 d Z7 d# Z8  d& „  Z9 ,d d' „ Z: Ìe; d
 j o Íe: ƒ  n d( S()   s   Prototype of 'import' functionality enhanced to implement packages.

Why packages?  Packages enable module nesting and sibling module
imports.  'Til now, the python module namespace was flat, which
means every module had to have a unique name, in order to not
conflict with names of other modules on the load path.  Furthermore,
suites of modules could not be structurally affiliated with one
another.

With packages, a suite of, eg, email-oriented modules can include a
module named 'mailbox', without conflicting with the, eg, 'mailbox'
module of a shared-memory suite - 'email.mailbox' vs
'shmem.mailbox'.  Packages also enable modules within a suite to
load other modules within their package without having the package
name hard-coded.  Similarly, package suites of modules can be loaded
as a unit, by loading the package that contains them.

Usage: once installed (newimp.install(); newimp.revert() to revert to
the prior __import__ routine), 'import ...' and 'from ... import ...'
can be used to:

  - import modules from the search path, as before.

  - import modules from within other directory "packages" on the search
    path using a '.' dot-delimited nesting syntax.  The nesting is fully
    recursive.

    For example, 'import test.test_types' will import the test_types
    module within the 'test' package.  The calling environment would
    then access the module as 'test.test_types', which is the name of
    the fully-loaded 'test_types' module.  It is found contained within
    the stub (ie, only partially loaded) 'test' module, hence accessed as
    'test.test_types'.

  - import siblings from modules within a package, using '__.' as a shorthand
    prefix to refer to the parent package.  This enables referential
    transparency - package modules need not know their package name.

    The '__' package references are actually names assigned within
    modules, to refer to their containing package.  This means that
    variable references can be made to imported modules, or to variables
    defined via 'import ... from', also using the '__.var' shorthand
    notation.  This establishes a proper equivalence between the import
    reference '__.sibling' and the var reference '__.sibling'.  

  - import an entire package as a unit, by importing the package directory.
    If there is a module named '__main__.py' in the package, it controls the
    load.  Otherwise, all the modules in the dir, including packages, are
    inherently loaded into the package module's namespace.

    For example, 'import test' will load the modules of the entire 'test'
    package, at least until a test failure is encountered.

    In a package, a module with the name '__main__' has a special role.
    If present in a package directory, then it is loaded into the package
    module, instead of loading the contents of the directory.  This
    enables the __main__ module to control the load, possibly loading
    the entire directory deliberately (using 'import __', or even
    'from __ import *', to load all the module contents directly into the
    package module).

  - perform any combination of the above - have a package that contains
    packages, etc.

Modules have a few new attributes in support of packages.  As mentioned
above, '__' is a shorthand attribute denoting the modules' parent package,
also denoted in the module by '__package__'.  Additionally, modules have
associated with them a '__pkgpath__', a path by which sibling modules are
found.s   1.3i    s2   Pkg import module depends on optional "imp" modulei   s   SEARCH_ERRORs	   PY_SOURCEs   PY_COMPILEDs   C_EXTENSIONs
   PY_PACKAGEs   __main__s   __package__s   __s   __pkgpath__s
   __python__c    sl    ‚ d  ƒ k  }  „ … t o3 † y ‡ |  i a Wn ˆ t j
 o
 ‰ n Xn Š t |  _ ‹ d GHd S(   s„   Install newimp import_module() routine, for package support.

    newimp.revert() reverts to __import__ routine that was superceded.s(   Enhanced import functionality installed.N(   s   __builtin__s   origImportFuncs
   __import__s   AttributeErrors   import_module(   s   __builtin__s   /usr/lib/python/newimp.pys   installc    s9   Œ Ž d   t  o!  k }  ‘ t  |  _ ’ d GHn d S(   sZ   Revert to original __builtin__.__import__ func, if newimp.install() has
    been executed.s&   Original import routine back in place.N(   s   origImportFuncs   __builtin__s
   __import__(   s   __builtin__s   /usr/lib/python/newimp.pys   revertc   sÁ  ” ˜ d  ¥ t  d |  | o d | i p d f ƒ ª | p | o « t ƒ  \ } } n ­ t } } } } ± | oC ³ | | i t | i f \ }	 }
 } ´ |  } µ | d |  } nÝ · |  t d  t d j o+ º t }	 » t i }
 ¼ |  } ½ | } n– Ã |  t t ƒ d } Ä yR Å | t }	 Æ |	 i t }
 Ç |	 t j o È | } n Ê |	 i d | } Wn& Ë t j
 o Ì t  d ƒ Í n XÐ t i i | ƒ o) Ñ t  d | d ƒ Ò t i | } nQÕ t i | ƒ } Ö | o × t  d	 | ƒ n2 Ù t i | ƒ } Ú | o Û t  d
 | ƒ n Ü | oã Ý t |
 ƒ t  i! j o Þ |
 g }
 n ß t" | |
 | ƒ } à | o á t# d | ‚ n ä t$ | |	 ƒ } ç | d \ } } } } è t  d t( | d d | ƒ ë t) | | d | | ƒ } î t* | | i |
 |	 ƒ n ÷ | o& ù | | p | |  <ú | p | Snb ý | d j o þ | i i, ƒ  } n ÿ x. | d ÿ r! }  | i | | p | | <qŽW| Sd S(   sC   Primary service routine implementing 'import' with package nesting.s   import_module: seeking '%s'%ss    (in package %s)s    s   .i   s7   Can't identify parent package, package name, or pkgpaths   found s    already importeds   found builtin s   found frozen s   module '%s' not founds   found type i   s    - s   *i    N(.   s   notes   names   inPkgs   __name__s	   envLocalss
   envGlobalss   exteriors   Nones   modLists   theMods   absNms	   containers   __dict__s   PKG_PATHs   pkgs   pkgPaths   pkgNms   relNms   PKG_SHORT_NM_LENs   PKG_SHORT_NMs
   __python__s   syss   paths   lens   PKG_NMs   KeyErrors   moduless   has_keys   imps   init_builtins   init_frozens   types   typess
   StringTypes   find_modules   ImportErrors   register_module_nestings   modNms   modfs   tys   modess   load_modules   register_modules   fromss   keyss   item(   s   names	   envLocalss
   envGlobalss   fromss   inPkgs   modLists   theMods   absNms	   containers   pkgs   pkgPaths   pkgNms   relNms   modNms   modfs   paths   tys   items   /usr/lib/python/newimp.pys   import_modulec   s‰   d  t  |  ƒ t i j o |  i }  n xL t i t i g d r3 } y 	| |  =Wn 
t	 j
 o
 n XqK Wd S(   sA   Remove registration for a module, so import will do a fresh load.i    N(
   s   types   modules   typess
   ModuleTypes   __name__s   syss   moduless   stub_moduless   ms   KeyError(   s   modules   ms   /usr/lib/python/newimp.pys   unloadc   sN  d  g  } | o |  } n t i |  d ƒ } xý| d rð}  t | ƒ t	 i
 j p
 | | j o
 "qL n %| i | ƒ 't | ƒ d j oF +t | | ƒ } ,| o& -t d | d d ƒ .| g Sn nO4g  } | d } 6t | | ƒ } 7| o
 8qL n& :| i | ƒ ;| \ }	 }
 } } >xÔ | d d >rÃ } @| d t j o Ag  t f \ } } BPn C| o D| d | } n
 F| } Gt | | ƒ } H| o) I| i | ƒ K| \ }	 }
 } } n  Ng  t d f \ } } } OPq`WQ| o R| Sn qL WUt Sd S(   sb  Locate module NAME on PATH.  PATH is pathname string or a list of them.

    Note that up-to-date compiled versions of a module are preferred to plain
    source, and compilation is automatically performed when necessary and
    possible.

    Returns a list of the tuples returned by 'find_module_file' (cf), one for
    each nested level, deepest last.s   .i    i   s   using %si   s    N(   s   checkeds   absNms   names   strings   splitfieldss   expNms   paths   curPaths   types   typess
   StringTypes   appends   lens   find_module_files   gots   notes   gotLists
   nameAccumes   nms   files   fullPaths   tys	   components
   PY_PACKAGEs   None(   s   names   paths   absNms   checkeds   expNms   curPaths   gots   gotLists
   nameAccumes   nms   files   fullPaths   tys	   components   /usr/lib/python/newimp.pys   find_modules    c 
  sÛ  Wbd  dt  i | d ƒ d } f|  d d j o f|  d }  n hx€t ƒ  d hrp\ } } } it	 d |  | | d d ƒ j|  | | } ky lt | | ƒ } Wn mt j
 o oqY n Xq| t j oR st i i | ƒ o tt	 d | ƒ uqY n w| | | | | | f f Sn—z| t j oï |t	 d	 | d
 ƒ }| d } ~t i i | ƒ p$ t i | ƒ d t i | ƒ d j o t | | ƒ } n ‚| o$ t i | ƒ d t i | ƒ d j  o) …| t | d ƒ | d d t f f Sn ˆ| | | | | | f f Sn˜Š| t j o7t	 d | d
 ƒ Ž| d  }	 t i i |	 ƒ o1 t	 d | ƒ ‘| | | | | | f f SnÊ ’t i |	 ƒ d t i | ƒ d j oƒ “t	 d |	 ƒ ”t |	 | ƒ } •| o  –| | | | | | f f Sn3 ˜t	 d ƒ ™| t |	 d ƒ |	 d d t f f Sn œ| | | | | | f f SnQ ž| t j o4 Ÿt	 d | d
 ƒ  | | | | | | f f Sn £t d ‚ qY W¥t Sd S(   s¸  Find module file given dir PATHNAME and module NAME.

    If successful, returns quadruple consisting of a mod name, file object,
    PATHNAME for the found file, and a description triple as contained in the
    list returned by get_suffixes.

    Otherwise, returns None.

    Note that up-to-date compiled versions of a module are preferred to plain
    source, and compilation is automatically performed, when necessary and
    possible.s   .i   s   /i    s   trying s   ...i   s   Skipping non-dir match s   found source i   s   ci   s   rbs   .pycs   found compiled s   found pyc sans py: s   forced to try compiling: s)   failed compile - must use more recent .pys   rs   .pys   found extension s,   Unanticipated (new?) module type encounteredN(   s   strings   splitfieldss   modnames   relNms   pathNms   get_suffixess   suffs   modes   tys   notes   fullPaths   opens   modfs   IOErrors
   PY_PACKAGEs   oss   paths   isdirs	   PY_SOURCEs   pycs   existss   stats   compile_sources   PY_COMPILEDs   pys   C_EXTENSIONs   SystemErrors   None(
   s   pathNms   modnames   relNms   suffs   modes   tys   fullPaths   modfs   pycs   pys   /usr/lib/python/newimp.pys   find_module_filec   s<  ¨®d  µt  |  ƒ } ¶t i |  d ƒ d } ·| i } ¹| t	 j o ºt
 | | | i ƒ nÉ¼| t j o ½t | i d ƒ i ƒ  } ¾| d d !t i ƒ  j o ¿t d | i ‚ n Àt i | d ƒ } Át
 | | | i ƒ n:Ã| t j oU Äy Åt i | | | ƒ } Wn/ ÆÈt i d t t i ƒ | i f ‚ n XnÕ Ë| t j o´ Ít i i | d	 t ƒ o | i  t j o | i" | j o" Ñt
 | d	 t | | i ƒ nQ Ôt# | ƒ }	 Õx; |	 d Õr. }
 Öt& |
 | i' | i' t( | ƒ | i' |
 <qèWn Ýt d
 | ‚ ß| Sd S(   só   Load module NAME, type TYPE, from file FILE.

    Optional arg fromMod indicated the module from which the load is being done
    - necessary for detecting import of __ from a package's __main__ module.

    Return the populated module object.s   .i   s   rbi    i   s   bad magic number: i   s   %s (from %s)s   /s   Unimplemented import type: %sN()   s   procure_modules   names   theMods   strings   splitfieldss   nameTails   theFiles   thePaths   tys	   PY_SOURCEs	   exec_intos   PY_COMPILEDs   opens   reads   pycs   imps	   get_magics   ImportErrors   marshals   loadss   codes   C_EXTENSIONs   load_dynamics   syss   exc_types   strs	   exc_values
   PY_PACKAGEs   oss   paths   existss   PKG_MAIN_NMs   __name__s   fromMods   __s   mod_prospectss	   prospectss   items   import_modules   __dict__s   None(   s   names   tys   theFiles   fromMods   theMods   nameTails   thePaths   pycs   codes	   prospectss   items   /usr/lib/python/newimp.pys   load_modulec   s³   áâd  èys ée  |  ƒ e i j o êe | | i | i ƒ n: ëe  |  ƒ e i e i	 g j o ì|  | i | i Un Wn, íïe
 i d e e
 i ƒ | f ‚ n Xd S(   sE   Helper for load_module, execfile/exec path or code OBJ within MODULE.s   %s (from %s)N(   s   types   objs   typess   FileTypes   execfiles   paths   modules   __dict__s   CodeTypes
   StringTypes   syss   exc_types   strs	   exc_value(   s   objs   modules   paths   /usr/lib/python/newimp.pys	   exec_intoc 	  sF  óûd   t  i |  ƒ } d d g } t ƒ  } g  } xõ | d rè } | | j o
 qL n xÂ | d rµ } d t
 | ƒ } | d j o= 	t  i i t  i i |  | ƒ ƒ o 
| i | ƒ n nO | | | j o: | |  } | | j o | i | ƒ n Pn q{ WqL W| Sd S(   sZ  Return a list of prospective modules within directory PATH.

    We actually return the distinct names resulting from stripping the dir
    entries (excluding '.' and '..') of their suffixes (as represented by
    'get_suffixes').

    (Note that matches for the PY_PACKAGE type with null suffix are
    implicitly constrained to be directories.)s   .s   ..i    i   N(   s   oss   listdirs   paths   dirLists   excludess   sorted_suffixess   sortedSuffss   entriess   items   suffs   lens   subs   isdirs   joins   appends   it(	   s   paths   dirLists   excludess   sortedSuffss   entriess   items   suffs   subs   its   /usr/lib/python/newimp.pys   mod_prospectsc   s{   d  t  i i |  ƒ o t  i |  } n= t  i i |  ƒ o t  i |  } n t i |  ƒ } | Sd S(   sr   Return an established or else new module object having NAME.

    First checks sys.modules, then sys.stub_modules.N(   s   syss   moduless   has_keys   names   its   stub_moduless   news   module(   s   names   its   /usr/lib/python/newimp.pys   procure_modulec 	  s<  !#d  $t  } %x|  d %r\ } } } } &t i | d ƒ d } 't
 i i | ƒ o- )t
 i | } *| | i | <+| } n… ,t
 i i | ƒ o- -t
 i | } .| | i | </| } nB 1t | ƒ } 3t | | | | d ƒ 4| | i | <5| } 6| o 7| } n q W8| Sd S(   sb   Given a find_module()-style NESTING and a parent PACKAGE, register
    components as stub modules.i    s   .i   N(   s   Nones	   containers   modLists	   stubModNms   stubModFs   stubPaths   stubTys   strings   splitfieldss	   relStubNms   syss   moduless   has_keys   stubMods   pkgs   __dict__s   stub_moduless   procure_modules   register_module(	   s   modLists   pkgs	   containers	   stubModNms   stubModFs   stubPaths   stubTys	   relStubNms   stubMods   /usr/lib/python/newimp.pys   register_module_nestingc   sŠ   :;d  =| o >|  t i | <n8 @|  t i | <At i i | ƒ o Bt i | =n C| |  _ |  i	 t
 <D| |  i	 t <d S(   s?   Properly register MODULE, w/ name, path, package, opt, as stub.N(   s   stubs   theMods   syss   stub_moduless   names   moduless   has_keys   packages   __s   __dict__s   PKG_NMs   paths   PKG_PATH(   s   theMods   names   paths   packages   stubs   /usr/lib/python/newimp.pys   register_modulec   s_  GPd  R|  d  d } Sy Tt | d ƒ } Wn. Ut j
 o Vt d | ƒ Wt Sn XXt i |  ƒ d } Y| i d ƒ Zy¬ [| i t i ƒ  ƒ \| i d d ƒ ^t | i ƒ  |  d ƒ } _t i | | ƒ `| i d d ƒ a| i t i | ƒ d	 ƒ b| i ƒ  c| i ƒ  d| SWn et j
 o ft Sn Xd
 S(   sš  Given python code source path and file obj, Create a compiled version.

    Return path of compiled version, or None if file creation is not
    successful.  (Compilation errors themselves are passed without restraint.)

    This is an import-private interface, and not well-behaved for general use.
    
    In particular, we presume the validity of the sourcePath, and that it
    includes a '.py' extension.i   s   .pycs   wbs   write permission denied to i   i    s   execi   i   N(   s
   sourcePaths   compiledPaths   opens   compiledFiles   IOErrors   notes   Nones   oss   stats   mtimes
   sourceFiles   seeks   writes   imps	   get_magics   compiles   reads   compileds   marshals   dumps   dumpss   flushs   close(   s
   sourcePaths
   sourceFiles   compiledPaths   compiledFiles   mtimes   compileds   /usr/lib/python/newimp.pys   compile_sourcec   s¯   ild  ng  } o| o | i t ƒ o pt | | t d ƒ } n q|  o |  i t ƒ o rt | |  t d ƒ } n s| o tt t d | ƒ n u| Sd S(   s‡   Determine import search path extension vis-a-vis __pkgpath__ entries.

    local dict __pkgpath__ will preceed global dict __pkgpath__.s   globals   locals    extension: N(   s   pathadds   globalss   has_keys   PKG_PATHs   PrependPaths   localss   note(   s   localss   globalss   pathadds   /usr/lib/python/newimp.pys   PathExtensionc   s|   w{d  t  | ƒ t i j o | g |  SnC ‚t  | ƒ t i j o ‚| |  Sn „d | t f GH…|  Sd S(   s·   Return copy of PATH list with string or list-of-strings PRE prepended.

    If PRE is neither a string nor list-of-strings, print warning that
    locality WHENCE has malformed value.s   **Ignoring '%s' bad %s value**N(   s   types   pres   typess
   StringTypes   paths   ListTypes   whences   PKG_PATH(   s   paths   pres   whences   /usr/lib/python/newimp.pys   PrependPathc    sà   ˆ™d  ž t  o ¡t  Sn» ¤d d t f g a  ¥t }  } ¦xk t i ƒ  d ¦rX } §| d d j o ¨| }  n2 ©| d d j o ª| } n ¬t  i | ƒ qV W­t  i | ƒ ®t  i |  ƒ ¯t  Sd S(   sN  Produce a list of triples, each describing a type of import file.

    Triples have the form '(SUFFIX, MODE, TYPE)', where:

    SUFFIX is a string found appended to a module name to make a filename for
    that type of import file.

    MODE is the mode string to be passed to the built-in 'open' function - "r"
    for text files, "rb" for binary.

    TYPE is the file type:

     PY_SOURCE:		python source code,
     PY_COMPILED:	byte-compiled python source,
     C_EXTENSION:	compiled-code object file,
     PY_PACKAGE:	python library directory, or
     SEARCH_ERROR:	no module found. s    s   ri    s   .pys   .pycN(	   s   got_suffixess
   PY_PACKAGEs   Nones   pys   pycs   imps   get_suffixess   suffs   append(   s   pys   pycs   suffs   /usr/lib/python/newimp.pys   get_suffixesc    sw   ³´d  º»t  oT ¼x* t ƒ  d ¼r }  ½t  i |  d ƒ q' W¿t  i d „  ƒ Át  i ƒ  n Ât  Sd S(   sD   Helper function ~efficiently~ tracks sorted list of module suffixes.i    c   sA   ¿t  |  ƒ t  | ƒ j o d p t  |  ƒ t  | ƒ j  o d S(   Ni   (   s   lens   xs   y(   s   xs   ys   /usr/lib/python/newimp.pys   <lambda>N(   s   sortedSuffss   get_suffixess   items   appends   sorts   reverse(   s   items   /usr/lib/python/newimp.pys   sorted_suffixesc    s´   ÊÍd  Ïd }  Ðy Ð|  ‚ WnŠ Ñ|  j
 o{ Òt i i i } Ó| i o Ó| i } n Ô| i | i f \ } } Õ| | j o Öt
 } n ×| | f Sn Xd S(   s€   Return dyad containing locals and globals of caller's caller.

    Locals will be None if same as globals, ie env is global env.s   bogusN(   s   boguss   syss   exc_tracebacks   tb_frames   f_backs   ats	   f_globalss   f_localss   globalss   localss   None(   s   boguss   ats   globalss   localss   /usr/lib/python/newimp.pys   exteriorc   s6   ÜÝt  | j o Ýt i i d |  d ƒ n d  S(   Ns	   (import: s   )
(   s   VERBOSEs	   thresholds   syss   stderrs   writes   msg(   s   msgs	   thresholds   /usr/lib/python/newimp.pys   notei   s   TestDirHierc     sf   ßd  Z  âd  äd d „ Z òd „  Z õe d „ Z d d „ Z e d „ Z d „  Z RS(	   sµ   Populate a transient directory hierarchy according to a definition
    template - so we can create package/module hierarchies with which to
    exercise the new import facilities...c   sÓ   äçd  èd |  _ éd } êxD êt i i t i i | |  i t | ƒ ƒ ƒ o ë| d } q% Wìt	 t
 _ í|  i t | ƒ |  _ ît i i | |  i ƒ |  _ ï|  i |  i ƒ ð|  i | ƒ d S(   s—   Establish a dir hierarchy, according to TEMPLATE, that will be
	deleted upon deletion of this object (or deliberate invocation of the
	__del__ method).s   tdh_i    i   N(   s   selfs   PKG_NMs   revs   oss   paths   existss   joins   wheres   strs   Nones   syss   exc_tracebacks   roots	   createDirs   adds   template(   s   selfs   templates   wheres   revs   /usr/lib/python/newimp.pys   __init__s   /var/tmpc   s   òód  ô|  i ƒ  d S(   s   Cleanup the test hierarchy.N(   s   selfs   remove(   s   selfs   /usr/lib/python/newimp.pys   __del__c   sñ   õüd  ý| t j o ý|  i  } n þx½ | i ƒ  d þrª \ } } ÿt i i	 | | ƒ }  t | ƒ t i j o |  i | | ƒ nW t | ƒ t i j o' |  i | ƒ |  i | | ƒ n t d t | ƒ ‚ q< Wd S(   sè   Populate directory according to template dictionary.

	Keys indicate file names, possibly directories themselves.

	String values dictate contents of flat files.

	Dictionary values dictate recursively embedded dictionary templates.i    s   invalid file-value type, %sN(   s   roots   Nones   selfs   templates   itemss   keys   vals   oss   paths   joins   names   types   typess
   StringTypes
   createFiles   DictionaryTypes	   createDirs   adds
   ValueError(   s   selfs   templates   roots   keys   vals   names   /usr/lib/python/newimp.pys   addc   s   d  	t  i i |  i | ƒ } 
t t _ t  i i	 | ƒ o$ d | GHt  i
 d | ƒ n t d | ‚ d S(   s;   Dispose of the NAME (or keys in dictionary), using 'rm -r'.s   (TestDirHier: deleting %s)s   rm -r s   can't remove non-existent N(   s   oss   paths   joins   selfs   roots   names   Nones   syss   exc_tracebacks   existss   systems   IOError(   s   selfs   names   /usr/lib/python/newimp.pys   removes    c   sa   d  t  | d ƒ } | o | i d | d ƒ n | i | ƒ | i d S(   s\   Establish file NAME with CONTENTS.

	If no contents specfied, contents will be 'print NAME'.s   ws   print 's   '
N(   s   opens   names   fs   contentss   writes   close(   s   selfs   names   contentss   fs   /usr/lib/python/newimp.pys
   createFilec   s!   d  t  i | d ƒ Sd S(   s   Create dir with NAME.ií  N(   s   oss   mkdirs   name(   s   selfs   names   /usr/lib/python/newimp.pys	   createDir(   s   __doc__s   __init__s   __del__s   Nones   adds   removes
   createFiles	   createDir(    s   /usr/lib/python/newimp.pys   TestDirHierc   s’    !"d Gd e  t ƒ d G|  Gd GH#t d a $t t d j o %d Gt GH&d  Sn	 (d GH)x  | d )r } *| | | Uqt Wd  S(	   Ns   Import Test:s   (s   )s   ...i   s    ... skipping til tests    i    (   s   strs   atTests   msgs
   skipToTests   execLists   stmts   localss   globals(   s   msgs   execLists   localss   globalss   stmts   /usr/lib/python/newimp.pys   testExecc   s¥  ,1d  3k  } 56|  a 7e } 9d „  } Dd „  } Pd e d UQe e d ƒ e	 ƒ  f \ } } Sy Te i Wn" Ue j
 o Vg  e _ n XWe i } [y( \e e _ ]| i } ^e i }	 Wn _e j
 o `e } n Xazbg  }
 g  } cdt d f \ } a ee | _ g| o; hx1 | d hr# } i| | ƒ j| i | ƒ qPWn le d e i i ƒ  d d e i i ƒ  d g | | ƒ oy. pd	 } qe d
 | d | g | | ƒ Wn/ te j
 o  ue d d g | | ƒ n Xve } wx\ d d d d d d d d d d g
 d wr1 } y| e i i ƒ  j o z| } {Pn qOW|| o( }e d | d | d g | | ƒ n	 d GH‡d g e i e _ ‰d d d d d d  d! g } e d" | | | ƒ “d# d$ d% d d g } ˜e d& | | | ƒ œh  d' d( <h  d) d* <h  d+ d, <d- <d. <}  d/ d0 d1 d2 d3 d4 d5 f d6 d7 d8 d d g } ¬e d9 | | | ƒ ±d: | d. d* <²d; d< d d= d> d g } ¸e d? | | | ƒ »e e _ Wd ½¾e i o ¿d@ GHn	 ÁdA GHÂ| a Ãd a ÄdB a$ Å|	 e _ Æx# |
 d Ær } Æ| i ƒ  ~ q`WÇ| o È| | _ n
 Ê| ` Xd S(C   sÉ   Exercise import functionality, creating a transient dir hierarchy for
    the purpose.

    We actually install the new import functionality, temporarily, resuming the
    existing function on cleanup.c   s˜   9:t  i i |  ƒ o ;d |  GHnk =t  i |  } >| i i t ƒ o ?d |  t f GHn A| i i t ƒ o Bd |  t f GHn d  S(   Ns    import test: missing module "%s"s1   import test: module "%s" missing %s pkg shorthands0   import test: module "%s" missing %s package path(   s   syss   moduless   has_keys   mods   modMods   __dict__s   PKG_SHORT_NMs   PKG_PATH(   s   mods   localss   globalss   modMods   /usr/lib/python/newimp.pys   confPkgVarsc   sÃ   DEd  Fd } Gt |  ƒ t i j o H|  } n* It |  ƒ t i j o J| i } n KxW t i	 i
 ƒ  t i i
 ƒ  d Kr4 } L| d t | ƒ !| j o Mt | ƒ n q„ Wd S(   s/   Unload module and offspring submodules, if any.s    i    N(   s   modMods   types   mods   typess
   StringTypes   modNms
   ModuleTypes   __name__s   syss   moduless   keyss   stub_moduless   subjs   lens   unload(   s   mods   modMods   modNms   subjs   /usr/lib/python/newimp.pys
   unloadFulls   import Ns	   .__dict__i   i    s   already imported module: %ss   no_sirree_does_not_exists   non-existent module: %ss   oks   passs   Complexs   UserDicts   UserLists   calendars   cmds   diss   mailboxs   profiles   randoms   rfc822s   not-yet loaded module: %ss   modules.append(got)s6   Import Test: couldn't find unimported module from lists   /var/tmps7   hier1 = TestDirHier({'a.py': 'print "a.py executing"'})s   hiers.append(hier1)s   root = hier1.PKG_NMs   exec 'import ' + roots   testMods.append(root)s8   confPkgVars(sys.modules[root].__name__, locals, globals)s;   confPkgVars(sys.modules[root].__name__+'.a',locals,globals)s&   trivial package, with one module, a.pys6   hier2 = TestDirHier({'ref.py': 'print "Pkg __:", __'})s   root = hier2.PKG_NMs   hiers.append(hier2)s7   trivial package, with module that has pkg shorthand refs   print "ref.py loading..."s   ref.pys   print "s1.py, in pkg:", __s   s1.pys   print "sub1.py"s   sub1.pys   subsuites   suites   print """%s
%s
%s
%s
%s
%s"""s   .../s        ref.py			"ref.py loading..."s
       suite/s(   	    s1.py 		"s1.py, in pkg: xxxx.suite"s   	    subsuite/s   		sub1.py		"sub1.py" s$   hier3 = TestDirHier(complexTemplate)s   root = hier3.PKG_NMs   hiers.append(hier3)s   Significantly nestled package:s   import __.subsuites$   hier4 = TestDirHier(complexTemplate)s   root = hier4.PKG_NMs   hiers.append(hier4)s    exec 'import %s.suite.s1' % roots8   Similar structure, but suite/s1.py imports '__.subsuite's#    ** Import test FAILURE... cleanup.s    Import test SUCCESS... cleanupi   (&   s   __builtin__s   numbers
   skipToTests   Nones   hiers   confPkgVarss
   unloadFulls   __name__s   evals   varss   globalss   localss   __main__s   testModss   AttributeErrors   syss   exc_tracebacks
   __import__s	   wasImports   paths   wasPaths   hierss   moduless   VERBOSEs
   wasVerboses   import_modules   ms   removes   testExecs   keyss	   no_sirrees   ImportErrors   gots   mods   stmtss   complexTemplates   atTests   h(   s   numbers   __builtin__s   hiers   confPkgVarss
   unloadFulls   globalss   localss   testModss	   wasImports   wasPaths   hierss   moduless
   wasVerboses   ms	   no_sirrees   gots   mods   stmtss   complexTemplates   hs   /usr/lib/python/newimp.pys   testN(<   s   __doc__s   __version__s   VERBOSEs   syss   strings   regexs   typess   oss   marshals   news   __main__s   imps   ImportErrors   SEARCH_ERRORs	   PY_SOURCEs   PY_COMPILEDs   C_EXTENSIONs
   PY_PACKAGEs   modess   stub_moduless   AttributeErrors   PKG_MAIN_NMs   PKG_NMs   PKG_SHORT_NMs   lens   PKG_SHORT_NM_LENs   PKG_PATHs
   __python__s   moduless   paths   __dict__s   Nones   origImportFuncs   installs   reverts   import_modules   unloads   find_modules   find_module_files   load_modules	   exec_intos   mod_prospectss   procure_modules   register_module_nestings   register_modules   compile_sources   PathExtensions   PrependPaths   got_suffixess   get_suffixess   sortedSuffss   sorted_suffixess   exteriors   notes   TestDirHiers
   skipToTests   atTests   testExecs   tests   __name__(    s   /usr/lib/python/newimp.pys   ?