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

« back to all changes in this revision

Viewing changes to DistUpgrade/DistUpgradeViewNonInteractive.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:
133
133
        if not os.path.exists(maintainer_script):
134
134
            logging.error("can not find failed maintainer script '%s' " % maintainer_script)
135
135
            return
136
 
        interp = open(maintainer_script).readline()[2:].strip().split()[0]
 
136
        with open(maintainer_script) as f:
 
137
            interp = f.readline()[2:].strip().split()[0]
137
138
        if ("bash" in interp) or ("/bin/sh" in interp):
138
139
            debug_opts = ["-ex"]
139
140
        elif ("perl" in interp):
143
144
            logging.warning("unknown interpreter: '%s'" % interp)
144
145
 
145
146
        # check if debconf is used and fiddle a bit more if it is
146
 
        if ". /usr/share/debconf/confmodule" in open(maintainer_script).read():
 
147
        with open(maintainer_script) as f:
 
148
            maintainer_script_text = f.read()
 
149
        if ". /usr/share/debconf/confmodule" in maintainer_script_text:
147
150
            environ["DEBCONF_DEBUG"] = "developer"
148
151
            environ["DEBIAN_HAS_FRONTEND"] = "1"
149
152
            interp = "/usr/share/debconf/frontend"