From f9c501c3c818d0d67ea76d1c598e721d797fad5c Mon Sep 17 00:00:00 2001 From: piri-p Date: Mon, 6 May 2024 10:38:11 +0200 Subject: [PATCH] Add Fenix locale handling (#671) --- mozdownload/scraper.py | 11 +++++------ tests/daily_scraper/test_daily_scraper.py | 3 +++ tests/release_scraper/test_release_scraper.py | 3 +++ tests/release_scraper/test_release_scraper_latest.py | 3 +++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/mozdownload/scraper.py b/mozdownload/scraper.py index 763d5d39..07e40faf 100755 --- a/mozdownload/scraper.py +++ b/mozdownload/scraper.py @@ -124,13 +124,12 @@ def __init__(self, destination=None, platform=None, self.destination = destination or os.getcwd() - if not locale: - if application in APPLICATIONS_MULTI_LOCALE: - self.locale = 'multi' - else: - self.locale = 'en-US' - else: + if application in APPLICATIONS_MULTI_LOCALE: + self.locale = 'multi' + elif locale: self.locale = locale + else: + self.locale = 'en-US' self.locale_build = self.locale not in ('en-US', 'multi') self.platform = platform or self.detect_platform() diff --git a/tests/daily_scraper/test_daily_scraper.py b/tests/daily_scraper/test_daily_scraper.py index 72ff95bf..aba48b59 100644 --- a/tests/daily_scraper/test_daily_scraper.py +++ b/tests/daily_scraper/test_daily_scraper.py @@ -122,6 +122,9 @@ ({'application': 'fenix', 'platform': 'android-x86_64', 'date': '2022-11-14'}, '2022-11-14-17-01-36-fenix-108.0b1.multi.android-x86_64.apk', 'fenix/nightly/2022/11/2022-11-14-17-01-36-fenix-108.0b1-android-x86_64/fenix-108.0b1.multi.android-x86_64.apk'), + ({'application': 'fenix', 'platform': 'android-arm64-v8a', 'date': '2022-11-14', 'locale': 'de'}, + '2022-11-14-17-01-36-fenix-108.0b1.multi.android-arm64-v8a.apk', + 'fenix/nightly/2022/11/2022-11-14-17-01-36-fenix-108.0b1-android-arm64-v8a/fenix-108.0b1.multi.android-arm64-v8a.apk'), ] @pytest.mark.parametrize("args,filename,url", firefox_tests + thunderbird_tests + fenix_tests) diff --git a/tests/release_scraper/test_release_scraper.py b/tests/release_scraper/test_release_scraper.py index d6ed8618..0865b6d0 100644 --- a/tests/release_scraper/test_release_scraper.py +++ b/tests/release_scraper/test_release_scraper.py @@ -26,6 +26,9 @@ ({'application': 'fenix', 'platform': 'android-x86_64', 'version': '120.1.0'}, 'fenix-120.1.0.multi.android-x86_64.apk', 'fenix/releases/120.1.0/android/fenix-120.1.0-android-x86_64/fenix-120.1.0.multi.android-x86_64.apk'), + ({'application': 'fenix', 'platform': 'android-arm64-v8a', 'version': '120.1.0', 'locale': 'de'}, + 'fenix-120.1.0.multi.android-arm64-v8a.apk', + 'fenix/releases/120.1.0/android/fenix-120.1.0-android-arm64-v8a/fenix-120.1.0.multi.android-arm64-v8a.apk'), ({'platform': 'win32', 'version': '23.0.1'}, 'firefox-23.0.1.en-US.win32.exe', 'firefox/releases/23.0.1/win32/en-US/Firefox Setup 23.0.1.exe'), diff --git a/tests/release_scraper/test_release_scraper_latest.py b/tests/release_scraper/test_release_scraper_latest.py index 66419997..b356f851 100644 --- a/tests/release_scraper/test_release_scraper_latest.py +++ b/tests/release_scraper/test_release_scraper_latest.py @@ -38,6 +38,9 @@ ({'application': 'fenix', 'platform': 'android-x86_64', 'version': 'latest-beta'}, 'fenix-120.0b9.multi.android-x86_64.apk', 'fenix/releases/120.0b9/android/fenix-120.0b9-android-x86_64/fenix-120.0b9.multi.android-x86_64.apk'), + ({'application': 'fenix', 'platform': 'android-arm64-v8a', 'version': 'latest', 'locale': 'de'}, + 'fenix-120.1.0.multi.android-arm64-v8a.apk', + 'fenix/releases/120.1.0/android/fenix-120.1.0-android-arm64-v8a/fenix-120.1.0.multi.android-arm64-v8a.apk'), ({'application': 'firefox', 'platform': 'linux', 'version': 'latest'}, 'firefox-23.0.1.en-US.linux.tar.bz2', 'firefox/releases/23.0.1/linux-i686/en-US/firefox-23.0.1.tar.bz2'),