diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2015-01-22 13:52:28 -0800 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2015-01-22 13:52:28 -0800 |
commit | e6b4530234dc9c32fc69a0dae21cf8c28ce33804 (patch) | |
tree | bfa8da82dc472dff8903ffa62142294f455aa703 /lib | |
parent | 4e3662f3188df8c9b6631caf7802e5ece3960b39 (diff) | |
download | spack-e6b4530234dc9c32fc69a0dae21cf8c28ce33804.tar.gz spack-e6b4530234dc9c32fc69a0dae21cf8c28ce33804.tar.bz2 spack-e6b4530234dc9c32fc69a0dae21cf8c28ce33804.tar.xz spack-e6b4530234dc9c32fc69a0dae21cf8c28ce33804.zip |
Add is_exe function to filesystem.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/llnl/util/filesystem.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py index 9f08832598..0578415653 100644 --- a/lib/spack/llnl/util/filesystem.py +++ b/lib/spack/llnl/util/filesystem.py @@ -24,7 +24,7 @@ ############################################################################## __all__ = ['set_install_permissions', 'install', 'expand_user', 'working_dir', 'touch', 'mkdirp', 'force_remove', 'join_path', 'ancestor', - 'can_access', 'filter_file', 'change_sed_delimiter'] + 'can_access', 'filter_file', 'change_sed_delimiter', 'is_exe'] import os import sys @@ -154,6 +154,11 @@ def install(src, dest): os.chmod(dest, dest_mode) +def is_exe(path): + """True if path is an executable file.""" + return os.path.isfile(path) and os.access(path, os.X_OK) + + def expand_user(path): """Find instances of '%u' in a path and replace with the current user's username.""" |