| 232 | # Python, some still run the sshuttle server on remote machines |
| 233 | # with old versions of python. |
| 234 | def _which(file, mode=os.F_OK | os.X_OK, path=None): |
| 235 | if path is not None: |
| 236 | search_paths = path.split(os.pathsep) |
| 237 | elif "PATH" in os.environ: |
| 238 | search_paths = os.environ["PATH"].split(os.pathsep) |
| 239 | else: |
| 240 | search_paths = os.defpath.split(os.pathsep) |
| 241 | |
| 242 | for p in search_paths: |
| 243 | filepath = os.path.join(p, file) |
| 244 | if os.path.exists(filepath) and os.access(filepath, mode): |
| 245 | return filepath |
| 246 | return None |
| 247 | |
| 248 | |
| 249 | def which(file, mode=os.F_OK | os.X_OK): |