Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(9)

Side by Side Diff: Lib/os.py

Issue 16353: add function to os module for getting path to default shell
Patch Set: Created 3 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Modules/posixmodule.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 r"""OS routines for NT or Posix depending on what system we're on. 1 r"""OS routines for NT or Posix depending on what system we're on.
2 2
3 This exports: 3 This exports:
4 - all functions from posix, nt or ce, e.g. unlink, stat, etc. 4 - all functions from posix, nt or ce, e.g. unlink, stat, etc.
5 - os.path is either posixpath or ntpath 5 - os.path is either posixpath or ntpath
6 - os.name is either 'posix', 'nt' or 'ce'. 6 - os.name is either 'posix', 'nt' or 'ce'.
7 - os.curdir is a string representing the current directory ('.' or ':') 7 - os.curdir is a string representing the current directory ('.' or ':')
8 - os.pardir is a string representing the parent directory ('..' or '::') 8 - os.pardir is a string representing the parent directory ('..' or '::')
9 - os.sep is the (or a most common) pathname separator ('/' or ':' or '\\') 9 - os.sep is the (or a most common) pathname separator ('/' or ':' or '\\')
10 - os.extsep is the extension separator (always '.') 10 - os.extsep is the extension separator (always '.')
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 _add("HAVE_FSTATAT", "stat") 195 _add("HAVE_FSTATAT", "stat")
196 _add("HAVE_UTIMENSAT", "utime") 196 _add("HAVE_UTIMENSAT", "utime")
197 _add("MS_WINDOWS", "stat") 197 _add("MS_WINDOWS", "stat")
198 supports_follow_symlinks = _set 198 supports_follow_symlinks = _set
199 199
200 del _set 200 del _set
201 del _have_functions 201 del _have_functions
202 del _globals 202 del _globals
203 del _add 203 del _add
204 204
205
206 if sys.platform == 'win32':
207 default_shell = 'cmd.exe'
Michael.Felt 2016/07/29 14:40:15 Has cmd.exe moved around too much to not specify a
eryksun 2016/07/29 15:03:28 It should be environ['ComSpec'], for which the def
208 elif _exists('is_android') and is_android:
209 default_shell = '/system/bin/sh'
210 else:
211 default_shell = '/bin/sh'
205 212
206 # Python uses fixed values for the SEEK_ constants; they are mapped 213 # Python uses fixed values for the SEEK_ constants; they are mapped
207 # to native constants if necessary in posixmodule.c 214 # to native constants if necessary in posixmodule.c
208 # Other possible SEEK values are directly imported from posixmodule.c 215 # Other possible SEEK values are directly imported from posixmodule.c
209 SEEK_SET = 0 216 SEEK_SET = 0
210 SEEK_CUR = 1 217 SEEK_CUR = 1
211 SEEK_END = 2 218 SEEK_END = 2
212 219
213 # Super directory utilities. 220 # Super directory utilities.
214 # (Inspired by Eric Raymond; the doc strings are mostly his) 221 # (Inspired by Eric Raymond; the doc strings are mostly his)
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 return getattr(self._stream, name) 1097 return getattr(self._stream, name)
1091 def __iter__(self): 1098 def __iter__(self):
1092 return iter(self._stream) 1099 return iter(self._stream)
1093 1100
1094 # Supply os.fdopen() 1101 # Supply os.fdopen()
1095 def fdopen(fd, *args, **kwargs): 1102 def fdopen(fd, *args, **kwargs):
1096 if not isinstance(fd, int): 1103 if not isinstance(fd, int):
1097 raise TypeError("invalid fd type (%s, expected integer)" % type(fd)) 1104 raise TypeError("invalid fd type (%s, expected integer)" % type(fd))
1098 import io 1105 import io
1099 return io.open(fd, *args, **kwargs) 1106 return io.open(fd, *args, **kwargs)
OLDNEW
« no previous file with comments | « no previous file | Modules/posixmodule.c » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+