diff options
author | Ilya Zverev <zverik@textual.ru> | 2016-03-01 12:17:32 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-23 16:50:40 +0300 |
commit | db23147e7ce9ecdd93a59ee4ab96f4803d900d0e (patch) | |
tree | 54003f5d2d25fb3b594ca7f2d8b7273e5d269dc7 /tools/android | |
parent | 3c9e8305e5baa1d2d4519eb3f5b8a8297c547b92 (diff) |
Python 3 support
Diffstat (limited to 'tools/android')
-rwxr-xr-x | tools/android/set_up_android.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/android/set_up_android.py b/tools/android/set_up_android.py index 207baea819..21434f4b45 100755 --- a/tools/android/set_up_android.py +++ b/tools/android/set_up_android.py @@ -2,6 +2,12 @@ import os, sys, shutil, collections from optparse import OptionParser +# Fix for python 2 +try: + input = raw_input +except NameError: + pass + def find_recursive(root, subpath, maxdepth=4): queue = collections.deque([(root, 0)]) if 'PATH' in os.environ: @@ -38,7 +44,7 @@ def query_path(title, option, default, subpath): default = '' if not default else os.path.abspath(default) searchHint = ', "s" to search' while True: - path = raw_input('Path to {0}{1} [{2}]:'.format(title, searchHint, default)) or default + path = input('Path to {0}{1} [{2}]:'.format(title, searchHint, default)) or default if len(searchHint) > 0 and path.lower().strip() == 's': found = find_recursive(os.path.expanduser('~'), subpath) if found: @@ -50,7 +56,7 @@ def query_path(title, option, default, subpath): if path and os.path.isfile(test): return os.path.abspath(path) else: - print 'Could not find {0}, not an {1} path.'.format(test, title) + print('Could not find {0}, not an {1} path.'.format(test, title)) sys.exit(1) def write_local_properties(sdkDir, ndkDir): @@ -64,7 +70,7 @@ def write_local_properties(sdkDir, ndkDir): # Create omim/android/local.properties androidRoot = os.path.join(os.path.dirname(sys.argv[0]), '..', '..', 'android') propsFile = os.path.join(androidRoot, 'local.properties') - print 'Writing {0}'.format(propsFile) + print('Writing {0}'.format(propsFile)) with open(propsFile, 'w') as f: f.write(content) @@ -74,7 +80,7 @@ def write_local_properties(sdkDir, ndkDir): if not os.path.exists(destFolder): os.makedirs(destFolder) dst = os.path.join(destFolder, 'local.properties') - print 'Copying to {0}'.format(dst) + print('Copying to {0}'.format(dst)) shutil.copy(propsFile, dst) if __name__ == '__main__': |