os.py revision 1a76ef260df9378d796ca85b08fcecdd134ff6b6
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
10# Programs that import and use 'os' stand a better chance of being
11# portable between different platforms.  Of course, they must then
12# only use functions that are defined by all platforms (e.g., unlink
13# and opendir), and leave all pathname manipulation to os.path
14# (e.g., split and join).
15
16# XXX This will need to distinguish between real posix and MS-DOS emulation
17
18try:
19	from posix import *
20	name = 'posix'
21	curdir = '.'
22	pardir = '..'
23	import posixpath
24	path = posixpath
25	del posixpath
26except ImportError:
27	from mac import *
28	name = 'mac'
29	curdir = ':'
30	pardir = '::'
31	import macpath
32	path = macpath
33	del macpath
34