Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Side by Side Diff: third_party/twisted_8_1/twisted/python/procutils.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4 """
5 Utilities for dealing with processes.
6 """
7
8 import os
9
10 def which(name, flags=os.X_OK):
11 """Search PATH for executable files with the given name.
12
13 On newer versions of MS-Windows, the PATHEXT environment variable will be
14 set to the list of file extensions for files considered executable. This
15 will normally include things like ".EXE". This fuction will also find files
16 with the given name ending with any of these extensions.
17
18 On MS-Windows the only flag that has any meaning is os.F_OK. Any other
19 flags will be ignored.
20
21 @type name: C{str}
22 @param name: The name for which to search.
23
24 @type flags: C{int}
25 @param flags: Arguments to L{os.access}.
26
27 @rtype: C{list}
28 @param: A list of the full paths to files found, in the
29 order in which they were found.
30 """
31 result = []
32 exts = filter(None, os.environ.get('PATHEXT', '').split(os.pathsep))
33 path = os.environ.get('PATH', None)
34 if path is None:
35 return []
36 for p in os.environ.get('PATH', '').split(os.pathsep):
37 p = os.path.join(p, name)
38 if os.access(p, flags):
39 result.append(p)
40 for e in exts:
41 pext = p + e
42 if os.access(pext, flags):
43 result.append(pext)
44 return result
45
OLDNEW
« no previous file with comments | « third_party/twisted_8_1/twisted/python/plugin.py ('k') | third_party/twisted_8_1/twisted/python/randbytes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698