view mercurial/demandload.py @ 551:b460a2fd8bb7

[PATCH] bdiff/mpatch under MSVC -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] bdiff/mpatch under MSVC From: K Thananchayan <thananck@yahoo.com> MSVC (6.0) environment does not have 'stdint.h' and does not provide `inline' qualifier. The following patch is needed to make mecurial installable under MSVC. manifest hash: a5b64235acced16cb451faa698922559fec4e573 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCxPapywK+sNU5EO8RAmRnAKCt9cOASaIsYB6kNUDSIStR1DmY4gCgnXlL Jf0nMmGEkoyXtB0eV+fLzJU= =fKD5 -----END PGP SIGNATURE-----
author mpm@selenic.com
date Thu, 30 Jun 2005 23:54:17 -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