Skip to content

Commit

Permalink
2to3 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gianelle committed Jan 17, 2023
1 parent 61e2013 commit aa4fb25
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ilcsoft/marlin.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ def writeEnv(self, f, checked):
else:
checked.append( self.name )

if self.env or sum(map(len, self.envpath.values()), 0):
if self.env or sum(list(map(len, list(self.envpath.values()))), 0):
f.write( 2*os.linesep + "#" + 80*'-' + os.linesep + "#" + 5*' ' \
+ self.name + os.linesep + "#" + 80*'-' + os.linesep )

# first write the priority values
for k in self.envorder:
f.write( "export " + str(k) + "=\"" + str(self.env[k]) + "\"" + os.linesep )
# then write the rest
for k, v in self.env.iteritems():
for k, v in self.env.items():
if k not in self.envorder:
f.write( "export " + str(k) + "=\"" + str(self.env[k]) + "\"" + os.linesep )

Expand All @@ -108,11 +108,11 @@ def writeEnv(self, f, checked):
# list of "trivial" paths we do not want to add again to PATH and co
ignorepaths = ['/usr/bin','/usr/lib','/sbin','/usr/sbin']
# path environment variables
for k, v in self.envpath.iteritems():
for k, v in self.envpath.items():
if( len(v) != 0 ):
# expand every variable we introduced previously
exp = str().join(v)
for e, ev in self.env.iteritems():
for e, ev in self.env.items():
p = re.compile(r"\$"+str(e)) # compile regular expression to match shell variable
exp = p.sub(str(ev), exp) # replace with expanded variable for absolute path
# check for match
Expand Down

0 comments on commit aa4fb25

Please sign in to comment.