(is_gplay, fix=False)
| 177 | |
| 178 | |
| 179 | def check_android(is_gplay, fix=False): |
| 180 | ok = True |
| 181 | flavor = "google" if is_gplay else "fdroid" |
| 182 | flavor = f'{ANDROID_META_PATH}/{flavor}/play/' |
| 183 | ok = check_url(flavor + 'contact-website.txt') and ok |
| 184 | ok = check_email(flavor + 'contact-email.txt') and ok |
| 185 | ok = check_exact(flavor + 'default-language.txt', 'en-US') and ok |
| 186 | for locale in glob.glob(flavor + 'listings/*/'): |
| 187 | if is_gplay and locale.split('/')[-2] not in GPLAY_LOCALES: |
| 188 | error(locale, 'unsupported locale') |
| 189 | if fix: |
| 190 | drop_locale(locale) |
| 191 | ok = False |
| 192 | else: |
| 193 | locale_ok = check_text(locale + 'title.txt', 30 if is_gplay else 50) |
| 194 | desc_path = locale + 'short-description.txt' |
| 195 | locale_ok = check_text(desc_path, 80) and locale_ok |
| 196 | if is_gplay and os.path.exists(desc_path): |
| 197 | desc = open(desc_path, 'r').read() |
| 198 | if '--' in desc or '–' in desc: |
| 199 | # The app may not be promoted on Google Play because of the following |
| 200 | print(f'WARN: {desc_path} should use em dashes instead of double hyphens or en dashes') |
| 201 | if fix: |
| 202 | desc = desc.replace('--', '—').replace('–', '—') |
| 203 | open(desc_path, 'w').write(desc) |
| 204 | print(f'REPLACED wrong dashes in {desc_path}') |
| 205 | locale_ok = check_text(locale + 'full-description.txt', 4000) and locale_ok |
| 206 | locale_ok = check_text(locale + 'release-notes.txt', 499, optional=True) and locale_ok |
| 207 | done(locale, locale_ok) |
| 208 | if not locale_ok: |
| 209 | error(locale, 'locale is INVALID or INCOMPLETE') |
| 210 | if fix: |
| 211 | drop_locale(locale) |
| 212 | ok = False |
| 213 | ''' TODO: relnotes not necessary exist for all languages, but symlinks are made for all |
| 214 | for locale in glob.glob(flavor + 'release-notes/*/'): |
| 215 | if locale.split('/')[-2] not in GPLAY_LOCALES: |
| 216 | ok = error(locale, 'unsupported locale') and ok |
| 217 | continue |
| 218 | ok = check_text(locale + 'default.txt', 499) and ok |
| 219 | ''' |
| 220 | if not ok: |
| 221 | if fix: |
| 222 | print(f'FIXED by removing invalid locales from {flavor}') |
| 223 | return True |
| 224 | else: |
| 225 | error(flavor, 'HAS INVALID LOCALES') |
| 226 | return False |
| 227 | else: |
| 228 | print(f'metadata is OK {flavor}') |
| 229 | return True |
| 230 | |
| 231 | |
| 232 | def check_ios(fix=False): |
no test coverage detected