(pkgname, exportdefs, attr=dict())
initialize given package from the export definitions.
initialize given package from the export definitions.
initialize given package from the export definitions .
def initpkg(pkgname, exportdefs, attr=dict()):
    """ initialize given package from the export definitions. """
    oldmod = sys.modules.get(pkgname)
    d = {}
    f = getattr(oldmod, '__file__', None)
    if f:
        f = os.path.abspath(f)
    d['__file__'] = f
    if hasattr(oldmod, '__version__'):
        d['__version__'] = oldmod.__version__
    if hasattr(oldmod, '__loader__'):
        d['__loader__'] = oldmod.__loader__
    if hasattr(oldmod, '__path__'):
        d['__path__'] = [os.path.abspath(p) for p in oldmod.__path__]
    if '__doc__' not in exportdefs and getattr(oldmod, '__doc__', None):
        d['__doc__'] = oldmod.__doc__
    d.update(attr)
    if hasattr(oldmod, "__dict__"):
        oldmod.__dict__.update(d)
    mod = ApiModule(pkgname, exportdefs, implprefix=pkgname, attr=d)
    sys.modules[pkgname]  = mod
def initpkg ( pkgname , exportdefs , attr = dict ( ) ) : oldmod = sys . modules . get ( pkgname ) d = { } f = getattr ( oldmod , '__file__' , None ) if f : f = os . path . abspath ( f ) d [ '__file__' ] = f if hasattr ( oldmod , '__version__' ) : d [ '__version__' ] = oldmod . __version__ if hasattr ( oldmod , '__loader__' ) : d [ '__loader__' ] = oldmod . __loader__ if hasattr ( oldmod , '__path__' ) : d [ '__path__' ] = [ os . path . abspath ( p ) for p in oldmod . __path__ ] if '__doc__' not in exportdefs and getattr ( oldmod , '__doc__' , None ) : d [ '__doc__' ] = oldmod . __doc__ d . update ( attr ) if hasattr ( oldmod , "__dict__" ) : oldmod . __dict__ . update ( d ) mod = ApiModule ( pkgname , exportdefs , implprefix = pkgname , attr = d ) sys . modules [ pkgname ] = mod