2006-06-18 00:14:16 +02:00
|
|
|
import os, sys
|
|
|
|
from os.path import isdir, join as joinpath
|
|
|
|
from os import environ as env
|
|
|
|
|
2006-07-13 21:48:17 +02:00
|
|
|
def disk(file):
|
|
|
|
system()
|
|
|
|
return joinpath(disk.dir, file)
|
|
|
|
|
|
|
|
def binary(file):
|
|
|
|
system()
|
|
|
|
return joinpath(binary.dir, file)
|
2006-06-18 00:14:16 +02:00
|
|
|
|
2006-07-13 21:48:17 +02:00
|
|
|
def script(file):
|
|
|
|
system()
|
|
|
|
return joinpath(script.dir, file)
|
|
|
|
|
|
|
|
def system():
|
|
|
|
if not system.dir:
|
2006-06-18 00:14:16 +02:00
|
|
|
try:
|
|
|
|
path = env['M5_PATH'].split(':')
|
|
|
|
except KeyError:
|
2006-06-18 17:10:08 +02:00
|
|
|
path = [ '/dist/m5/system', '/n/poolfs/z/dist/m5/system' ]
|
2006-06-18 00:14:16 +02:00
|
|
|
|
2006-07-13 21:48:17 +02:00
|
|
|
for system.dir in path:
|
|
|
|
if os.path.isdir(system.dir):
|
2006-06-18 00:14:16 +02:00
|
|
|
break
|
|
|
|
else:
|
|
|
|
raise ImportError, "Can't find a path to system files."
|
|
|
|
|
2006-07-13 21:48:17 +02:00
|
|
|
if not binary.dir:
|
|
|
|
binary.dir = joinpath(system.dir, 'binaries')
|
|
|
|
if not disk.dir:
|
|
|
|
disk.dir = joinpath(system.dir, 'disks')
|
|
|
|
if not script.dir:
|
|
|
|
script.dir = joinpath(system.dir, 'boot')
|
|
|
|
|
|
|
|
system.dir = None
|
|
|
|
binary.dir = None
|
|
|
|
disk.dir = None
|
|
|
|
script.dir = None
|