Commits

Michał Górny committed b120683

Reorder GetVCS() to make exceptions clearer.

  • Participants
  • Parent commits 2625bb6

Comments (0)

Files changed (1)

File smartliverebuild/vcs/__init__.py

 		if allowed and eclassname not in allowed:
 			vcs_cache[eclassname] = None
 		else:
+			modname = 'smartliverebuild.vcs.%s' % eclassname.replace('-', '_')
 			try:
-				modname = 'smartliverebuild.vcs.%s' % eclassname.replace('-', '_')
 				mod = __import__(modname, {}, {}, ['.'], 0)
+			except ImportError:
+				vcs_cache[eclassname] = None
+			else:
 				for k in dir(mod):
 					modvar = getattr(mod, k)
 					if issubclass(modvar, VCSSupport) and \
 						break
 				else:
 					raise ImportError('Unable to find a matching class in %s' % mod)
-			except ImportError:
-				vcs_cache[eclassname] = None
 
 	return vcs_cache[eclassname]