~cjwatson/germinate/old-mainline

« back to all changes in this revision

Viewing changes to Germinate/germinator.py

  • Committer: Colin Watson
  • Date: 2011-10-22 00:43:33 UTC
  • Revision ID: cjwatson@canonical.com-20111022004333-xlt1rswl8fzhxtx6
Turn open_seed into a Seed class, allowing it to be a context manager.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
import apt_pkg
28
28
 
29
29
from Germinate.archive import IndexType
30
 
import Germinate.seeds
 
30
from Germinate.seeds import Seed
31
31
import Germinate.tsort
32
32
 
33
33
# TODO: would be much more elegant to reduce our recursion depth!
170
170
            return all_names, all_inherit, all_branches, all_structure
171
171
 
172
172
        # Fetch this one
173
 
        seed = Germinate.seeds.open_seed(seed_base, branch, "STRUCTURE", bzr)
174
 
        try:
 
173
        with Seed(seed_base, branch, "STRUCTURE", bzr) as seed:
175
174
            names, inherit, branches, structure = self.parseStructureFile(seed)
176
 
        finally:
177
 
            seed.close()
178
175
        branches.insert(0, branch)
179
176
        got_branches.add(branch)
180
177