def annotate_webext_incompatibilities(results, file_, addon, version_string, channel):
 from .utils import find_previous_version
 previous_version = find_previous_version(addon, file_, version_string, channel)
 if (not previous_version):
  return results
 is_webextension = results['metadata'].get('is_webextension', False)
 was_webextension = (previous_version and previous_version.is_webextension)
 if (is_webextension and (not was_webextension)):
  results['is_upgrade_to_webextension'] = True
  msg = _('We allow and encourage an upgrade but you cannot reverse this process. Once your users have the WebExtension installed, they will not be able to install a legacy add-on.')
  messages = results['messages']
  messages.insert(0, {'tier': 1, 'type': 'warning', 'id': ['validation', 'messages', 'webext_upgrade'], 'message': msg, 'description': [], 'compatibility_type': None})
  results['warnings'] += 1
 elif (was_webextension and (not is_webextension)):
  msg = _('You cannot update a WebExtensions add-on with a legacy add-on. Your users would not be able to use your new version because Firefox does not support this type of update.')
  messages = results['messages']
  messages.insert(0, {'tier': 1, 'type': ('error' if (channel == amo.RELEASE_CHANNEL_LISTED) else 'warning'), 'id': ['validation', 'messages', 'webext_downgrade'], 'message': msg, 'description': [], 'compatibility_type': None})
  results['errors'] += 1
 return results

def annotate_webext_incompatibilities ( results , file_ , addon , version_string , channel ) : from . utils import find_previous_version previous_version = find_previous_version ( addon , file_ , version_string , channel ) if ( not previous_version ) : return results is_webextension = results [ 'metadata' ] . get ( 'is_webextension' , False ) was_webextension = ( previous_version and previous_version . is_webextension ) if ( is_webextension and ( not was_webextension ) ) : results [ 'is_upgrade_to_webextension' ] = True msg = _ ( 'We allow and encourage an upgrade but you cannot reverse this process. Once your users have the WebExtension installed, they will not be able to install a legacy add-on.' ) messages = results [ 'messages' ] messages . insert ( 0 , { 'tier' : 1 , 'type' : 'warning' , 'id' : [ 'validation' , 'messages' , 'webext_upgrade' ] , 'message' : msg , 'description' : [ ] , 'compatibility_type' : None } ) results [ 'warnings' ] += 1 elif ( was_webextension and ( not is_webextension ) ) : msg = _ ( 'You cannot update a WebExtensions add-on with a legacy add-on. Your users would not be able to use your new version because Firefox does not support this type of update.' ) messages = results [ 'messages' ] messages . insert ( 0 , { 'tier' : 1 , 'type' : ( 'error' if ( channel == amo . RELEASE_CHANNEL_LISTED ) else 'warning' ) , 'id' : [ 'validation' , 'messages' , 'webext_downgrade' ] , 'message' : msg , 'description' : [ ] , 'compatibility_type' : None } ) results [ 'errors' ] += 1 return results
check for webextension upgrades or downgrades .