blob: 4212232c947bce6207beb587bc2c8959200ee626 [file] [log] [blame]
Guido van Rossum31104f41992-01-14 18:28:36 +00001# 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.
Guido van Rossum1a76ef21992-03-31 18:57:28 +00005# - os.path is either module posixpath or macpath
Guido van Rossum31104f41992-01-14 18:28:36 +00006# - os.name is either 'posix' or 'mac'
7# - os.curdir is a string representing the current directory ('.' or ':')
Guido van Rossum1a76ef21992-03-31 18:57:28 +00008# - os.pardir is a string representing the parent directory ('..' or '::')
Guido van Rossum31104f41992-01-14 18:28:36 +00009
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
Guido van Rossum1a76ef21992-03-31 18:57:28 +000016# XXX This will need to distinguish between real posix and MS-DOS emulation
17
Guido van Rossum31104f41992-01-14 18:28:36 +000018try:
19 from posix import *
20 name = 'posix'
21 curdir = '.'
Guido van Rossum1a76ef21992-03-31 18:57:28 +000022 pardir = '..'
23 import posixpath
24 path = posixpath
25 del posixpath
Guido van Rossum31104f41992-01-14 18:28:36 +000026except ImportError:
27 from mac import *
28 name = 'mac'
29 curdir = ':'
Guido van Rossum1a76ef21992-03-31 18:57:28 +000030 pardir = '::'
Guido van Rossum31104f41992-01-14 18:28:36 +000031 import macpath
32 path = macpath
33 del macpath