def sign_file(file_obj, server):
 endpoint = get_endpoint(server)
 if (not endpoint):
  log.info(u'Not signing file {0}: no active endpoint'.format(file_obj.pk))
  return
 if (not os.path.exists(file_obj.file_path)):
  log.info(u"File {0} doesn't exist on disk".format(file_obj.file_path))
  return
 if (file_obj.version.addon.guid in settings.HOTFIX_ADDON_GUIDS):
  log.info(u'Not signing file {0}: addon is a hotfix'.format(file_obj.pk))
  return
 if file_obj.is_multi_package:
  log.info(u'Not signing file {0}: multi-package XPI'.format(file_obj.pk))
  return
 if (not supports_firefox(file_obj)):
  log.info(u'Not signing version {0}: not for a Firefox version we support'.format(file_obj.version.pk))
  return
 cert_serial_num = unicode(call_signing(file_obj, endpoint))
 size = storage.size(file_obj.file_path)
 file_obj.update(cert_serial_num=cert_serial_num, hash=file_obj.generate_hash(), is_signed=True, size=size)
 log.info(u'Signing complete for file {0}'.format(file_obj.pk))
 return file_obj

def sign_file ( file_obj , server ) : endpoint = get_endpoint ( server ) if ( not endpoint ) : log . info ( u'Not signing file {0}: no active endpoint' . format ( file_obj . pk ) ) return if ( not os . path . exists ( file_obj . file_path ) ) : log . info ( u"File {0} doesn't exist on disk" . format ( file_obj . file_path ) ) return if ( file_obj . version . addon . guid in settings . HOTFIX_ADDON_GUIDS ) : log . info ( u'Not signing file {0}: addon is a hotfix' . format ( file_obj . pk ) ) return if file_obj . is_multi_package : log . info ( u'Not signing file {0}: multi-package XPI' . format ( file_obj . pk ) ) return if ( not supports_firefox ( file_obj ) ) : log . info ( u'Not signing version {0}: not for a Firefox version we support' . format ( file_obj . version . pk ) ) return cert_serial_num = unicode ( call_signing ( file_obj , endpoint ) ) size = storage . size ( file_obj . file_path ) file_obj . update ( cert_serial_num = cert_serial_num , hash = file_obj . generate_hash ( ) , is_signed = True , size = size ) log . info ( u'Signing complete for file {0}' . format ( file_obj . pk ) ) return file_obj
sign a file .