def generate_authors():
 jenkins_email = 'jenkins@review.(openstack|stackforge).org'
 old_authors = 'AUTHORS.in'
 new_authors = 'AUTHORS'
 if (not os.getenv('SKIP_GENERATE_AUTHORS')):
  if os.path.isdir('.git'):
   git_log_cmd = (("git log --format='%aN <%aE>' | sort -u | egrep -v '" + jenkins_email) + "'")
   changelog = _run_shell_command(git_log_cmd)
   mailmap = parse_mailmap()
   with open(new_authors, 'w') as new_authors_fh:
    new_authors_fh.write(canonicalize_emails(changelog, mailmap))
    if os.path.exists(old_authors):
     with open(old_authors, 'r') as old_authors_fh:
      new_authors_fh.write(('\n' + old_authors_fh.read()))
 else:
  open(new_authors, 'w').close()

def generate_authors ( ) : jenkins_email = 'jenkins@review.(openstack|stackforge).org' old_authors = 'AUTHORS.in' new_authors = 'AUTHORS' if ( not os . getenv ( 'SKIP_GENERATE_AUTHORS' ) ) : if os . path . isdir ( '.git' ) : git_log_cmd = ( ( "git log --format='%aN <%aE>' | sort -u | egrep -v '" + jenkins_email ) + "'" ) changelog = _run_shell_command ( git_log_cmd ) mailmap = parse_mailmap ( ) with open ( new_authors , 'w' ) as new_authors_fh : new_authors_fh . write ( canonicalize_emails ( changelog , mailmap ) ) if os . path . exists ( old_authors ) : with open ( old_authors , 'r' ) as old_authors_fh : new_authors_fh . write ( ( '\n' + old_authors_fh . read ( ) ) ) else : open ( new_authors , 'w' ) . close ( )
create authors file using git commits .