fix copy_triple_t_store_metadata()

This commit is contained in:
Felix C. Stegerman 2021-08-03 20:25:23 +02:00
parent 884870e74e
commit ac2b5cb7de
No known key found for this signature in database
GPG key ID: B218FF2C27FC6CC6

View file

@ -1039,8 +1039,12 @@ def copy_triple_t_store_metadata(apps):
setting_gradle_pattern = re.compile(r"""\s*include\s+["']:([^"']+)["'](?:,[\n\s]*["']:([^"']+)["'])*""") setting_gradle_pattern = re.compile(r"""\s*include\s+["']:([^"']+)["'](?:,[\n\s]*["']:([^"']+)["'])*""")
for packageName, app in apps.items(): for packageName, app in apps.items():
builds = app.get('Builds', [])
gradle_subdirs = set() gradle_subdirs = set()
sg_list = glob.glob(os.path.join('build', packageName, 'settings.gradle*')) if builds and builds[-1].subdir:
gradle_subdirs.update(glob.glob(os.path.join('build', packageName, builds[-1].subdir, 'src', '*', 'play')))
if not gradle_subdirs:
sg_list = sorted(glob.glob(os.path.join('build', packageName, 'settings.gradle*')))
if sg_list: if sg_list:
settings_gradle = sg_list[0] settings_gradle = sg_list[0]
with open(settings_gradle, encoding='utf-8') as fp: with open(settings_gradle, encoding='utf-8') as fp:
@ -1052,15 +1056,12 @@ def copy_triple_t_store_metadata(apps):
p = os.path.join('build', packageName, gradle_path, 'src', 'main', 'play') p = os.path.join('build', packageName, gradle_path, 'src', 'main', 'play')
if os.path.exists(p): if os.path.exists(p):
gradle_subdirs.add(p) gradle_subdirs.add(p)
flavors = set() flavors = builds[-1].gradle if builds else []
if app.get('Builds'):
flavors = app['Builds'][0].gradle
for flavor in flavors: for flavor in flavors:
if flavor not in ('yes', 'no'): if flavor not in ('yes', 'no', True, False):
p = os.path.join('build', packageName, gradle_path, 'src', flavor, 'play') p = os.path.join('build', packageName, gradle_path, 'src', flavor, 'play')
if os.path.exists(p):
gradle_subdirs.add(p) gradle_subdirs.add(p)
if not gradle_subdirs and len(app.get('Builds', [])) and app.get('Builds', [])[-1].subdir:
gradle_subdirs.update(glob.glob(os.path.join('build', packageName, app.get('Builds', [])[-1].subdir, 'src', '*', 'play')))
if not gradle_subdirs: if not gradle_subdirs:
gradle_subdirs.update(glob.glob(os.path.join('build', packageName, '*', 'src', '*', 'play'))) gradle_subdirs.update(glob.glob(os.path.join('build', packageName, '*', 'src', '*', 'play')))
@ -1077,37 +1078,28 @@ def copy_triple_t_store_metadata(apps):
if f == 'fulldescription' or f == 'full-description.txt': if f == 'fulldescription' or f == 'full-description.txt':
_set_localized_text_entry(app, locale, 'description', _set_localized_text_entry(app, locale, 'description',
os.path.join(root, f)) os.path.join(root, f))
continue
elif f == 'shortdescription' or f == 'short-description.txt': elif f == 'shortdescription' or f == 'short-description.txt':
_set_localized_text_entry(app, locale, 'summary', _set_localized_text_entry(app, locale, 'summary',
os.path.join(root, f)) os.path.join(root, f))
continue
elif f == 'title' or f == 'title.txt': elif f == 'title' or f == 'title.txt':
_set_localized_text_entry(app, locale, 'name', _set_localized_text_entry(app, locale, 'name',
os.path.join(root, f)) os.path.join(root, f))
continue
elif f == 'video' or f == 'video-url.txt': elif f == 'video' or f == 'video-url.txt':
_set_localized_text_entry(app, locale, 'video', _set_localized_text_entry(app, locale, 'video',
os.path.join(root, f)) os.path.join(root, f))
continue
elif f == 'whatsnew': elif f == 'whatsnew':
_set_localized_text_entry(app, segments[-1], 'whatsNew', _set_localized_text_entry(app, segments[-1], 'whatsNew',
os.path.join(root, f)) os.path.join(root, f))
continue
elif f == 'default.txt' and segments[-2] == 'release-notes': elif f == 'default.txt' and segments[-2] == 'release-notes':
_set_localized_text_entry(app, locale, 'whatsNew', _set_localized_text_entry(app, locale, 'whatsNew',
os.path.join(root, f)) os.path.join(root, f))
continue
elif f == 'contactEmail' or f == 'contact-email.txt': elif f == 'contactEmail' or f == 'contact-email.txt':
_set_author_entry(app, 'authorEmail', os.path.join(root, f)) _set_author_entry(app, 'authorEmail', os.path.join(root, f))
continue
elif f == 'contactPhone' or f == 'contact-phone.txt': elif f == 'contactPhone' or f == 'contact-phone.txt':
_set_author_entry(app, 'authorPhone', os.path.join(root, f)) _set_author_entry(app, 'authorPhone', os.path.join(root, f))
continue
elif f == 'contactWebsite' or f == 'contact-website.txt': elif f == 'contactWebsite' or f == 'contact-website.txt':
_set_author_entry(app, 'authorWebSite', os.path.join(root, f)) _set_author_entry(app, 'authorWebSite', os.path.join(root, f))
continue else:
base, extension = common.get_extension(f) base, extension = common.get_extension(f)
dirname = os.path.basename(root) dirname = os.path.basename(root)
if extension in ALLOWED_EXTENSIONS \ if extension in ALLOWED_EXTENSIONS \