Guido van Rossum | 31104f4 | 1992-01-14 18:28:36 +0000 | [diff] [blame^] | 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 path or macpath |
| 6 | # - os.name is either 'posix' or 'mac' |
| 7 | # - os.curdir is a string representing the current directory ('.' or ':') |
| 8 | |
| 9 | # Programs that import and use 'os' stand a better chance of being |
| 10 | # portable between different platforms. Of course, they must then |
| 11 | # only use functions that are defined by all platforms (e.g., unlink |
| 12 | # and opendir), and leave all pathname manipulation to os.path |
| 13 | # (e.g., split and join). |
| 14 | |
| 15 | try: |
| 16 | from posix import * |
| 17 | name = 'posix' |
| 18 | curdir = '.' |
| 19 | import path |
| 20 | except ImportError: |
| 21 | from mac import * |
| 22 | name = 'mac' |
| 23 | curdir = ':' |
| 24 | import macpath |
| 25 | path = macpath |
| 26 | del macpath |