1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-14 02:50:12 +01:00

Fix all the possibe local.properties files, add sdk dir if oldsdk is not set

This commit is contained in:
Daniel Martí 2013-11-03 11:49:11 +01:00
parent 7a4ec5c083
commit 070feb3d21

View File

@ -1432,23 +1432,34 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path,
break break
# Update the local.properties file... # Update the local.properties file...
locprops = os.path.join(root_dir, 'local.properties') localprops = [ os.path.join(build_dir, 'local.properties') ]
if os.path.exists(locprops): if 'subdir' in build:
f = open(locprops, 'r') localprops += [ os.path.join(root_dir, 'local.properties') ]
for path in localprops:
if not os.path.isfile(path):
continue
if options.verbose:
print "Updating properties file at %s" % path
f = open(path, 'r')
props = f.read() props = f.read()
f.close() f.close()
props += '\n'
# Fix old-fashioned 'sdk-location' by copying # Fix old-fashioned 'sdk-location' by copying
# from sdk.dir, if necessary... # from sdk.dir, if necessary...
if build.get('oldsdkloc', 'no') == "yes": if build.get('oldsdkloc', 'no') == "yes":
sdkloc = re.match(r".*^sdk.dir=(\S+)$.*", props, sdkloc = re.match(r".*^sdk.dir=(\S+)$.*", props,
re.S|re.M).group(1) re.S|re.M).group(1)
props += "\nsdk-location=" + sdkloc + "\n" props += "sdk-location=%s\n" % sdkloc
else:
props += "sdk.dir=%s\n" % sdk_path
props += "sdk-location=%s\n" % sdk_path
# Add ndk location... # Add ndk location...
props+= "\nndk.dir=" + ndk_path + "\n" props += "ndk.dir=%s\n" % ndk_path
props += "ndk-location=%s\n" % ndk_path
# Add java.encoding if necessary... # Add java.encoding if necessary...
if 'encoding' in build: if 'encoding' in build:
props += "\njava.encoding=" + build['encoding'] + "\n" props += "java.encoding=%s\n" % build['encoding']
f = open(locprops, 'w') f = open(path, 'w')
f.write(props) f.write(props)
f.close() f.close()