Support foo@bar notation as demandload module spec.
authorShun-ichi GOTO <shunichi.goto@gmail.com>
Tue, 22 Aug 2006 14:31:56 +0900
changeset 2993 985594e891b8
parent 2967 eef469259745
child 2994 94def4db6cd4
Support foo@bar notation as demandload module spec.
mercurial/packagescan.py
--- a/mercurial/packagescan.py	Sun Aug 20 23:52:52 2006 -0500
+++ b/mercurial/packagescan.py	Tue Aug 22 14:31:56 2006 +0900
@@ -25,6 +25,7 @@
     """ fake demandload function that collects the required modules
         foo            import foo
         foo bar        import foo, bar
+        foo@bar        import foo as bar
         foo.bar        import foo.bar
         foo:bar        from foo import bar
         foo:bar,quux   from foo import bar, quux
@@ -38,6 +39,8 @@
         except:
             module = m
             fromlist = []
+        if '@' in module:
+            module, as_ = module.split('@')
         mod = __import__(module, scope, scope, fromlist)
         if fromlist == []:
             # mod is only the top package, but we need all packages