[Python-checkins] python/dist/src/Lib os.py,1.66,1.67 os2emxpath.py,1.9,1.10 posixpath.py,1.57,1.58 macpath.py,1.45,1.46 ntpath.py,1.54,1.55

montanaro@users.sourceforge.net montanaro@users.sourceforge.net
Fri, 14 Feb 2003 11:35:32 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv18517/Lib

Modified Files:
	os.py os2emxpath.py posixpath.py macpath.py ntpath.py 
Log Message:
Migrate definitions of several platform-dependent path-related variables
into the relevant path modules.  See patch #686397.


Index: os.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -d -r1.66 -r1.67
*** os.py	29 Jan 2003 03:49:43 -0000	1.66
--- os.py	14 Feb 2003 19:35:29 -0000	1.67
***************
*** 27,34 ****
  _names = sys.builtin_module_names
  
- altsep = None
- 
  __all__ = ["altsep", "curdir", "pardir", "sep", "pathsep", "linesep",
!            "defpath", "name"]
  
  def _get_exports_list(module):
--- 27,32 ----
  _names = sys.builtin_module_names
  
  __all__ = ["altsep", "curdir", "pardir", "sep", "pathsep", "linesep",
!            "defpath", "name", "path"]
  
  def _get_exports_list(module):
***************
*** 41,46 ****
      name = 'posix'
      linesep = '\n'
-     curdir = '.'; pardir = '..'; sep = '/'; pathsep = ':'
-     defpath = ':/bin:/usr/bin'
      from posix import *
      try:
--- 39,42 ----
***************
*** 48,55 ****
      except ImportError:
          pass
!     import posixpath
!     path = posixpath
!     del posixpath
! 
      import posix
      __all__.extend(_get_exports_list(posix))
--- 44,49 ----
      except ImportError:
          pass
!     import posixpath as path
!     
      import posix
      __all__.extend(_get_exports_list(posix))
***************
*** 59,64 ****
      name = 'nt'
      linesep = '\r\n'
-     curdir = '.'; pardir = '..'; sep = '\\'; pathsep = ';'
-     defpath = '.;C:\\bin'
      from nt import *
      try:
--- 53,56 ----
***************
*** 66,73 ****
      except ImportError:
          pass
!     import ntpath
!     path = ntpath
!     del ntpath
! 
      import nt
      __all__.extend(_get_exports_list(nt))
--- 58,63 ----
      except ImportError:
          pass
!     import ntpath as path
!     
      import nt
      __all__.extend(_get_exports_list(nt))
***************
*** 77,88 ****
      name = 'os2'
      linesep = '\r\n'
-     curdir = '.'; pardir = '..'; pathsep = ';'
-     if sys.version.find('EMX GCC') == -1:
-         # standard OS/2 compiler (VACPP or Watcom?)
-         sep = '\\'; altsep = '/'
-     else:
-         # EMX
-         sep = '/'; altsep = '\\'
-     defpath = '.;C:\\bin'
      from os2 import *
      try:
--- 67,70 ----
***************
*** 91,102 ****
          pass
      if sys.version.find('EMX GCC') == -1:
!         import ntpath
!         path = ntpath
!         del ntpath
      else:
!         import os2emxpath
!         path = os2emxpath
!         del os2emxpath
! 
      import os2
      __all__.extend(_get_exports_list(os2))
--- 73,80 ----
          pass
      if sys.version.find('EMX GCC') == -1:
!         import ntpath as path
      else:
!         import os2emxpath as path
!     
      import os2
      __all__.extend(_get_exports_list(os2))
***************
*** 106,111 ****
      name = 'mac'
      linesep = '\r'
-     curdir = ':'; pardir = '::'; sep = ':'; pathsep = '\n'
-     defpath = ':'
      from mac import *
      try:
--- 84,87 ----
***************
*** 113,120 ****
      except ImportError:
          pass
!     import macpath
!     path = macpath
!     del macpath
! 
      import mac
      __all__.extend(_get_exports_list(mac))
--- 89,94 ----
      except ImportError:
          pass
!     import macpath as path
!     
      import mac
      __all__.extend(_get_exports_list(mac))
***************
*** 124,129 ****
      name = 'ce'
      linesep = '\r\n'
-     curdir = '.'; pardir = '..'; sep = '\\'; pathsep = ';'
-     defpath = '\\Windows'
      from ce import *
      try:
--- 98,101 ----
***************
*** 132,139 ****
          pass
      # We can use the standard Windows path.
!     import ntpath
!     path = ntpath
!     del ntpath
! 
      import ce
      __all__.extend(_get_exports_list(ce))
--- 104,109 ----
          pass
      # We can use the standard Windows path.
!     import ntpath as path
!     
      import ce
      __all__.extend(_get_exports_list(ce))
***************
*** 143,148 ****
      name = 'riscos'
      linesep = '\n'
-     curdir = '@'; pardir = '^'; sep = '.'; pathsep = ','
-     defpath = '<Run$Dir>'
      from riscos import *
      try:
--- 113,116 ----
***************
*** 150,157 ****
      except ImportError:
          pass
!     import riscospath
!     path = riscospath
!     del riscospath
! 
      import riscos
      __all__.extend(_get_exports_list(riscos))
--- 118,123 ----
      except ImportError:
          pass
!     import riscospath as path
!     
      import riscos
      __all__.extend(_get_exports_list(riscos))
***************
*** 161,175 ****
      raise ImportError, 'no os specific module found'
  
! 
! if sep=='.':
!     extsep = '/'
! else:
!     extsep = '.'
! 
! __all__.append("path")
  
  del _names
- 
- sys.modules['os.path'] = path
  
  #'
--- 127,134 ----
      raise ImportError, 'no os specific module found'
  
! sys.modules['os.path'] = path
! from os.path import curdir, pardir, sep, pathsep, defpath, extsep, altsep
  
  del _names
  
  #'

Index: os2emxpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/os2emxpath.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** os2emxpath.py	3 Jan 2003 18:01:57 -0000	1.9
--- os2emxpath.py	14 Feb 2003 19:35:30 -0000	1.10
***************
*** 13,17 ****
--- 13,27 ----
             "getatime","getctime", "islink","exists","isdir","isfile","ismount",
             "walk","expanduser","expandvars","normpath","abspath","splitunc",
+            "curdir","pardir","sep","pathsep","defpath","altsep","extsep",
             "realpath","supports_unicode_filenames"]
+ 
+ # strings representing various path-related bits and pieces
+ curdir = '.'
+ pardir = '..'
+ extsep = '.'
+ sep = '/'
+ altsep = '\\'
+ pathsep = ';'
+ defpath = '.;C:\\bin'
  
  # Normalize the case of a pathname and map slashes to backslashes.

Index: posixpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/posixpath.py,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -d -r1.57 -r1.58
*** posixpath.py	3 Jan 2003 18:01:57 -0000	1.57
--- posixpath.py	14 Feb 2003 19:35:30 -0000	1.58
***************
*** 19,23 ****
--- 19,33 ----
             "walk","expanduser","expandvars","normpath","abspath",
             "samefile","sameopenfile","samestat",
+            "curdir","pardir","sep","pathsep","defpath","altsep","extsep",
             "realpath","supports_unicode_filenames"]
+ 
+ # strings representing various path-related bits and pieces
+ curdir = '.'
+ pardir = '..'
+ extsep = '.'
+ sep = '/'
+ pathsep = ':'
+ defpath = ':/bin:/usr/bin'
+ altsep = None
  
  # Normalize the case of a pathname.  Trivial in Posix, string.lower on Mac.

Index: macpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/macpath.py,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** macpath.py	29 Jan 2003 03:49:43 -0000	1.45
--- macpath.py	14 Feb 2003 19:35:30 -0000	1.46
***************
*** 8,12 ****
--- 8,22 ----
             "getatime","getctime", "islink","exists","isdir","isfile",
             "walk","expanduser","expandvars","normpath","abspath",
+            "curdir","pardir","sep","pathsep","defpath","altsep","extsep",
             "realpath","supports_unicode_filenames"]
+ 
+ # strings representing various path-related bits and pieces
+ curdir = ':'
+ pardir = '::'
+ extsep = '.'
+ sep = ':'
+ pathsep = '\n'
+ defpath = ':'
+ altsep = None
  
  # Normalize the case of a pathname.  Dummy in Posix, but <s>.lower() here.

Index: ntpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/ntpath.py,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -d -r1.54 -r1.55
*** ntpath.py	3 Jan 2003 18:01:56 -0000	1.54
--- ntpath.py	14 Feb 2003 19:35:30 -0000	1.55
***************
*** 14,18 ****
--- 14,34 ----
             "getatime","getctime", "islink","exists","isdir","isfile","ismount",
             "walk","expanduser","expandvars","normpath","abspath","splitunc",
+            "curdir","pardir","sep","pathsep","defpath","altsep","extsep",
             "realpath","supports_unicode_filenames"]
+ 
+ # strings representing various path-related bits and pieces
+ curdir = '.'
+ pardir = '..'
+ extsep = '.'
+ sep = '\\'
+ pathsep = ';'
+ altsep = None
+ if 'ce' in sys.builtin_module_names:
+     defpath = '\\Windows'
+ elif 'os2' in sys.builtin_module_names:
+     # OS/2 w/ EMX
+     altsep = '/'
+ else:
+     defpath = '.;C:\\bin'
  
  # Normalize the case of a pathname and map slashes to backslashes.