1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-09-19 03:30:12 +02:00

Name config args thisconfig to avoid confusion with the global config

This commit is contained in:
Daniel Martí 2014-09-17 00:12:24 +02:00
parent 9c4a529f5b
commit 9327adfe74

View File

@ -74,20 +74,20 @@ default_config = {
} }
def fill_config_defaults(config): def fill_config_defaults(thisconfig):
for k, v in default_config.items(): for k, v in default_config.items():
if k not in config: if k not in thisconfig:
config[k] = v thisconfig[k] = v
# Expand paths (~users and $vars) # Expand paths (~users and $vars)
for k in ['sdk_path', 'ndk_path', 'ant', 'mvn3', 'gradle', 'keystore', 'repo_icon']: for k in ['sdk_path', 'ndk_path', 'ant', 'mvn3', 'gradle', 'keystore', 'repo_icon']:
v = config[k] v = thisconfig[k]
orig = v orig = v
v = os.path.expanduser(v) v = os.path.expanduser(v)
v = os.path.expandvars(v) v = os.path.expandvars(v)
if orig != v: if orig != v:
config[k] = v thisconfig[k] = v
config[k + '_orig'] = orig thisconfig[k + '_orig'] = orig
def read_config(opts, config_file='config.py'): def read_config(opts, config_file='config.py'):
@ -195,31 +195,31 @@ def read_config(opts, config_file='config.py'):
return config return config
def test_sdk_exists(config): def test_sdk_exists(thisconfig):
if config['sdk_path'] == default_config['sdk_path']: if thisconfig['sdk_path'] == default_config['sdk_path']:
logging.error('No Android SDK found!') logging.error('No Android SDK found!')
logging.error('You can use ANDROID_HOME to set the path to your SDK, i.e.:') logging.error('You can use ANDROID_HOME to set the path to your SDK, i.e.:')
logging.error('\texport ANDROID_HOME=/opt/android-sdk') logging.error('\texport ANDROID_HOME=/opt/android-sdk')
return False return False
if not os.path.exists(config['sdk_path']): if not os.path.exists(thisconfig['sdk_path']):
logging.critical('Android SDK path "' + config['sdk_path'] + '" does not exist!') logging.critical('Android SDK path "' + thisconfig['sdk_path'] + '" does not exist!')
return False return False
if not os.path.isdir(config['sdk_path']): if not os.path.isdir(thisconfig['sdk_path']):
logging.critical('Android SDK path "' + config['sdk_path'] + '" is not a directory!') logging.critical('Android SDK path "' + thisconfig['sdk_path'] + '" is not a directory!')
return False return False
for d in ['build-tools', 'platform-tools', 'tools']: for d in ['build-tools', 'platform-tools', 'tools']:
if not os.path.isdir(os.path.join(config['sdk_path'], d)): if not os.path.isdir(os.path.join(thisconfig['sdk_path'], d)):
logging.critical('Android SDK path "%s" does not contain "%s/"!' % ( logging.critical('Android SDK path "%s" does not contain "%s/"!' % (
config['sdk_path'], d)) thisconfig['sdk_path'], d))
return False return False
return True return True
def test_build_tools_exists(config): def test_build_tools_exists(thisconfig):
if not test_sdk_exists(config): if not test_sdk_exists(thisconfig):
return False return False
build_tools = os.path.join(config['sdk_path'], 'build-tools') build_tools = os.path.join(thisconfig['sdk_path'], 'build-tools')
versioned_build_tools = os.path.join(build_tools, config['build_tools']) versioned_build_tools = os.path.join(build_tools, thisconfig['build_tools'])
if not os.path.isdir(versioned_build_tools): if not os.path.isdir(versioned_build_tools):
logging.critical('Android Build Tools path "' logging.critical('Android Build Tools path "'
+ versioned_build_tools + '" does not exist!') + versioned_build_tools + '" does not exist!')