parameters: (args)
docstring: This is our main entrypoint for the checkout command.
docstring_summary: This is our main entrypoint for the checkout command.
docstring_tokens: This is our main entrypoint for the checkout command .
function: def checkout(args):
      """
      This is our main entrypoint for the checkout command.
      """
      package_name_version = get_requirements()
      SOURCE_DIR = USERLAND_HERE.parent
      with SOURCE_DIR:
          ls_source = [str(f) for f in SOURCE_DIR.ls()]
          uncommitted = []
  
          for package_name, version in package_name_version.items():
              if package_name in ls_source:
                  with SOURCE_DIR/package_name:
                      if check_for_uncommitted():
                          uncommitted.append(package_name)
  
          if len(uncommitted):
              write("We have uncommitted changes in {}".format(
                  ", ".join(uncommitted)
              ))
              write('Abandonning attempt to check out to requirements.txt')
              return
  
          for package_name, version in package_name_version.items():
              if package_name in ls_source:
                  with SOURCE_DIR/package_name:
                      write("checking out {0} to {1}".format(
                          package_name, version
                      ))
                      os.system("git checkout {}".format(version))
                      os.system("python setup.py develop")
              else:
                  write('Unable to checkout versions from requirements')
                  write('{0} is missing'.format(package_name))
                  return
function_tokens: def checkout ( args ) : package_name_version = get_requirements ( ) SOURCE_DIR = USERLAND_HERE . parent with SOURCE_DIR : ls_source = [ str ( f ) for f in SOURCE_DIR . ls ( ) ] uncommitted = [ ] for package_name , version in package_name_version . items ( ) : if package_name in ls_source : with SOURCE_DIR / package_name : if check_for_uncommitted ( ) : uncommitted . append ( package_name ) if len ( uncommitted ) : write ( "We have uncommitted changes in {}" . format ( ", " . join ( uncommitted ) ) ) write ( 'Abandonning attempt to check out to requirements.txt' ) return for package_name , version in package_name_version . items ( ) : if package_name in ls_source : with SOURCE_DIR / package_name : write ( "checking out {0} to {1}" . format ( package_name , version ) ) os . system ( "git checkout {}" . format ( version ) ) os . system ( "python setup.py develop" ) else : write ( 'Unable to checkout versions from requirements' ) write ( '{0} is missing' . format ( package_name ) ) return