import Queue
import threading
import magic
+from distutils.spawn import find_executable
import metadata
if not os.path.isfile(config_file):
print "Missing config file - is this a repo directory?"
sys.exit(2)
+
st = os.stat(config_file)
if st.st_mode & stat.S_IRWXG or st.st_mode & stat.S_IRWXO:
print "WARNING: unsafe permissions on {0} (should be 0600)!".format(config_file)
if options.verbose:
print "Reading %s..." % config_file
execfile(config_file, config)
+
+ # Expand environment variables
for k, v in config.items():
if type(v) != str:
continue
if v[0] == '$':
config[k] = os.environ[v[1:]]
+
+ # Check that commands and binaries do exist
+ for key in ('mvn3', 'gradle'):
+ if key not in config:
+ print "WARNING: %s not set in config" % key
+ val = config[key]
+ executable = find_executable(val)
+ if not executable:
+ print "ERROR: No such command or binary for %s: %s" % (key, val)
+ sys.exit(3)
+
+ # Check that directories exist
+ for key in ('sdk_path', 'ndk_path', 'build_tools'):
+ if key not in config:
+ print "WARNING: %s not set in config" % key
+ val = config[key]
+ if key == 'build_tools':
+ val = os.path.join(config['sdk_path'], 'build-tools', val)
+ if not os.path.isdir(val):
+ print "ERROR: No such directory found for %s: %s" % (key, val)
+ sys.exit(3)
+
return config
def getapkname(app, build):