@@ -243,27 +243,29 @@ def _dist_try_harder(distname, version, id):
243
243
if os .path .exists ('/var/adm/inst-log/info' ):
244
244
# SuSE Linux stores distribution information in that file
245
245
distname = 'SuSE'
246
- for line in open ('/var/adm/inst-log/info' ):
247
- tv = line .split ()
248
- if len (tv ) == 2 :
249
- tag , value = tv
250
- else :
251
- continue
252
- if tag == 'MIN_DIST_VERSION' :
253
- version = value .strip ()
254
- elif tag == 'DIST_IDENT' :
255
- values = value .split ('-' )
256
- id = values [2 ]
246
+ with open ('/var/adm/inst-log/info' ) as f :
247
+ for line in f :
248
+ tv = line .split ()
249
+ if len (tv ) == 2 :
250
+ tag , value = tv
251
+ else :
252
+ continue
253
+ if tag == 'MIN_DIST_VERSION' :
254
+ version = value .strip ()
255
+ elif tag == 'DIST_IDENT' :
256
+ values = value .split ('-' )
257
+ id = values [2 ]
257
258
return distname , version , id
258
259
259
260
if os .path .exists ('/etc/.installed' ):
260
261
# Caldera OpenLinux has some infos in that file (thanks to Colin Kong)
261
- for line in open ('/etc/.installed' ):
262
- pkg = line .split ('-' )
263
- if len (pkg ) >= 2 and pkg [0 ] == 'OpenLinux' :
264
- # XXX does Caldera support non Intel platforms ? If yes,
265
- # where can we find the needed id ?
266
- return 'OpenLinux' , pkg [1 ], id
262
+ with open ('/etc/.installed' ) as f :
263
+ for line in f :
264
+ pkg = line .split ('-' )
265
+ if len (pkg ) >= 2 and pkg [0 ] == 'OpenLinux' :
266
+ # XXX does Caldera support non Intel platforms ? If yes,
267
+ # where can we find the needed id ?
268
+ return 'OpenLinux' , pkg [1 ], id
267
269
268
270
if os .path .isdir ('/usr/lib/setup' ):
269
271
# Check for slackware version tag file (thanks to Greg Andruk)
0 commit comments