aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2015-08-27 16:53:47 -0700
committerDan Albert <danalbert@google.com>2015-08-27 17:10:55 -0700
commite8651e2c0ba5625da98c46340a824a9df2c5d375 (patch)
treed6246b06d22a30d7ed333c6d6b2125c17e606fda
parenta4e5986f823cf7b71bce508361865abe24a43dfd (diff)
downloadtoolchain_gcc-e8651e2c0ba5625da98c46340a824a9df2c5d375.tar.gz
toolchain_gcc-e8651e2c0ba5625da98c46340a824a9df2c5d375.tar.bz2
toolchain_gcc-e8651e2c0ba5625da98c46340a824a9df2c5d375.zip
Infer ANDROID_BUILD_TOP if it is not set.
Change-Id: I78d92443247b7260030bbe023b460696f9289313
-rwxr-xr-xbuild.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/build.py b/build.py
index 4cff80a50..34cc19f5b 100755
--- a/build.py
+++ b/build.py
@@ -25,10 +25,6 @@ import sys
def android_path(path=''):
top = os.getenv('ANDROID_BUILD_TOP', '')
- if not top:
- sys.exit('ANDROID_BUILD_TOP not set. Cannot continue.\n'
- 'Please set ANDROID_BUILD_TOP to point to the root of an '
- 'Android tree.')
return os.path.realpath(os.path.join(top, path))
@@ -98,6 +94,10 @@ def sysroot_path(toolchain):
def main():
args = ArgParser().parse_args()
+ if 'ANDROID_BUILD_TOP' not in os.environ:
+ top = os.path.join(os.path.dirname(__file__), '../..')
+ os.environ['ANDROID_BUILD_TOP'] = os.path.realpath(top)
+
os.chdir(android_path('toolchain/gcc'))
toolchain_path = android_path('toolchain')