build: set default config for .fdroid.* metadata

The default config for .fdroid.* metadata that is included in a git repo is
different than for the standard metadata/ layout because the expectations
are different.  In this case, the most common user will be the app
developer working on the latest update of the app on their own machine.
This commit is contained in:
Hans-Christoph Steiner 2015-08-05 15:18:22 +02:00
parent 3e6b263c8e
commit 578218a8b0
2 changed files with 29 additions and 11 deletions

View file

@ -214,7 +214,7 @@ def read_config(opts, config_file='config.py'):
with io.open(config_file, "rb") as f:
code = compile(f.read(), config_file, 'exec')
exec(code, None, config)
elif len(glob.glob('.fdroid.[a-z]*')) == 0:
elif len(get_local_metadata_files()) == 0:
logging.critical("Missing config file - is this a repo directory?")
sys.exit(2)
@ -361,6 +361,16 @@ def write_password_file(pwtype, password=None):
config[pwtype + 'file'] = filename
def get_local_metadata_files():
'''get any metadata files local to an app's source repo
This tries to ignore anything that does not count as app metdata,
including emacs cruft ending in ~ and the .fdroid.key*pass.txt files.
'''
return glob.glob('.fdroid.[a-jl-z]*[a-rt-z]')
# Given the arguments in the form of multiple appid:[vc] strings, this returns
# a dictionary with the set of vercodes specified for each package.
def read_pkg_args(args, allow_vercodes=False):