~ubuntu-core-dev/ubuntu/xenial/ubuntu-release-upgrader/xenial

« back to all changes in this revision

Viewing changes to DistUpgrade/DistUpgradeConfigParser.py

  • Committer: Dimitri John Ledkov
  • Date: 2015-01-20 22:30:06 UTC
  • mto: This revision was merged to the branch mainline in revision 2859.
  • Revision ID: dimitri.j.ledkov@intel.com-20150120223006-ba30fbqtp4x2n0og
Fix resource warnings & logging.warn deprecation warning.

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
        p = os.path.join(self.datadir, filename)
87
87
        if not os.path.exists(p):
88
88
            logging.error("getListFromFile: no '%s' found" % p)
89
 
        items = [x.strip() for x in open(p)]
 
89
        with open(p) as f:
 
90
            items = [x.strip() for x in f]
90
91
        return [s for s in items if not s.startswith("#") and not s == ""]
91
92
 
92
93