~xnox/ubuntu-dev-tools/py3k

« back to all changes in this revision

Viewing changes to ubuntutools/sponsor_patch/source_package.py

  • Committer: Dimitri John Ledkov
  • Date: 2014-12-19 22:37:04 UTC
  • mfrom: (1421.1.33 ubuntu-dev-tools)
  • Revision ID: dimitri.j.ledkov@intel.com-20141219223704-bi23kp10gcfl6wht
Port ubuntutools module to python3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
16
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
17
 
 
18
from __future__ import print_function
 
19
 
18
20
import os
19
21
import re
20
22
import sys
301
303
           bug title."""
302
304
 
303
305
        if not task.title_contains(self._version):
304
 
            print "Bug #%i title: %s" % (bug_number, task.get_bug_title())
 
306
            print("Bug #%i title: %s" % (bug_number, task.get_bug_title()))
305
307
            msg = "Is %s %s the version that should be synced" % (self._package,
306
308
                                                                  self._version)
307
309
            answer =  YesNoQuestion().ask(msg, "no")
349
351
 
350
352
        assert os.path.isfile(self._changes_file), "%s does not exist." % \
351
353
               (self._changes_file)
352
 
        changes = debian.deb822.Changes(file(self._changes_file))
 
354
        changes = debian.deb822.Changes(open(self._changes_file))
353
355
        fixed_bugs = []
354
356
        if "Launchpad-Bugs-Fixed" in changes:
355
357
            fixed_bugs = changes["Launchpad-Bugs-Fixed"].split(" ")
370
372
        """Print things that should be checked before uploading a package."""
371
373
 
372
374
        lintian_filename = self._run_lintian()
373
 
        print "\nPlease check %s %s carefully:" % (self._package, self._version)
 
375
        print("\nPlease check %s %s carefully:" % (self._package, self._version))
374
376
        if os.path.isfile(self._debdiff_filename):
375
 
            print "file://" + self._debdiff_filename
376
 
        print "file://" + lintian_filename
 
377
            print("file://" + self._debdiff_filename)
 
378
        print("file://" + lintian_filename)
377
379
        if self._build_log:
378
 
            print "file://" + self._build_log
 
380
            print("file://" + self._build_log)
379
381
 
380
382
        harvest = Harvest(self._package)
381
383
        if harvest.data:
382
 
            print harvest.report()
 
384
            print(harvest.report())
383
385
 
384
386
    def reload_changelog(self):
385
387
        """Reloads debian/changelog and updates the version.
391
393
        # Check the changelog
392
394
        self._changelog = debian.changelog.Changelog()
393
395
        try:
394
 
            self._changelog.parse_changelog(file("debian/changelog"),
 
396
            self._changelog.parse_changelog(open("debian/changelog"),
395
397
                                            max_blocks=1, strict=True)
396
 
        except debian.changelog.ChangelogParseError, error:
 
398
        except debian.changelog.ChangelogParseError as error:
397
399
            Logger.error("The changelog entry doesn't validate: %s", str(error))
398
400
            ask_for_manual_fixing()
399
401
            return False