diff options
author | Pearu Peterson <pearu.peterson@gmail.com> | 2004-04-22 16:58:48 +0000 |
---|---|---|
committer | Pearu Peterson <pearu.peterson@gmail.com> | 2004-04-22 16:58:48 +0000 |
commit | bf5e48a4e989d558056a55ab7a7e265bf0af3bd6 (patch) | |
tree | 41fbdc85a87964a8fddbc1538a3e86d542c0b826 /scipy_distutils/exec_command.py | |
parent | fb491c20e095e5b43d2fe498309b22689ae1cced (diff) | |
download | numpy-bf5e48a4e989d558056a55ab7a7e265bf0af3bd6.tar.gz |
Fixed find_executable(exe) when exe is symbolic link (as for example g77->/usr/bin/colorgcc).
Diffstat (limited to 'scipy_distutils/exec_command.py')
-rw-r--r-- | scipy_distutils/exec_command.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/scipy_distutils/exec_command.py b/scipy_distutils/exec_command.py index 6d482e269..40fcdcb79 100644 --- a/scipy_distutils/exec_command.py +++ b/scipy_distutils/exec_command.py @@ -155,11 +155,20 @@ def find_executable(exe, path=None): for path in paths: fn = os.path.join(path,exe) for s in suffices: - f_ext = realpath(fn+s) + f_ext = fn+s + if not os.path.islink(f_ext): + # see comment below. + f_ext = realpath(f_ext) if os.path.isfile(f_ext) and os.access(f_ext,os.X_OK): log.debug('Found executable %s' % f_ext) return f_ext - exe = realpath(exe) + if os.path.islink(exe): + # Don't follow symbolic links. E.g. when using colorgcc then + # gcc -> /usr/bin/colorgcc + # g77 -> /usr/bin/colorgcc + pass + else: + exe = realpath(exe) if not os.path.isfile(exe) or os.access(exe,os.X_OK): log.warn('Could not locate executable %s' % orig_exe) return orig_exe |