Skip to content

Commit

Permalink
Checks if a relative link needs to be updated by parameter type [#37 …
Browse files Browse the repository at this point in the history
…state:resolved]
  • Loading branch information
Mark Fiers committed Aug 8, 2011
1 parent aa12121 commit f79f8c5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/python/moa/jobConf.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def load(self, confFile, delta=None):
try to correct for this. Currently this only works
for files that exist. i.e.
"""
"""
y = Yaco.Yaco()
y.load(confFile)

Expand All @@ -235,19 +235,26 @@ def load(self, confFile, delta=None):
return

normdelta = os.path.normpath(delta)

if y.has_key('jobid'):
self.setPrivateVar('_%s' % y['jobid'], normdelta)

#print self.job.template.parameters.keys()
#find relative links & see if they need to be adjusted
for k, v in y.items():


#check if this needs to be editted or not
parType = self.job.template.parameters.get(k, {}).get('type')
isFileSet = k in self.job.template.filesets.keys()
if not (parType == 'file' or parType == 'directory' or isFileSet):
continue

#find potential relative links
if not isinstance(v, str): continue
if not v: continue
if not (v[:2] == './' or v[:3] == '../'):
continue

correctedPath = os.path.normpath(delta + '/' + v)
relPath = os.path.relpath(correctedPath)

Expand Down

0 comments on commit f79f8c5

Please sign in to comment.