From 070feb3d219f54b69f19cf71eb173121c287cc09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sun, 3 Nov 2013 11:49:11 +0100 Subject: [PATCH] Fix all the possibe local.properties files, add sdk dir if oldsdk is not set --- fdroidserver/common.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 1b41f111..174878d1 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -1432,23 +1432,34 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path, break # Update the local.properties file... - locprops = os.path.join(root_dir, 'local.properties') - if os.path.exists(locprops): - f = open(locprops, 'r') + localprops = [ os.path.join(build_dir, 'local.properties') ] + if 'subdir' in build: + 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() f.close() + props += '\n' # Fix old-fashioned 'sdk-location' by copying # from sdk.dir, if necessary... if build.get('oldsdkloc', 'no') == "yes": sdkloc = re.match(r".*^sdk.dir=(\S+)$.*", props, 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... - 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... if 'encoding' in build: - props += "\njava.encoding=" + build['encoding'] + "\n" - f = open(locprops, 'w') + props += "java.encoding=%s\n" % build['encoding'] + f = open(path, 'w') f.write(props) f.close()