1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-03 17:50:11 +02:00

purge accepted_formats from config

This commit is contained in:
Michael Pöhn 2020-08-19 15:51:49 +02:00
parent 40cbbd3173
commit f5a5fffb10
4 changed files with 3 additions and 17 deletions

View File

@ -119,7 +119,6 @@ default_config = {
'mvn3': "mvn", 'mvn3': "mvn",
'gradle': os.path.join(FDROID_PATH, 'gradlew-fdroid'), 'gradle': os.path.join(FDROID_PATH, 'gradlew-fdroid'),
'gradle_version_dir': os.path.join(os.path.join(os.getenv('HOME'), '.cache', 'fdroidserver'), 'gradle'), 'gradle_version_dir': os.path.join(os.path.join(os.getenv('HOME'), '.cache', 'fdroidserver'), 'gradle'),
'accepted_formats': ['yml'],
'sync_from_local_copy_dir': False, 'sync_from_local_copy_dir': False,
'allow_disabled_algorithms': False, 'allow_disabled_algorithms': False,
'per_app_repos': False, 'per_app_repos': False,

View File

@ -515,16 +515,12 @@ def check_for_unsupported_metadata_files(basedir=""):
global config global config
return_value = False return_value = False
formats = config['accepted_formats']
for f in glob.glob(basedir + 'metadata/*') + glob.glob(basedir + 'metadata/.*'): for f in glob.glob(basedir + 'metadata/*') + glob.glob(basedir + 'metadata/.*'):
if os.path.isdir(f): if os.path.isdir(f):
exists = False if not os.path.exists(f + '.yml'):
for t in formats:
exists = exists or os.path.exists(f + '.' + t)
if not exists:
print(_('"%s/" has no matching metadata file!') % f) print(_('"%s/" has no matching metadata file!') % f)
return_value = True return_value = True
elif os.path.splitext(f)[1][1:] in formats: elif os.path.splitext(f)[1][1:] == "yml":
packageName = os.path.splitext(os.path.basename(f))[0] packageName = os.path.splitext(os.path.basename(f))[0]
if not common.is_valid_package_name(packageName): if not common.is_valid_package_name(packageName):
print('"' + packageName + '" is an invalid package name!\n' print('"' + packageName + '" is an invalid package name!\n'
@ -532,7 +528,7 @@ def check_for_unsupported_metadata_files(basedir=""):
return_value = True return_value = True
else: else:
print('"' + f.replace(basedir, '') print('"' + f.replace(basedir, '')
+ '" is not a supported file format: (' + ','.join(formats) + ')') + '" is not a supported file format (use: .yml)')
return_value = True return_value = True
return return_value return return_value

View File

@ -928,10 +928,6 @@ def parse_metadata(metadatapath, check_vcs=False, refresh=True):
'''parse metadata file, optionally checking the git repo for metadata first''' '''parse metadata file, optionally checking the git repo for metadata first'''
_ignored, ext = fdroidserver.common.get_extension(metadatapath) _ignored, ext = fdroidserver.common.get_extension(metadatapath)
accepted = fdroidserver.common.config['accepted_formats']
if ext not in accepted:
warn_or_exception(_('"{path}" is not an accepted format, convert to: {formats}')
.format(path=metadatapath, formats=', '.join(accepted)))
app = App() app = App()
app.metadatapath = metadatapath app.metadatapath = metadatapath
@ -1172,10 +1168,6 @@ build_cont = re.compile(r'^[ \t]')
def write_metadata(metadatapath, app): def write_metadata(metadatapath, app):
_ignored, ext = fdroidserver.common.get_extension(metadatapath) _ignored, ext = fdroidserver.common.get_extension(metadatapath)
accepted = fdroidserver.common.config['accepted_formats']
if ext not in accepted:
warn_or_exception(_('Cannot write "{path}", not an accepted format, use: {formats}')
.format(path=metadatapath, formats=', '.join(accepted)))
if ext == 'yml': if ext == 'yml':
if importlib.util.find_spec('ruamel.yaml'): if importlib.util.find_spec('ruamel.yaml'):

View File

@ -248,7 +248,6 @@ Last updated: {date}'''.format(repo_git_base=repo_git_base,
config += "keypass = '%s'\n" % PASSWORD config += "keypass = '%s'\n" % PASSWORD
config += "keydname = '%s'\n" % DISTINGUISHED_NAME config += "keydname = '%s'\n" % DISTINGUISHED_NAME
config += "make_current_version_link = False\n" config += "make_current_version_link = False\n"
config += "accepted_formats = ['yml']\n"
config += "update_stats = True\n" config += "update_stats = True\n"
with open('config.py', 'w') as fp: with open('config.py', 'w') as fp:
fp.write(config) fp.write(config)