From ef2f26e5f0eb1ea70493629d9e21b4d3483c81cb Mon Sep 17 00:00:00 2001 From: Ilya Zverev Date: Wed, 20 Jan 2016 18:16:01 +0300 Subject: [PATCH] [android] Fix indentation in set_up_android.py (no other changes) --- tools/android/set_up_android.py | 128 ++++++++++++++++---------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/tools/android/set_up_android.py b/tools/android/set_up_android.py index 4485992c05..a638a46bf1 100755 --- a/tools/android/set_up_android.py +++ b/tools/android/set_up_android.py @@ -7,87 +7,87 @@ import sys def locate_sdk(sdkPath): - if (not sdkPath): - sdkPath = raw_input('Enter Android SDK path: ').strip() - # check if directory is correct - androidPath = os.path.join(sdkPath, 'tools', 'android') - if os.path.exists(androidPath): - print 'ANDROID SDK path assigned: %s' % sdkPath - return sdkPath - else: - print 'Incorrect SDK path.' - exit(1) + if (not sdkPath): + sdkPath = raw_input('Enter Android SDK path: ').strip() + # check if directory is correct + androidPath = os.path.join(sdkPath, 'tools', 'android') + if os.path.exists(androidPath): + print 'ANDROID SDK path assigned: %s' % sdkPath + return sdkPath + else: + print 'Incorrect SDK path.' + exit(1) def locate_ndk(ndkPath): - if (not ndkPath): - ndkPath = raw_input('Enter Anroid NDK path: ').strip() - # check if directory is correct - ndkBuildPath = os.path.join(ndkPath, 'ndk-build') - if os.path.exists(ndkBuildPath): - print 'ANDROID NDK path assigned: %s' % ndkPath - return ndkPath - else: - print 'Incorrect NDK path.' - exit(1) + if (not ndkPath): + ndkPath = raw_input('Enter Anroid NDK path: ').strip() + # check if directory is correct + ndkBuildPath = os.path.join(ndkPath, 'ndk-build') + if os.path.exists(ndkBuildPath): + print 'ANDROID NDK path assigned: %s' % ndkPath + return ndkPath + else: + print 'Incorrect NDK path.' + exit(1) def write_local_properties(sdkDir, ndkDir): - locPropsContent = ('# Autogenerated file\n' + - '# Do not add it to version control\n' + - 'sdk.dir=%s\n' % sdkDir + - 'ndk.dir=%s\n' % ndkDir) + locPropsContent = ('# Autogenerated file\n' + + '# Do not add it to version control\n' + + 'sdk.dir=%s\n' % sdkDir + + 'ndk.dir=%s\n' % ndkDir) - curDir = os.getcwd() - omimRoot = os.path.dirname(os.path.dirname(curDir)) - androidRoot = os.path.join(omimRoot, 'android') - locPropsOrigin = os.path.join(androidRoot, 'local.properties') + curDir = os.getcwd() + omimRoot = os.path.dirname(os.path.dirname(curDir)) + androidRoot = os.path.join(omimRoot, 'android') + locPropsOrigin = os.path.join(androidRoot, 'local.properties') - file = open(locPropsOrigin, 'w') - file.write(locPropsContent) - file.close() + file = open(locPropsOrigin, 'w') + file.write(locPropsContent) + file.close() - # copy files to folders - subfolders = ['YoPme', - 'YoPme2', - 'UnitTests'] + # copy files to folders + subfolders = ['YoPme', + 'YoPme2', + 'UnitTests'] - for folder in subfolders: - dstFold = os.path.join(androidRoot, folder) - if not os.path.exists(dstFold): - os.makedirs(dstFold) - dst = os.path.join(dstFold, 'local.properties') - shutil.copy(locPropsOrigin, dst) - print 'File created:', dst + for folder in subfolders: + dstFold = os.path.join(androidRoot, folder) + if not os.path.exists(dstFold): + os.makedirs(dstFold) + dst = os.path.join(dstFold, 'local.properties') + shutil.copy(locPropsOrigin, dst) + print 'File created:', dst def usage(): - print "Usage: " + sys.argv[0] + " --sdk --ndk " + print "Usage: " + sys.argv[0] + " --sdk --ndk " def run(): - try: - opts, args = getopt.getopt(sys.argv[1:], "h", ["sdk=", "ndk=", "help"]) - except getopt.GetoptError as err: - print str(err) - usage() - exit(2) + try: + opts, args = getopt.getopt(sys.argv[1:], "h", ["sdk=", "ndk=", "help"]) + except getopt.GetoptError as err: + print str(err) + usage() + exit(2) - sdk = None - ndk = None - for o, a in opts: - if o == "--sdk": - sdk = a - elif o == "--ndk": - ndk = a - elif o in ("-h", "--help"): - usage() - sys.exit() + sdk = None + ndk = None + for o, a in opts: + if o == "--sdk": + sdk = a + elif o == "--ndk": + ndk = a + elif o in ("-h", "--help"): + usage() + sys.exit() - sdkDir = locate_sdk(sdk) - ndkDir = locate_ndk(ndk) - print '>>> Writing local.properties' - write_local_properties(sdkDir, ndkDir) - print '>>> Done!' + sdkDir = locate_sdk(sdk) + ndkDir = locate_ndk(ndk) + print '>>> Writing local.properties' + write_local_properties(sdkDir, ndkDir) + print '>>> Done!' run()