Bug 1303041 - Don't look up "what's new" when uploading Aurora r=sylvestre

MozReview-Commit-ID: DxlaK90wbI8

--HG--
extra : rebase_source : c83dd6e42ce8bceb794f1353ab7fb9fbd5adb916
This commit is contained in:
Johan Lorenzo 2016-09-15 16:38:02 +02:00
parent 8875e96f7d
commit be46a345b9

View File

@ -157,26 +157,10 @@ class PushAPK(BaseScript, GooglePlayMixin, VirtualenvMixin):
versions.append(apk_response['versionCode'])
locales = self.translationMgmt.get_list_locales(package_code)
locales.append(u'en-US')
nb_locales = 0
for locale in locales:
translation = self.translationMgmt.get_translation(package_code, locale)
whatsnew = translation.get("whatsnew")
if locale == "en-GB":
self.log("Ignoring en-GB as locale")
continue
locale = self.translationMgmt.locale_mapping(locale)
self.log('Locale "%s" what\'s new has been updated to "%s"'
% (locale, whatsnew))
listing_response = service.edits().apklistings().update(
editId=edit_id, packageName=self.config['package_name'], language=locale,
apkVersionCode=apk_response['versionCode'],
body={'recentChanges': whatsnew}).execute()
self.log('Listing for language %s was updated.'
% listing_response['language'])
if 'aurora' in self.config['package_name']:
self.warning('Aurora is not supported by store_l10n. Skipping what\'s new.')
else:
self._push_whats_new(package_code, service, edit_id, apk_response)
except client.AccessTokenRefreshError:
self.log('The credentials have been revoked or expired,'
@ -196,6 +180,27 @@ class PushAPK(BaseScript, GooglePlayMixin, VirtualenvMixin):
editId=edit_id, packageName=self.config['package_name']).execute()
self.log('Edit "%s" has been committed' % (commit_request['id']))
def _push_whats_new(self, package_code, service, edit_id, apk_response):
locales = self.translationMgmt.get_list_locales(package_code)
locales.append(u'en-US')
for locale in locales:
translation = self.translationMgmt.get_translation(package_code, locale)
whatsnew = translation.get("whatsnew")
if locale == "en-GB":
self.log("Ignoring en-GB as locale")
continue
locale = self.translationMgmt.locale_mapping(locale)
self.log('Locale "%s" what\'s new has been updated to "%s"'
% (locale, whatsnew))
listing_response = service.edits().apklistings().update(
editId=edit_id, packageName=self.config['package_name'], language=locale,
apkVersionCode=apk_response['versionCode'],
body={'recentChanges': whatsnew}).execute()
self.log('Listing for language %s was updated.' % listing_response['language'])
def push_apk(self):
""" Upload the APK files """
self.check_argument()