Skip to content

Commit bdef732

Browse files
committed
Test that we have an executable *file*
Fixes #939
1 parent c9270bf commit bdef732

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

virtualenv.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,6 +1547,7 @@ def resolve_interpreter(exe):
15471547
"""
15481548
# If the "executable" is a version number, get the installed executable for
15491549
# that version
1550+
orig_exe = exe
15501551
python_versions = get_installed_pythons()
15511552
if exe in python_versions:
15521553
exe = python_versions[exe]
@@ -1558,16 +1559,16 @@ def resolve_interpreter(exe):
15581559
exe = join(path, exe)
15591560
break
15601561
if not os.path.exists(exe):
1561-
logger.fatal('The executable %s (from --python=%s) does not exist' % (exe, exe))
1562+
logger.fatal('The path %s (from --python=%s) does not exist' % (exe, orig_exe))
15621563
raise SystemExit(3)
15631564
if not is_executable(exe):
1564-
logger.fatal('The executable %s (from --python=%s) is not executable' % (exe, exe))
1565+
logger.fatal('The path %s (from --python=%s) is not an executable file' % (exe, orig_exe))
15651566
raise SystemExit(3)
15661567
return exe
15671568

15681569
def is_executable(exe):
15691570
"""Checks a file is executable"""
1570-
return os.access(exe, os.X_OK)
1571+
return os.path.isfile(exe) and os.access(exe, os.X_OK)
15711572

15721573
############################################################
15731574
## Relocating the environment:

0 commit comments

Comments
 (0)