os.py revision 7a461e5aaf011243d9ac2658e4172e316b031eb9
1# os.py -- either mac or posix depending on what system we're on. 2 3# This exports: 4# - all functions from either posix or mac, e.g., os.unlink, os.stat, etc. 5# - os.path is either module posixpath or macpath 6# - os.name is either 'posix' or 'mac' 7# - os.curdir is a string representing the current 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 ':') 10 11# Programs that import and use 'os' stand a better chance of being 12# portable between different platforms. Of course, they must then 13# only use functions that are defined by all platforms (e.g., unlink 14# and opendir), and leave all pathname manipulation to os.path 15# (e.g., split and join). 16 17# XXX This will need to distinguish between real posix and MS-DOS emulation 18 19try: 20 from posix import * 21 from posix import _exit 22 name = 'posix' 23 curdir = '.' 24 pardir = '..' 25 sep = '/' 26 import posixpath 27 path = posixpath 28 del posixpath 29except ImportError: 30 from mac import * 31 name = 'mac' 32 curdir = ':' 33 pardir = '::' 34 sep = ':' 35 import macpath 36 path = macpath 37 del macpath 38