@contextmanager
def use_venv(pyversion):
 pyversion = str(pyversion)
 if (pyversion == '2'):
  (yield)
 elif (pyversion == '3'):
  oldvenv = env.virtualenv
  env.virtualenv = 'virtualenv -p /usr/bin/python3'
  (yield)
  env.virtualenv = oldvenv
 else:
  raise ValueError(("pyversion must be one of '2' or '3', not %s" % pyversion))

@ contextmanager def use_venv ( pyversion ) : pyversion = str ( pyversion ) if ( pyversion == '2' ) : ( yield ) elif ( pyversion == '3' ) : oldvenv = env . virtualenv env . virtualenv = 'virtualenv -p /usr/bin/python3' ( yield ) env . virtualenv = oldvenv else : raise ValueError ( ( "pyversion must be one of '2' or '3', not %s" % pyversion ) )
change make_virtualenv to use a given cmd pyversion should be 2 or 3 .