summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2005-03-07 13:05:41 -0500
committerNathan Binkert <binkertn@umich.edu>2005-03-07 13:05:41 -0500
commit2b89c38172cafd0abc9b0f0b0e5db0ff3f398232 (patch)
tree93235db54621454c1def4f26d23ee0946a518bca /util
parente5f945967b2d49f3c14384be947a12dbf02260da (diff)
downloadgem5-2b89c38172cafd0abc9b0f0b0e5db0ff3f398232.tar.xz
Make it easier to find a jobfile.
util/pbs/jobfile.py: Search for the jobfile in sys.path --HG-- extra : convert_revision : 50d2c2c13b6b9de4f6bc4e833961e309a98b0d2b
Diffstat (limited to 'util')
-rw-r--r--util/pbs/jobfile.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/util/pbs/jobfile.py b/util/pbs/jobfile.py
index 570faa61b..83eb81358 100644
--- a/util/pbs/jobfile.py
+++ b/util/pbs/jobfile.py
@@ -26,7 +26,9 @@
#
# Authors: Nathan Binkert
-from os.path import expanduser
+from os.path import expanduser, isfile, join as joinpath
+import sys
+
def crossproduct(options):
number = len(options)
indexes = [ 0 ] * number
@@ -49,9 +51,16 @@ def crossproduct(options):
done = next()
class JobFile(object):
- def __init__(self, file):
+ def __init__(self, jfile):
self.data = {}
- execfile(expanduser(file), self.data)
+ jfile = expanduser(jfile)
+ if not isfile(jfile):
+ for p in sys.path:
+ if isfile(joinpath(p, jfile)):
+ jfile = joinpath(p, jfile)
+ break
+
+ execfile(jfile, self.data)
self.options = self.data['options']
self.environment = self.data['environment']
self.jobinfo = {}