mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 23:10:29 +03:00
index: generate repo icon if missing, and add tests
This commit is contained in:
parent
7adba093e4
commit
283f10dec1
2 changed files with 49 additions and 3 deletions
|
|
@ -593,8 +593,21 @@ def make_v0(apps, apks, repodir, repodict, requestsdict, fdroid_signing_key_fing
|
|||
|
||||
# Copy the repo icon into the repo directory...
|
||||
icon_dir = os.path.join(repodir, 'icons')
|
||||
iconfilename = os.path.join(icon_dir, os.path.basename(common.config['repo_icon']))
|
||||
shutil.copyfile(common.config['repo_icon'], iconfilename)
|
||||
repo_icon = common.config.get('repo_icon', common.default_config['repo_icon'])
|
||||
iconfilename = os.path.join(icon_dir, os.path.basename(repo_icon))
|
||||
if os.path.exists(repo_icon):
|
||||
shutil.copyfile(common.config['repo_icon'], iconfilename)
|
||||
else:
|
||||
logging.warning(_('repo_icon %s does not exist, generating placeholder.')
|
||||
% repo_icon)
|
||||
os.makedirs(os.path.dirname(iconfilename), exist_ok=True)
|
||||
try:
|
||||
import qrcode
|
||||
qrcode.make(common.config['repo_url']).save(iconfilename)
|
||||
except Exception:
|
||||
exampleicon = os.path.join(common.get_examples_dir(),
|
||||
common.default_config['repo_icon'])
|
||||
shutil.copy(exampleicon, iconfilename)
|
||||
|
||||
|
||||
def extract_pubkey():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue