def _switchToVersion(requestedVersion):
 if (not os.path.exists(prefs.paths['userPrefsDir'])):
  os.mkdir(prefs.paths['userPrefsDir'])
 try:
  if os.path.exists(VERSIONSDIR):
   _checkout(requestedVersion)
  else:
   _clone(requestedVersion)
 except (CalledProcessError, OSError) as e:
  if ('did not match any file(s) known to git' in e.output):
   msg = _translate("'{}' is not a valid PsychoPy version.")
   logging.error(msg.format(requestedVersion))
   raise RuntimeError(msg)
  else:
   raise
 sys.path = ([VERSIONSDIR] + sys.path)
 logging.exp('Prepended `{}` to sys.path'.format(VERSIONSDIR))

def _switchToVersion ( requestedVersion ) : if ( not os . path . exists ( prefs . paths [ 'userPrefsDir' ] ) ) : os . mkdir ( prefs . paths [ 'userPrefsDir' ] ) try : if os . path . exists ( VERSIONSDIR ) : _checkout ( requestedVersion ) else : _clone ( requestedVersion ) except ( CalledProcessError , OSError ) as e : if ( 'did not match any file(s) known to git' in e . output ) : msg = _translate ( "'{}' is not a valid PsychoPy version." ) logging . error ( msg . format ( requestedVersion ) ) raise RuntimeError ( msg ) else : raise sys . path = ( [ VERSIONSDIR ] + sys . path ) logging . exp ( 'Prepended `{}` to sys.path' . format ( VERSIONSDIR ) )
checkout the requested version .