diff --git a/src/tito/builder/main.py b/src/tito/builder/main.py index e482db9..268523b 100644 --- a/src/tito/builder/main.py +++ b/src/tito/builder/main.py @@ -224,7 +224,7 @@ class BuilderBase(object): try: output = run_command(cmd) except (KeyboardInterrupt, SystemExit): - print "" + print("") exit(1) except RunCommandException: err = sys.exc_info()[1] diff --git a/src/tito/common.py b/src/tito/common.py index 5a51d07..20c5601 100644 --- a/src/tito/common.py +++ b/src/tito/common.py @@ -351,13 +351,13 @@ def scl_to_rpm_option(scl, silent=None): output = run_command(cmd).rstrip() if scl: if (output != scl) and (output != "%scl") and not silent: - print "Warning: Meta package of software collection %s installed, but --scl defines %s" % (output, scl) - print " Redefining scl macro to %s for this package." % scl + print("Warning: Meta package of software collection %s installed, but --scl defines %s" % (output, scl)) + print(" Redefining scl macro to %s for this package." % scl) rpm_options += " --define 'scl %s'" % scl else: if (output != "%scl") and (not silent): - print "Warning: Meta package of software collection %s installed, but --scl is not present." % output - print " Undefining scl macro for this package." + print("Warning: Meta package of software collection %s installed, but --scl is not present." % output) + print(" Undefining scl macro for this package.") # can be replaced by "--undefined scl" when el6 and fc17 is retired rpm_options += " --eval '%undefine scl'" return rpm_options diff --git a/src/tito/copr.py b/src/tito/copr.py index d0695d0..36f8d75 100644 --- a/src/tito/copr.py +++ b/src/tito/copr.py @@ -66,8 +66,8 @@ class CoprReleaser(KojiReleaser): self.print_dry_run_warning(cmd_submit) return if not self.srpm_submitted: - print "Uploading src.rpm." - print run_command(cmd_upload) + print("Uploading src.rpm.") + print(run_command(cmd_upload)) self.srpm_submitted = srpm_location - print "Submiting build into %s." % self.NAME - print run_command(cmd_submit) + print("Submiting build into %s." % self.NAME) + print(run_command(cmd_submit)) diff --git a/src/tito/obs.py b/src/tito/obs.py index 0ced1c7..6012698 100644 --- a/src/tito/obs.py +++ b/src/tito/obs.py @@ -83,7 +83,7 @@ class ObsReleaser(Releaser): os.lseek(fd, 0, 0) commit_file = os.fdopen(fd) for line in commit_file.readlines(): - print line + print(line) commit_file.close() print("") @@ -133,7 +133,7 @@ class ObsReleaser(Releaser): else: print("Proceeding with commit.") os.chdir(self.package_workdir) - print run_command(cmd) + print(run_command(cmd)) os.unlink(commit_msg_file) diff --git a/src/tito/release.py b/src/tito/release.py index 797b661..7cf1805 100644 --- a/src/tito/release.py +++ b/src/tito/release.py @@ -470,7 +470,7 @@ class YumRepoReleaser(RsyncReleaser): hdr = self._read_rpm_header(rpm_ts, full_path) except rpm.error: e = sys.exc_info()[1] - print "error reading rpm header in '%s': %s" % (full_path, e) + print("error reading rpm header in '%s': %s" % (full_path, e)) continue if hdr['name'] in self.new_rpm_dep_sets: dep_set = hdr.dsOfHeader() @@ -559,7 +559,7 @@ class FedoraGitReleaser(Releaser): os.lseek(fd, 0, 0) file = os.fdopen(fd) for line in file.readlines(): - print line + print(line) file.close() print("") @@ -692,7 +692,7 @@ class FedoraGitReleaser(Releaser): # Print the task ID and URL: for line in extract_task_info(output): - print line + print(line) def _git_upload_sources(self, project_checkout): """ @@ -942,7 +942,7 @@ class CvsReleaser(Releaser): os.lseek(fd, 0, 0) file = os.fdopen(fd) for line in file.readlines(): - print line + print(line) file.close() print("") diff --git a/test/unit/pep8-tests.py b/test/unit/pep8-tests.py index bf099fd..6697f7a 100644 --- a/test/unit/pep8-tests.py +++ b/test/unit/pep8-tests.py @@ -89,3 +89,8 @@ class UglyHackishTest(TitoUnitTestFixture): cmd = "find . -type f -regex '.*\.py$' -exec egrep '^(import|from) commands\.' {} + | grep -v 'compat\.py' | wc -l" result = int(getoutput(cmd)) self.assertEqual(result, 0, "Found commands module (not supported in Python 3)") + + def test_print_function(self): + cmd = "find . -type f -regex '.*\.py$' -exec grep '^[[:space:]]*print .*' {} + | wc -l" + result = int(getoutput(cmd)) + self.assertEqual(result, 0, "Found print statement (not supported in Python 3)")