Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 2405:4593d09e534d
pick a non-conflicting module name when loading an extension
prefix the module name by 'hgext_' so that it doesn't conflict
with any core python module (for example bisect -> hgext_bisect)
fix issue271
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Wed, 07 Jun 2006 18:33:15 +0200 |
parents | 2e90024e1471 |
children | 4a678e408ce5 |
comparison
equal
deleted
inserted
replaced
2404:ffc3b2f1ab6a | 2405:4593d09e534d |
---|---|
3236 | 3236 |
3237 external = [] | 3237 external = [] |
3238 for x in u.extensions(): | 3238 for x in u.extensions(): |
3239 try: | 3239 try: |
3240 if x[1]: | 3240 if x[1]: |
3241 mod = imp.load_source(x[0], x[1]) | 3241 # the module will be loaded in sys.modules |
3242 # choose an unique name so that it doesn't | |
3243 # conflicts with other modules | |
3244 module_name = "hgext_%s" % x[0].replace('.', '_') | |
3245 mod = imp.load_source(module_name, x[1]) | |
3242 else: | 3246 else: |
3243 def importh(name): | 3247 def importh(name): |
3244 mod = __import__(name) | 3248 mod = __import__(name) |
3245 components = name.split('.') | 3249 components = name.split('.') |
3246 for comp in components[1:]: | 3250 for comp in components[1:]: |