comparison tools/effectiveT3/effectiveT3.py @ 34:011cfce866f1 draft

planemo upload for repository https://github.com/peterjc/pico_galaxy/tree/master/tools/effectiveT3 commit 3ab3d1a9650dec0533344d710ceb027e482d2b10-dirty
author peterjc
date Fri, 09 Nov 2018 10:50:03 -0500
parents 1129cafdf0ae
children e2711662802b
comparison
equal deleted inserted replaced
33:8db22615d43f 34:011cfce866f1
100 try: 100 try:
101 from shutil import which 101 from shutil import which
102 except ImportError: 102 except ImportError:
103 # Likely running on Python 2, use backport: 103 # Likely running on Python 2, use backport:
104 def which(cmd, mode=os.F_OK | os.X_OK, path=None): 104 def which(cmd, mode=os.F_OK | os.X_OK, path=None):
105 """Given a command, mode, and a PATH string, return the path which 105 """Python implementation of command line tool which.
106
107 Given a command, mode, and a PATH string, return the path which
106 conforms to the given mode on the PATH, or None if there is no such 108 conforms to the given mode on the PATH, or None if there is no such
107 file. 109 file.
110
108 `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result 111 `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result
109 of os.environ.get("PATH"), or can be overridden with a custom search 112 of os.environ.get("PATH"), or can be overridden with a custom search
110 path. 113 path.
111 """ 114 """
112
113 # Check that a given file can be accessed with the correct mode. 115 # Check that a given file can be accessed with the correct mode.
114 # Additionally check that `file` is not a directory, as on Windows 116 # Additionally check that `file` is not a directory, as on Windows
115 # directories pass the os.access check. 117 # directories pass the os.access check.
116 def _access_check(fn, mode): 118 def _access_check(fn, mode):
117 return (os.path.exists(fn) and os.access(fn, mode) and 119 return (os.path.exists(fn) and os.access(fn, mode) and