mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 19:31:26 -07:00
Replace os.access with stat calls for determining the executability of a given path.
This commit is contained in:
parent
734db4ffe9
commit
29ac1a8efc
3 changed files with 16 additions and 2 deletions
|
@ -32,6 +32,7 @@ import StringIO
|
|||
import imp
|
||||
import glob
|
||||
import subprocess
|
||||
import stat
|
||||
|
||||
VERBOSITY=0
|
||||
|
||||
|
@ -100,6 +101,12 @@ def check_conditional(conditional):
|
|||
return var.startswith("$")
|
||||
return eval(conditional)
|
||||
|
||||
def is_executable(path):
|
||||
'''is the given path executable?'''
|
||||
return (stat.S_IXUSR & os.stat(path)[stat.ST_MODE]
|
||||
or stat.S_IXGRP & os.stat(path)[stat.ST_MODE]
|
||||
or stat.S_IXOTH & os.stat(path)[stat.ST_MODE])
|
||||
|
||||
def prepare_writeable_dir(tree):
|
||||
''' make sure a directory exists and is writeable '''
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue