Mercurial > public > mercurial-scm > hg-stable
diff mercurial/packagescan.py @ 2509:6350b01d173f
merge with wsgi changes.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Tue, 27 Jun 2006 00:10:41 -0700 |
parents | 976b6b2a1613 |
children | c4325f0a9b91 |
line wrap: on
line diff
--- a/mercurial/packagescan.py Tue Jun 27 00:09:37 2006 -0700 +++ b/mercurial/packagescan.py Tue Jun 27 00:10:41 2006 -0700 @@ -60,8 +60,16 @@ if type(scope[f]) == types.ModuleType: requiredmodules[scope[f].__name__] = 1 +class SkipPackage(Exception): + def __init__(self, reason): + self.reason = reason + +scan_in_progress = False + def scan(libpath,packagename): """ helper for finding all required modules of package <packagename> """ + global scan_in_progress + scan_in_progress = True # Use the package in the build directory libpath = os.path.abspath(libpath) sys.path.insert(0,libpath) @@ -85,7 +93,11 @@ tmp = {} mname,ext = os.path.splitext(m) fullname = packagename+'.'+mname - __import__(fullname,tmp,tmp) + try: + __import__(fullname,tmp,tmp) + except SkipPackage, inst: + print >> sys.stderr, 'skipping %s: %s' % (fullname, inst.reason) + continue requiredmodules[fullname] = 1 # Import all extension modules and by that run the fake demandload for m in extmodulefiles: