view mercurial/demandload.py @ 630:a58af3932cee

Remove debug print from locate code. # HG changeset patch # User Bryan O'Sullivan <bos@serpentine.com> # Node ID 5240abb57899b745f2e6465be29d9d54c4777364 # Parent 13b74665cbdf735a91f231956d0fe73e446340ea Remove debug print from locate code. Index: hg/mercurial/commands.py ===================================================================
author Bryan O'Sullivan <bos@serpentine.com>
date Tue, 05 Jul 2005 18:22:28 -0800
parents 3db700146536
children f3abe0bdccdd
line wrap: on
line source

def demandload(scope, modules):
    class d:
        def __getattr__(self, name):
            mod = self.__dict__["mod"]
            scope = self.__dict__["scope"]
            scope[mod] = __import__(mod, scope, scope, [])
            return getattr(scope[mod], name)

    for m in modules.split():
        dl = d()
        dl.mod = m
        dl.scope = scope
        scope[m] = dl