if os.path.exists(build_dir):
send_dir(build_dir)
# Copy any extlibs that are required...
- if thisbuild.has_key('extlibs'):
+ if 'extlibs' in thisbuild:
ftp.chdir('/home/vagrant/build/extlib')
for lib in thisbuild['extlibs'].split(';'):
lp = lib.split('/')
ftp.chdir('..')
# Copy any srclibs that are required...
srclibpaths = []
- if thisbuild.has_key('srclibs'):
+ if 'srclibs' in thisbuild:
for lib in thisbuild['srclibs'].split(';'):
name, _ = lib.split('@')
srclibpaths.append((name, common.getsrclib(lib, 'build/extlib', sdk_path, basepath=True)))
raise BuildException("NDK build failed for %s:%s" % (app['id'], thisbuild['version']))
# Build the release...
- if thisbuild.has_key('maven'):
+ if 'maven' in thisbuild:
p = subprocess.Popen([mvn3, 'clean', 'package',
'-Dandroid.sdk.path=' + sdk_path,
'-Dandroid.sign.debug=false'],
else:
if install:
antcommands = ['debug','install']
- elif thisbuild.has_key('antcommand'):
+ elif 'antcommand' in thisbuild:
antcommands = [thisbuild['antcommand']]
else:
antcommands = ['release']
print "Build successful"
# Find the apk name in the output...
- if thisbuild.has_key('bindir'):
+ if 'bindir' in thisbuild:
bindir = os.path.join(build_dir, thisbuild['bindir'])
else:
bindir = os.path.join(root_dir, 'bin')
src = ("funambol-android-sync-client-" +
thisbuild['version'] + "-unsigned.apk")
src = os.path.join(bindir, src)
- elif thisbuild.has_key('maven'):
+ elif 'maven' in thisbuild:
m = re.match(r".*^\[INFO\] .*apkbuilder.*/([^/]*)\.apk",
output, re.S|re.M)
if not m:
return (None, "Can't use Tags with no builds defined")
manifest = build_dir
- if app['builds'][-1].has_key('subdir'):
+ if 'subdir' in app['builds'][-1]:
manifest = os.path.join(manifest, app['builds'][-1]['subdir'])
manifest = os.path.join(manifest, 'AndroidManifest.xml')
return (None, "Can't use RepoManifest with no builds defined")
manifest = build_dir
- if app['builds'][-1].has_key('subdir'):
+ if 'subdir' in app['builds'][-1]:
manifest = os.path.join(manifest, app['builds'][-1]['subdir'])
manifest = os.path.join(manifest, 'AndroidManifest.xml')
for build in app['builds']:
writecomments('build:' + build['version'])
mf.write('Build Version:')
- if build.has_key('origlines'):
+ if 'origlines' in build:
# Keeping the original formatting if we loaded it from a file...
mf.write('\\\n'.join(build['origlines']) + '\n')
else:
def prepare_source(vcs, app, build, build_dir, extlib_dir, sdk_path, ndk_path, javacc_path, mvn3, verbose=False):
# Optionally, the actual app source can be in a subdirectory...
- if build.has_key('subdir'):
+ if 'subdir' in build:
root_dir = os.path.join(build_dir, build['subdir'])
else:
root_dir = build_dir
vcs.initsubmodules()
# Run an init command if one is required...
- if build.has_key('init'):
+ if 'init' in build:
init = build['init']
init = init.replace('$$SDK$$', sdk_path)
init = init.replace('$$NDK$$', ndk_path)
# Generate (or update) the ant build file, build.xml...
updatemode = build.get('update', '.')
if (updatemode != 'no' and
- not build.has_key('maven')):
+ 'maven' not in build):
parms = [os.path.join(sdk_path, 'tools', 'android'),
'update', 'project', '-p', '.']
parms.append('--subprojects')
- if build.has_key('target'):
+ if 'target' in build:
parms.append('-t')
parms.append(build['target'])
update_dirs = updatemode.split(';')
# Force build.xml update if necessary...
- if updatemode == 'force' or build.has_key('target'):
+ if updatemode == 'force' or 'target' in build:
if updatemode == 'force':
update_dirs = ['.']
buildxml = os.path.join(root_dir, 'build.xml')
# Add ndk location...
props+= "\nndk.dir=" + ndk_path + "\n"
# Add java.encoding if necessary...
- if build.has_key('encoding'):
+ if 'encoding' in build:
props += "\njava.encoding=" + build['encoding'] + "\n"
f = open(locprops, 'w')
f.write(props)
f.close()
# Insert version code and number into the manifest if necessary...
- if build.has_key('forceversion'):
+ if 'forceversion' in build:
if subprocess.call(['sed','-r','-i',
's/android:versionName="[^"]+"/android:versionName="' + build['version'] + '"/g',
'AndroidManifest.xml'], cwd=root_dir) !=0:
raise BuildException("Failed to amend manifest")
- if build.has_key('forcevercode'):
+ if 'forcevercode' in build:
if subprocess.call(['sed','-r','-i',
's/android:versionCode="[^"]+"/android:versionCode="' + build['vercode'] + '"/g',
'AndroidManifest.xml'], cwd=root_dir) !=0:
raise BuildException("Failed to amend manifest")
# Delete unwanted file...
- if build.has_key('rm'):
+ if 'rm' in build:
dest = os.path.join(build_dir, build['rm'])
if os.path.exists(dest):
os.remove(dest)
f.close()
# Add required external libraries...
- if build.has_key('extlibs'):
+ if 'extlibs' in build:
libsdir = os.path.join(root_dir, 'libs')
if not os.path.exists(libsdir):
os.mkdir(libsdir)
# Get required source libraries...
srclibpaths = []
- if build.has_key('srclibs'):
+ if 'srclibs' in build:
for lib in build['srclibs'].split(';'):
name, _ = lib.split('@')
srclibpaths.append((name, getsrclib(lib, extlib_dir, sdk_path)))
raise BuildException("Failed to apply patch %s" % patch_path)
# Run a pre-build command if one is required...
- if build.has_key('prebuild'):
+ if 'prebuild' in build:
prebuild = build['prebuild']
# Substitute source library paths into prebuild commands...
for name, libpath in srclibpaths:
# If a collision does occur later, we're going to have to
# come up with a new alogrithm, AND rename all existing keys
# in the keystore!
- if keyaliases.has_key(appid):
+ if appid in keyaliases:
# For this particular app, the key alias is overridden...
keyalias = keyaliases[appid]
else:
else:
validapks += 1
wikidata += "This version is built and signed by "
- if apk.has_key('srcname'):
+ if 'srcname' in apk:
wikidata += "F-Droid, and guaranteed to correspond to the source tarball published with it.\n\n"
else:
wikidata += "the original developer.\n\n"
if os.path.exists(name):
print "Deleting disabled build output " + apkfilename
os.remove(name)
- if apkcache.has_key(apkfilename):
+ if apkfilename in apkcache:
del apkcache[apkfilename]
apks = []
sys.exit(1)
srcfilename = apkfilename[:-4] + "_src.tar.gz"
- if apkcache.has_key(apkfilename):
+ if apkfilename in apkcache:
if options.verbose:
print "Reading " + apkfilename + " from cache"
thisinfo = apkcache[apkfilename]
perm = perm[16:]
thisinfo['features'].append(perm)
- if not thisinfo.has_key('sdkversion'):
+ if not 'sdkversion' in thisinfo:
print " WARNING: no SDK version information found"
thisinfo['sdkversion'] = 0
addElement('version', apk['version'], doc, apkel)
addElement('versioncode', str(apk['versioncode']), doc, apkel)
addElement('apkname', apk['apkname'], doc, apkel)
- if apk.has_key('srcname'):
+ if 'srcname' in apk:
addElement('srcname', apk['srcname'], doc, apkel)
for hash_type in ('sha256', 'md5'):
if not hash_type in apk: