X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fcontents.py;h=08b09cb3aac0958209f54b66620c0f376799e71c;hb=0d69fff35ef45fda573467873ae2f01ca1954650;hp=f9c1feb15708464e7e6a91e940d5552e8afa8dee;hpb=1eeb90f6bf381e10fcd8f0a04437883b443855d5;p=dak.git diff --git a/daklib/contents.py b/daklib/contents.py index f9c1feb1..08b09cb3 100644 --- a/daklib/contents.py +++ b/daklib/contents.py @@ -134,14 +134,9 @@ select bc.file, string_agg(o.section || '/' || b.package, ',' order by b.package ''' Returns the header for the Contents files as a string. ''' - header_file = None - try: - filename = os.path.join(Config()['Dir::Templates'], 'contents') - header_file = open(filename) + filename = os.path.join(Config()['Dir::Templates'], 'contents') + with open(filename) as header_file: return header_file.read() - finally: - if header_file: - header_file.close() def write_file(self): '''