diff --git a/bodhi/server/consumers/masher.py b/bodhi/server/consumers/masher.py index 3d55bbe519..d4a9971dff 100644 --- a/bodhi/server/consumers/masher.py +++ b/bodhi/server/consumers/masher.py @@ -715,7 +715,7 @@ def sanity_check_repo(self): try: repodata = os.path.join(mash_path, arch, 'repodata') sanity_check_repodata(repodata) - except Exception, e: + except Exception as e: self.log.error("Repodata sanity check failed!\n%s" % str(e)) raise diff --git a/bodhi/server/models.py b/bodhi/server/models.py index a4e49c67ec..a4dedc73af 100644 --- a/bodhi/server/models.py +++ b/bodhi/server/models.py @@ -2974,7 +2974,7 @@ def expire(self): try: koji_session.untagBuild(self.build.release.override_tag, self.build.nvr, strict=True) - except Exception, e: + except Exception as e: log.error('Unable to untag override %s: %s' % (self.build.nvr, e)) self.expired_date = datetime.utcnow() diff --git a/bodhi/server/scripts/clean_old_mashes.py b/bodhi/server/scripts/clean_old_mashes.py index 5efcd65564..8218531995 100644 --- a/bodhi/server/scripts/clean_old_mashes.py +++ b/bodhi/server/scripts/clean_old_mashes.py @@ -59,8 +59,8 @@ def clean_up(): dirs_to_delete.extend(sorted(dirs, reverse=True)[NUM_TO_KEEP:]) if dirs_to_delete: - print 'Deleting the following directories:' + print('Deleting the following directories:') for d in dirs_to_delete: d = os.path.join(mash_dir, d) shutil.rmtree(d) - print d + print(d) diff --git a/bodhi/server/validators.py b/bodhi/server/validators.py index d7cc79f86f..d85f2d3b7a 100644 --- a/bodhi/server/validators.py +++ b/bodhi/server/validators.py @@ -385,7 +385,7 @@ def validate_acls(request): release.branch, config) committers, watchers = people groups, notify_groups = groups - except Exception, e: + except Exception as e: log.exception(e) request.errors.add('body', 'builds', "Unable to access the Package " diff --git a/bodhi/tests/server/__init__.py b/bodhi/tests/server/__init__.py index 18eba0435a..604670f68b 100644 --- a/bodhi/tests/server/__init__.py +++ b/bodhi/tests/server/__init__.py @@ -48,7 +48,7 @@ def create_update(session, build_nvrs, release_name=u'F17'): update = Update( title=', '.join(build_nvrs), builds=builds, user=user, request=UpdateRequest.testing, - notes=u'Useful details!', release=release, date_submitted=datetime(1984, 11, 02), + notes=u'Useful details!', release=release, date_submitted=datetime(1984, 11, 2), requirements=u'rpmlint', stable_karma=3, unstable_karma=-3, type=UpdateType.bugfix, test_gating_status=TestGatingStatus.passed) session.add(update) diff --git a/bodhi/tests/server/consumers/test_masher.py b/bodhi/tests/server/consumers/test_masher.py index fad78e71b9..79394b1f6c 100644 --- a/bodhi/tests/server/consumers/test_masher.py +++ b/bodhi/tests/server/consumers/test_masher.py @@ -131,7 +131,7 @@ def setUp(self): req = requests.get('%s/new' % faitout) if req.status_code == 200: db_path = req.text - print 'Using faitout at: %s' % db_path + print('Using faitout at: %s' % db_path) except: pass engine = initialize_db({'sqlalchemy.url': db_path}) diff --git a/bodhi/tests/server/functional/test_comments.py b/bodhi/tests/server/functional/test_comments.py index 1eeb188036..8807295c64 100644 --- a/bodhi/tests/server/functional/test_comments.py +++ b/bodhi/tests/server/functional/test_comments.py @@ -41,7 +41,7 @@ def setUp(self, *args, **kwargs): type=UpdateType.enhancement, notes=u'Useful details!', release=release, - date_submitted=datetime(1984, 11, 02), + date_submitted=datetime(1984, 11, 2), requirements=u'rpmlint', stable_karma=3, unstable_karma=-3, @@ -379,7 +379,7 @@ def test_list_comments_by_update_no_comments(self): request=UpdateRequest.testing, type=UpdateType.enhancement, notes=u'Useful details!', - date_submitted=datetime(1984, 11, 02), + date_submitted=datetime(1984, 11, 2), requirements=u'rpmlint', stable_karma=3, unstable_karma=-3, diff --git a/bodhi/tests/server/functional/test_generic.py b/bodhi/tests/server/functional/test_generic.py index b0febd76b0..4092fc5a98 100644 --- a/bodhi/tests/server/functional/test_generic.py +++ b/bodhi/tests/server/functional/test_generic.py @@ -459,7 +459,7 @@ def _add_updates(updateslist, user, release, packagesuffix): type=j[0], notes=u'Useful details!', release=release, - date_submitted=datetime(1984, 11, 02), + date_submitted=datetime(1984, 11, 2), requirements=u'rpmlint', stable_karma=3, unstable_karma=-3, diff --git a/bodhi/tests/server/test_models.py b/bodhi/tests/server/test_models.py index 1766eeeddd..ba1fa5df5b 100644 --- a/bodhi/tests/server/test_models.py +++ b/bodhi/tests/server/test_models.py @@ -540,7 +540,7 @@ def setUp(self): request=model.UpdateRequest.testing, notes=u'Useless details!', release=model.Release.query.filter_by(name=u'F17').one(), - date_submitted=datetime(1984, 11, 02), + date_submitted=datetime(1984, 11, 2), requirements=u'rpmlint', stable_karma=3, unstable_karma=-3, @@ -1415,7 +1415,7 @@ def test_set_request_untested_stable(self): try: self.obj.set_request(self.db, UpdateRequest.stable, req.user.name) assert False - except BodhiException, e: + except BodhiException as e: pass self.assertEqual(self.obj.request, UpdateRequest.testing) self.assertEqual(self.obj.status, UpdateStatus.pending) @@ -1462,7 +1462,7 @@ def test_set_request_stable_for_critpath_update_when_test_gating_enabled(self): try: self.obj.set_request(self.db, UpdateRequest.stable, req.user.name) assert False - except BodhiException, e: + except BodhiException as e: pass expected_msg = ( 'This critical path update has not yet been approved for pushing to the ' diff --git a/tools/metrics.py b/tools/metrics.py index e5b0f1ff2e..7f3b5ebacc 100755 --- a/tools/metrics.py +++ b/tools/metrics.py @@ -60,7 +60,7 @@ def main(releases=None): total = updates.count() if not total: continue - print header(release.long_name) + print(header(release.long_name)) stats[release.name] = { 'num_updates': total, 'num_tested': 0, @@ -223,108 +223,108 @@ def main(releases=None): data['deltas'].sort() - print " * %d updates" % data['num_updates'] - print " * %d packages updated" % (len(data['packages'])) + print(" * %d updates" % data['num_updates']) + print(" * %d packages updated" % (len(data['packages']))) for status in statuses: - print " * %d %s updates" % (data['num_%s' % status], status) + print(" * %d %s updates" % (data['num_%s' % status], status)) for type in types: - print " * %d %s updates (%0.2f%%)" % ( + print(" * %d %s updates (%0.2f%%)" % ( data['num_%s' % type], type, - float(data['num_%s' % type]) / data['num_updates'] * 100) - print " * %d bugs resolved" % len(data['bugs']) - print " * %d critical path updates (%0.2f%%)" % ( - data['num_critpath'], float(data['num_critpath']) / data['num_updates'] * 100) - print " * %d approved critical path updates" % ( - data['num_critpath_approved']) - print " * %d unapproved critical path updates" % ( - data['num_critpath_unapproved']) - print " * %d updates received feedback (%0.2f%%)" % ( - data['num_feedback'], (float(data['num_feedback']) / data['num_updates'] * 100)) - print " * %d +0 comments" % data['0'] - print " * %d +1 comments" % data['1'] - print " * %d -1 comments" % data['-1'] - print " * %d unique authenticated karma submitters" % ( - len(data['karma'])) - print " * %d proventesters" % len(data['proventesters']) - print " * %d +1's from proventesters" % data['proventesters_1'] - print " * %d -1's from proventesters" % data['proventesters_-1'] + float(data['num_%s' % type]) / data['num_updates'] * 100)) + print(" * %d bugs resolved" % len(data['bugs'])) + print(" * %d critical path updates (%0.2f%%)" % ( + data['num_critpath'], float(data['num_critpath']) / data['num_updates'] * 100)) + print(" * %d approved critical path updates" % ( + data['num_critpath_approved'])) + print(" * %d unapproved critical path updates" % ( + data['num_critpath_unapproved'])) + print(" * %d updates received feedback (%0.2f%%)" % ( + data['num_feedback'], (float(data['num_feedback']) / data['num_updates'] * 100))) + print(" * %d +0 comments" % data['0']) + print(" * %d +1 comments" % data['1']) + print(" * %d -1 comments" % data['-1']) + print(" * %d unique authenticated karma submitters" % ( + len(data['karma']))) + print(" * %d proventesters" % len(data['proventesters'])) + print(" * %d +1's from proventesters" % data['proventesters_1']) + print(" * %d -1's from proventesters" % data['proventesters_-1']) if data['num_critpath']: - print " * %d critpath updates with conflicting proventesters (%0.2f%% of critpath)" % ( + print(" * %d critpath updates with conflicting proventesters (%0.2f%% of critpath)" % ( len(data['conflicted_proventesters']), - float(len(data['conflicted_proventesters'])) / data['num_critpath'] * 100) + float(len(data['conflicted_proventesters'])) / data['num_critpath'] * 100)) for u in sorted(data['conflicted_proventesters']): - print '
  • %s
  • ' % (u, u.split('/')[-1]) + print('
  • %s
  • ' % (u, u.split('/')[-1])) msg = (" * %d critpath updates with positive karma and negative proventester feedback " "(%0.2f%% of critpath)") - print msg % ( + print(msg % ( len(data['critpath_positive_karma_negative_proventesters']), float(len(data['critpath_positive_karma_negative_proventesters'])) / - data['num_critpath'] * 100) + data['num_critpath'] * 100)) for u in sorted(data['critpath_positive_karma_negative_proventesters']): - print '
  • %s
  • ' % (u, u.split('/')[-1]) + print('
  • %s
  • ' % (u, u.split('/')[-1])) msg = (" * %d critpath updates with positive karma and positive proventester feedback " "(%0.2f%% of critpath)") - print msg % ( + print(msg % ( len(data['critpath_positive_karma_including_proventesters']), float(len(data['critpath_positive_karma_including_proventesters'])) / - data['num_critpath'] * 100) - print " * %d anonymous users gave feedback (%0.2f%%)" % ( + data['num_critpath'] * 100)) + print(" * %d anonymous users gave feedback (%0.2f%%)" % ( data['num_anon_feedback'], float(data['num_anon_feedback']) / - (data['num_anon_feedback'] + sum(data['karma'].values())) * 100) - print " * %d stable updates reached the stable karma threshold (%0.2f%%)" % ( - data['num_stablekarma'], float(data['num_stablekarma']) / data['num_stable'] * 100) - print " * %d stable updates reached the minimum time in testing threshold (%0.2f%%)" % ( - data['num_testingtime'], float(data['num_testingtime']) / data['num_stable'] * 100) - print " * %d went from testing to stable *without* karma (%0.2f%%)" % ( + (data['num_anon_feedback'] + sum(data['karma'].values())) * 100)) + print(" * %d stable updates reached the stable karma threshold (%0.2f%%)" % ( + data['num_stablekarma'], float(data['num_stablekarma']) / data['num_stable'] * 100)) + print(" * %d stable updates reached the minimum time in testing threshold (%0.2f%%)" % ( + data['num_testingtime'], float(data['num_testingtime']) / data['num_stable'] * 100)) + print(" * %d went from testing to stable *without* karma (%0.2f%%)" % ( data['num_tested_without_karma'], - float(data['num_tested_without_karma']) / data['num_tested'] * 100) - print " * %d updates were pushed to stable with negative karma (%0.2f%%)" % ( + float(data['num_tested_without_karma']) / data['num_tested'] * 100)) + print(" * %d updates were pushed to stable with negative karma (%0.2f%%)" % ( data['stable_with_negative_karma'], - float(data['stable_with_negative_karma']) / data['num_stable'] * 100) - print " * %d critical path updates pushed to stable *without* karma" % ( - len(data['critpath_without_karma'])) - print " * Time spent in testing:" - print " * mean = %d days" % ( - data['accumulative'].days / len(data['deltas'])) - print " * median = %d days" % ( - data['deltas'][len(data['deltas']) / 2].days) - print " * mode = %d days" % ( - sorted(data['occurrences'].items(), key=itemgetter(1))[-1][0]) - - print "Out of %d packages updated, the top 50 were:" % ( - len(data['packages'])) + float(data['stable_with_negative_karma']) / data['num_stable'] * 100)) + print(" * %d critical path updates pushed to stable *without* karma" % ( + len(data['critpath_without_karma']))) + print(" * Time spent in testing:") + print(" * mean = %d days" % ( + data['accumulative'].days / len(data['deltas']))) + print(" * median = %d days" % ( + data['deltas'][len(data['deltas']) / 2].days)) + print(" * mode = %d days" % ( + sorted(data['occurrences'].items(), key=itemgetter(1))[-1][0])) + + print("Out of %d packages updated, the top 50 were:" % ( + len(data['packages']))) for package in sorted(data['packages'].iteritems(), key=itemgetter(1), reverse=True)[:50]: - print " * %s (%d)" % (package[0], package[1]) + print(" * %s (%d)" % (package[0], package[1])) - print "Out of %d update submitters, the top 50 were:" % ( - len(data['submitters'])) + print("Out of %d update submitters, the top 50 were:" % ( + len(data['submitters']))) for submitter in sorted( data['submitters'].iteritems(), key=itemgetter(1), reverse=True)[:50]: - print " * %s (%d)" % (submitter[0], submitter[1]) + print(" * %s (%d)" % (submitter[0], submitter[1])) - print "Out of %d critical path updates, the top 50 updated were:" % ( - len(data['critpath_pkgs'])) + print("Out of %d critical path updates, the top 50 updated were:" % ( + len(data['critpath_pkgs']))) for x in sorted(data['critpath_pkgs'].iteritems(), key=itemgetter(1), reverse=True)[:50]: - print " * %s (%d)" % (x[0], x[1]) + print(" * %s (%d)" % (x[0], x[1])) critpath_not_updated = set() for pkg in critpath_pkgs: if pkg not in data['critpath_pkgs']: critpath_not_updated.add(pkg) - print "Out of %d critical path packages, %d were never updated:" % ( - len(critpath_pkgs), len(critpath_not_updated)) + print("Out of %d critical path packages, %d were never updated:" % ( + len(critpath_pkgs), len(critpath_not_updated))) for pkg in sorted(critpath_not_updated): print(' * %s' % pkg) - print + print() - print - print "Out of %d total updates, %d received feedback (%0.2f%%)" % ( - num_updates, feedback, (float(feedback) / num_updates * 100)) - print "Out of %d total unique commenters, the top 50 were:" % ( - len(karma)) + print() + print("Out of %d total updates, %d received feedback (%0.2f%%)" % ( + num_updates, feedback, (float(feedback) / num_updates * 100))) + print("Out of %d total unique commenters, the top 50 were:" % ( + len(karma))) for submitter in sorted(karma.iteritems(), key=itemgetter(1), reverse=True)[:50]: - print " * %s (%d)" % (submitter[0], submitter[1]) + print(" * %s (%d)" % (submitter[0], submitter[1])) if __name__ == '__main__': diff --git a/tools/perf-test.py b/tools/perf-test.py index aba80638e0..d595c7ad68 100644 --- a/tools/perf-test.py +++ b/tools/perf-test.py @@ -50,14 +50,14 @@ def clock_url(url, tries=4): def do_scan(): results = collections.OrderedDict() for name, url in items.items(): - print 'Crunching', name, url + print('Crunching', name, url) duration = clock_url(url) results[name] = duration return results def loop_over_refs(refs): - print "Checking %r" % refs + print("Checking %r" % refs) response = raw_input("Is that okay? ") if response != 'y': sys.exit(0) @@ -65,7 +65,7 @@ def loop_over_refs(refs): time.sleep(3) ref = ref[:reflength] commands.getstatus('git checkout %s' % ref) - print "Running on", ref + print("Running on", ref) results[ref] = do_scan() return results @@ -82,7 +82,7 @@ def print_table(table): ) for row in rows: - print "|" + "|".join(row) + "|" + print("|" + "|".join(row) + "|") if __name__ == '__main__': @@ -97,7 +97,7 @@ def print_table(table): try: results = loop_over_refs(refs) finally: - print "Returning you to %s" % head + print("Returning you to %s" % head) commands.getstatus('git checkout %s' % head) print_table(results) diff --git a/tools/python-fedora-api-test.py b/tools/python-fedora-api-test.py index a944eaaf51..adcc222591 100644 --- a/tools/python-fedora-api-test.py +++ b/tools/python-fedora-api-test.py @@ -130,7 +130,7 @@ print('Adding comment') result = bodhi.comment(update=alias, comment='yay', karma=1) -print result +print(result) comment = result['comment'] assert comment['author'] == username assert comment['text'] == u'yay'