diff options
Diffstat (limited to 'scripts/install-buildtools')
| -rwxr-xr-x | scripts/install-buildtools | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts/install-buildtools b/scripts/install-buildtools index a34474ea84..4f85fe87d4 100755 --- a/scripts/install-buildtools +++ b/scripts/install-buildtools | |||
| @@ -102,6 +102,16 @@ def sha256_file(filename): | |||
| 102 | import hashlib | 102 | import hashlib |
| 103 | return _hasher(hashlib.sha256(), filename) | 103 | return _hasher(hashlib.sha256(), filename) |
| 104 | 104 | ||
| 105 | def remove_quotes(var): | ||
| 106 | """ | ||
| 107 | If a variable starts and ends with double quotes, remove them. | ||
| 108 | Assumption: if a variable starts with double quotes, it must also | ||
| 109 | end with them. | ||
| 110 | """ | ||
| 111 | if var[0] == '"': | ||
| 112 | var = var[1:-1] | ||
| 113 | return var | ||
| 114 | |||
| 105 | 115 | ||
| 106 | def main(): | 116 | def main(): |
| 107 | global DEFAULT_INSTALL_DIR | 117 | global DEFAULT_INSTALL_DIR |
| @@ -273,7 +283,7 @@ def main(): | |||
| 273 | os.chmod(tmpbuildtools, st.st_mode | stat.S_IEXEC) | 283 | os.chmod(tmpbuildtools, st.st_mode | stat.S_IEXEC) |
| 274 | logger.debug(os.stat(tmpbuildtools)) | 284 | logger.debug(os.stat(tmpbuildtools)) |
| 275 | if args.directory: | 285 | if args.directory: |
| 276 | install_dir = args.directory | 286 | install_dir = os.path.abspath(args.directory) |
| 277 | ret = subprocess.call("%s -d %s -y" % | 287 | ret = subprocess.call("%s -d %s -y" % |
| 278 | (tmpbuildtools, install_dir), shell=True) | 288 | (tmpbuildtools, install_dir), shell=True) |
| 279 | else: | 289 | else: |
| @@ -294,7 +304,7 @@ def main(): | |||
| 294 | if match: | 304 | if match: |
| 295 | env_var = match.group('env_var') | 305 | env_var = match.group('env_var') |
| 296 | logger.debug("env_var: %s" % env_var) | 306 | logger.debug("env_var: %s" % env_var) |
| 297 | env_val = match.group('env_val') | 307 | env_val = remove_quotes(match.group('env_val')) |
| 298 | logger.debug("env_val: %s" % env_val) | 308 | logger.debug("env_val: %s" % env_val) |
| 299 | os.environ[env_var] = env_val | 309 | os.environ[env_var] = env_val |
| 300 | 310 | ||
