aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2014-09-20 18:14:40 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2014-09-20 18:14:40 +0300
commit76997caee2d85b63026b026a8b8a62673f7ceb09 (patch)
tree83a86fe4330a8b5e1ed4fb37bd28e2fd740482f8
parent77c14525c39b9f1e020cd48827127d0a65deb59c (diff)
downloadmeson-76997caee2d85b63026b026a8b8a62673f7ceb09.zip
meson-76997caee2d85b63026b026a8b8a62673f7ceb09.tar.gz
meson-76997caee2d85b63026b026a8b8a62673f7ceb09.tar.bz2
Run scripts direct if possible.
-rw-r--r--dependencies.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/dependencies.py b/dependencies.py
index f11628e..ca264e2 100644
--- a/dependencies.py
+++ b/dependencies.py
@@ -139,17 +139,18 @@ class ExternalProgram():
trial = os.path.join(search_dir, name)
if os.access(trial, os.X_OK):
self.fullpath = [trial]
- # Now getting desperate. Maybe it is a script file that is a) not chmodded
- # executable or b) we are on windows so they can't be directly executed.
- try:
- first_line = open(trial).readline().strip()
- if first_line.startswith('#!'):
- commands = first_line[2:].split('#')[0].strip().split()
- if environment.is_windows():
- commands[0] = commands[0].split('/')[-1] # Windows does not have /usr/bin.
- self.fullpath = commands + [trial]
- except Exception:
- pass
+ else:
+ # Now getting desperate. Maybe it is a script file that is a) not chmodded
+ # executable or b) we are on windows so they can't be directly executed.
+ try:
+ first_line = open(trial).readline().strip()
+ if first_line.startswith('#!'):
+ commands = first_line[2:].split('#')[0].strip().split()
+ if environment.is_windows():
+ commands[0] = commands[0].split('/')[-1] # Windows does not have /usr/bin.
+ self.fullpath = commands + [trial]
+ except Exception:
+ pass
if not silent:
if self.found():
mlog.log('Program', mlog.bold(name), 'found:', mlog.green('YES'), '(%s)' % ' '.join(self.fullpath))