The print statement has been dropped in Python 3 and the print function
works in both Python 2 and Python 3. So there is really no reason to not
just use the print function and make Anaconda a bit more Python 3
friendly.
Signed-off-by: Martin Kolman <mkolman(a)redhat.com>
---
anaconda | 10 +--
data/command-stubs/list-harddrives-stub | 2 +-
dracut/parse-kickstart | 2 +-
dracut/python-deps | 10 +--
pyanaconda/geoloc.py | 26 ++++----
pyanaconda/kickstart.py | 4 +-
pyanaconda/nm.py | 82 ++++++++++++------------
pyanaconda/packaging/__init__.py | 14 ++--
pyanaconda/rescue.py | 2 +-
pyanaconda/ui/gui/tools/run-spoke.py | 16 ++---
pyanaconda/ui/tui/simpleline/base.py | 14 ++--
pyanaconda/ui/tui/simpleline/widgets.py | 6 +-
pyanaconda/ui/tui/spokes/__init__.py | 4 +-
pyanaconda/ui/tui/spokes/askvnc.py | 10 +--
pyanaconda/ui/tui/spokes/storage.py | 4 +-
pyanaconda/ui/tui/tools/run-text-spoke.py | 18 +++---
scripts/githooks/pre-commit | 6 +-
scripts/makebumpver | 38 +++++------
tests/glade/pw_visibility/check_pw_visibility.py | 8 +--
tests/storage/cases/__init__.py | 12 ++--
20 files changed, 144 insertions(+), 144 deletions(-)
diff --git a/anaconda b/anaconda
index 4ccbd00..7499bc3 100755
--- a/anaconda
+++ b/anaconda
@@ -63,8 +63,8 @@ def exitHandler(rebootData, storage, exitCode=None):
if "nokill" in flags.cmdline:
iutil.vtActivate(1)
- print "anaconda halting due to nokill flag."
- print "The system will be rebooted when you press Ctrl-Alt-Delete."
+ print("anaconda halting due to nokill flag.")
+ print("The system will be rebooted when you press Ctrl-Alt-Delete.")
while True:
time.sleep(10000)
@@ -750,7 +750,7 @@ if __name__ == "__main__":
if ("--help" in sys.argv) or ("-h" in sys.argv):
parseArguments()
- print "Starting installer, one moment..."
+ print("Starting installer, one moment...")
# Allow a file to be loaded as early as possible
try:
@@ -843,9 +843,9 @@ if __name__ == "__main__":
verdesc = "%s for %s %s" % (getAnacondaVersion(),
product.productName, product.productVersion)
if product.isFinal:
- print "anaconda %s started." % verdesc
+ print("anaconda %s started." % verdesc)
else:
- print "anaconda %s (pre-release) started." % verdesc
+ print("anaconda %s (pre-release) started." % verdesc)
from pyanaconda.anaconda import Anaconda
anaconda = Anaconda()
diff --git a/data/command-stubs/list-harddrives-stub b/data/command-stubs/list-harddrives-stub
index 01c0931..ae5e6b9 100755
--- a/data/command-stubs/list-harddrives-stub
+++ b/data/command-stubs/list-harddrives-stub
@@ -35,7 +35,7 @@ def main(argv):
lst = list(lst)
lst.sort()
for dev, size in lst:
- print dev, size
+ print(dev, size)
if __name__ == "__main__":
main(sys.argv)
diff --git a/dracut/parse-kickstart b/dracut/parse-kickstart
index c2eaca9..6659d1e 100755
--- a/dracut/parse-kickstart
+++ b/dracut/parse-kickstart
@@ -493,4 +493,4 @@ if __name__ == '__main__':
for path in sys.argv[1:]:
outfile, output = process_kickstart(path)
for line in filter(None, output):
- print line
+ print(line)
diff --git a/dracut/python-deps b/dracut/python-deps
index a2dabca..e626ff4 100755
--- a/dracut/python-deps
+++ b/dracut/python-deps
@@ -46,11 +46,11 @@ for script in sys.argv[1:]:
mods.append(moddir)
# Include some bits that the python install itself needs
-print get_makefile_filename()
-print get_config_h_filename()
-print os.path.join(libdir,'site.py')
-print os.path.join(libdir,'sysconfig.py')
+print(get_makefile_filename())
+print(get_config_h_filename())
+print(os.path.join(libdir,'site.py'))
+print(os.path.join(libdir,'sysconfig.py'))
# And print the list of deps.
for d in deps:
- print d
+ print(d)
diff --git a/pyanaconda/geoloc.py b/pyanaconda/geoloc.py
index 76771ff..7b8dc0d 100644
--- a/pyanaconda/geoloc.py
+++ b/pyanaconda/geoloc.py
@@ -863,30 +863,30 @@ class WiFiAccessPoint(object):
"(signal strength): %d" % (self.bssid, self.ssid, self.rssi)
if __name__ == "__main__":
- print "GeoIP directly started"
+ print("GeoIP directly started")
- print "trying the default backend"
+ print("trying the default backend")
location_info = LocationInfo()
location_info.refresh()
- print " provider used: %s" % location_info._provider
- print " territory code: %s" % location_info.get_territory_code()
+ print(" provider used: %s" % location_info._provider)
+ print(" territory code: %s" % location_info.get_territory_code())
- print "trying the Fedora GeoIP backend"
+ print("trying the Fedora GeoIP backend")
location_info = LocationInfo(provider_id=
constants.GEOLOC_PROVIDER_FEDORA_GEOIP)
location_info.refresh()
- print " provider used: %s" % location_info._provider
- print " territory code: %s" % location_info.get_territory_code()
+ print(" provider used: %s" % location_info._provider)
+ print(" territory code: %s" % location_info.get_territory_code())
- print "trying the Google WiFi location backend"
+ print("trying the Google WiFi location backend")
location_info = LocationInfo(provider_id=
constants.GEOLOC_PROVIDER_GOOGLE_WIFI)
location_info.refresh()
- print " provider used: %s" % location_info._provider
- print " territory code: %s" % location_info.get_territory_code()
+ print(" provider used: %s" % location_info._provider)
+ print(" territory code: %s" % location_info.get_territory_code())
- print "trying the Hostip backend"
+ print("trying the Hostip backend")
location_info = LocationInfo(provider_id=constants.GEOLOC_PROVIDER_HOSTIP)
location_info.refresh()
- print " provider used: %s" % location_info._provider
- print " territory code: %s" % location_info.get_territory_code()
+ print(" provider used: %s" % location_info._provider)
+ print(" territory code: %s" % location_info.get_territory_code())
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 781bd90..2435ee5 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -1813,7 +1813,7 @@ def preScriptPass(f):
except KickstartError as e:
# We do not have an interface here yet, so we cannot use our error
# handling callback.
- print e
+ print(e)
sys.exit(1)
# run %pre scripts
@@ -1840,7 +1840,7 @@ def parseKickstart(f):
except KickstartError as e:
# We do not have an interface here yet, so we cannot use our error
# handling callback.
- print e
+ print(e)
sys.exit(1)
return handler
diff --git a/pyanaconda/nm.py b/pyanaconda/nm.py
index 40058f3..09dff20 100644
--- a/pyanaconda/nm.py
+++ b/pyanaconda/nm.py
@@ -978,11 +978,11 @@ def nm_dbus_int_to_ipv4(address):
return socket.inet_ntop(socket.AF_INET, struct.pack('=L', address))
def test():
- print "NM state: %s:" % nm_state()
- print "NM is connected: %s" % nm_is_connected()
+ print("NM state: %s:" % nm_state())
+ print("NM is connected: %s" % nm_is_connected())
- print "Devices: %s" % nm_devices()
- print "Activated devices: %s" % nm_activated_devices()
+ print("Devices: %s" % nm_devices())
+ print("Activated devices: %s" % nm_activated_devices())
wireless_device = ""
@@ -990,108 +990,108 @@ def test():
devs.append("nonexisting")
for devname in devs:
- print devname
+ print(devname)
try:
devtype = nm_device_type(devname)
except UnknownDeviceError as e:
- print " %s" % e
+ print(" %s" % e)
devtype = None
if devtype == NetworkManager.DeviceType.ETHERNET:
- print " type %s" % "ETHERNET"
+ print(" type %s" % "ETHERNET")
elif devtype == NetworkManager.DeviceType.WIFI:
- print " type %s" % "WIFI"
+ print(" type %s" % "WIFI")
wireless_device = devname
try:
- print " Wifi device: %s" % nm_device_type_is_wifi(devname)
+ print(" Wifi device: %s" % nm_device_type_is_wifi(devname))
except UnknownDeviceError as e:
- print " %s" % e
+ print(" %s" % e)
try:
hwaddr = nm_device_hwaddress(devname)
- print " HwAaddress: %s" % hwaddr
+ print(" HwAaddress: %s" % hwaddr)
except ValueError as e:
- print " %s" % e
+ print(" %s" % e)
hwaddr = ""
try:
- print " Carrier: %s" % nm_device_carrier(devname)
+ print(" Carrier: %s" % nm_device_carrier(devname))
except ValueError as e:
- print " %s" % e
+ print(" %s" % e)
try:
- print " IP4 config: %s" % nm_device_ip_config(devname)
- print " IP6 config: %s" % nm_device_ip_config(devname, version=6)
- print " IP4 addrs: %s" % nm_device_ip_addresses(devname)
- print " IP6 addrs: %s" % nm_device_ip_addresses(devname, version=6)
- print " Udi: %s" % nm_device_property(devname, "Udi")
+ print(" IP4 config: %s" % nm_device_ip_config(devname))
+ print(" IP6 config: %s" % nm_device_ip_config(devname, version=6))
+ print(" IP4 addrs: %s" % nm_device_ip_addresses(devname))
+ print(" IP6 addrs: %s" % nm_device_ip_addresses(devname, version=6))
+ print(" Udi: %s" % nm_device_property(devname, "Udi"))
except UnknownDeviceError as e:
- print " %s" % e
+ print(" %s" % e)
if devname in nm_devices():
try:
- print " Nonexisting: %s" % nm_device_property(devname, "Nonexisting")
+ print(" Nonexisting: %s" % nm_device_property(devname, "Nonexisting"))
except PropertyNotFoundError as e:
- print " %s" % e
+ print(" %s" % e)
try:
- print " Nonexisting: %s" % nm_device_property(devname, "Nonexisting")
+ print(" Nonexisting: %s" % nm_device_property(devname, "Nonexisting"))
except ValueError as e:
- print " %s" % e
+ print(" %s" % e)
try:
- print " Settings: %s" % _device_settings(devname)
+ print(" Settings: %s" % _device_settings(devname))
except UnknownDeviceError as e:
- print " %s" % e
+ print(" %s" % e)
try:
- print " Settings for hwaddr %s: %s" % (hwaddr, _settings_for_hwaddr(hwaddr))
+ print(" Settings for hwaddr %s: %s" % (hwaddr, _settings_for_hwaddr(hwaddr)))
except UnknownDeviceError as e:
- print " %s" % e
+ print(" %s" % e)
try:
- print " Setting value %s %s: %s" % ("ipv6", "method", nm_device_setting_value(devname, "ipv6", "method"))
+ print(" Setting value %s %s: %s" % ("ipv6", "method", nm_device_setting_value(devname, "ipv6", "method")))
except ValueError as e:
- print " %s" % e
+ print(" %s" % e)
try:
- print " Setting value %s %s: %s" % ("ipv7", "method", nm_device_setting_value(devname, "ipv7", "method"))
+ print(" Setting value %s %s: %s" % ("ipv7", "method", nm_device_setting_value(devname, "ipv7", "method")))
except ValueError as e:
- print " %s" % e
+ print(" %s" % e)
ssid = "Red Hat Guest"
- print "Settings for AP %s: %s" % (ssid, _settings_for_ap(ssid))
+ print("Settings for AP %s: %s" % (ssid, _settings_for_ap(ssid)))
ssid = "nonexisting"
- print "Settings for AP %s: %s" % (ssid, _settings_for_ap(ssid))
+ print("Settings for AP %s: %s" % (ssid, _settings_for_ap(ssid)))
devname = devs[0]
key1 = "connection"
key2 = "autoconnect"
original_value = nm_device_setting_value(devname, key1, key2)
- print "Value of setting %s %s: %s" % (key1, key2, original_value)
+ print("Value of setting %s %s: %s" % (key1, key2, original_value))
# None means default in this case, which is true
if original_value in (None, True):
new_value = False
else:
new_value = True
- print "Updating to %s" % new_value
+ print("Updating to %s" % new_value)
nm_update_settings_of_device(devname, [[key1, key2, new_value, None]])
- print "Value of setting %s %s: %s" % (key1, key2, nm_device_setting_value(devname, key1, key2))
+ print("Value of setting %s %s: %s" % (key1, key2, nm_device_setting_value(devname, key1, key2)))
nm_update_settings_of_device(devname, [[key1, key2, original_value, None]])
- print "Value of setting %s %s: %s" % (key1, key2, nm_device_setting_value(devname, key1, key2))
+ print("Value of setting %s %s: %s" % (key1, key2, nm_device_setting_value(devname, key1, key2)))
nm_update_settings_of_device(devname, [[key1, key2, original_value, "b"]])
- print "Value of setting %s %s: %s" % (key1, key2, nm_device_setting_value(devname, key1, key2))
+ print("Value of setting %s %s: %s" % (key1, key2, nm_device_setting_value(devname, key1, key2)))
nm_update_settings_of_device(devname, [[key1, "nonexisting", new_value, None]])
nm_update_settings_of_device(devname, [["nonexisting", "nonexisting", new_value, None]])
try:
nm_update_settings_of_device("nonexixting", [[key1, key2, new_value, None]])
except UnknownDeviceError as e:
- print "%s" % e
+ print("%s" % e)
if wireless_device:
try:
nm_update_settings_of_device(wireless_device, [[key1, key2, new_value, None]])
except SettingsNotFoundError as e:
- print "%s" % e
+ print("%s" % e)
#nm_update_settings_of_device(devname, [["connection", "id", "test", None]])
#nm_update_settings_of_device(devname, [["connection", "timestamp", 11111111, None]])
diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index 725319b..9c9b7a5 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -27,7 +27,7 @@
- document all methods
"""
-
+from __future__ import print_function
import os, sys
from urlgrabber.grabber import URLGrabber
from urlgrabber.grabber import URLGrabError
@@ -1049,21 +1049,21 @@ def show_groups(payload):
import pprint
- print "==== DESKTOPS ===="
+ print("==== DESKTOPS ====")
pprint.pprint(desktops)
- print "==== ADDONS ===="
+ print("==== ADDONS ====")
pprint.pprint(addons)
- print payload.groups
+ print(payload.groups)
def print_txmbrs(payload, f=None):
if f is None:
f = sys.stdout
- print >> f, "###########"
+ print("###########", file=f)
for txmbr in payload._yum.tsInfo.getMembers():
- print >> f, txmbr
- print >> f, "###########"
+ print(txmbr, file=f)
+ print("###########", file=f)
def write_txmbrs(payload, filename):
if os.path.exists(filename):
diff --git a/pyanaconda/rescue.py b/pyanaconda/rescue.py
index 14f0ea6..63bc0c1 100644
--- a/pyanaconda/rescue.py
+++ b/pyanaconda/rescue.py
@@ -177,7 +177,7 @@ def runShell(screen = None, msg=""):
print
if msg:
- print (msg)
+ print(msg)
if flags.imageInstall:
print(_("Run %s to unmount the system when you are finished.")
diff --git a/pyanaconda/ui/gui/tools/run-spoke.py b/pyanaconda/ui/gui/tools/run-spoke.py
index 6ac3b75..10a8923 100755
--- a/pyanaconda/ui/gui/tools/run-spoke.py
+++ b/pyanaconda/ui/gui/tools/run-spoke.py
@@ -16,7 +16,7 @@ import os.path
# Check command line arguments
if len(sys.argv)<2:
- print "Usage: $0 <spoke module name> [<spoke widget class>]"
+ print("Usage: $0 <spoke module name> [<spoke widget class>]")
sys.exit(1)
# This is a hack to make sure the AnacondaWidgets library gets loaded
@@ -54,7 +54,7 @@ elif os.path.basename(sys.argv[0]) == "run-hub.py":
spokeText = "hub"
SpokeText = "Hub"
else:
- print "You have to run this command as run-spoke.py or run-hub.py."
+ print("You have to run this command as run-spoke.py or run-hub.py.")
sys.exit(1)
# Set default spoke class
@@ -82,11 +82,11 @@ if not spokeClass:
try:
spokeClass = getattr(spokeModule, spokeClassName)
except KeyError:
- print "%s %s could not be found in %s" % (SpokeText, spokeClassName, spokeModuleName)
+ print("%s %s could not be found in %s" % (SpokeText, spokeClassName, spokeModuleName))
sys.exit(1)
-print "Running %s %s from %s" % (spokeText, spokeClass, spokeModule)
+print("Running %s %s from %s" % (spokeText, spokeClass, spokeModule))
ksdata = makeVersion()
storage = Blivet(ksdata=ksdata)
@@ -114,7 +114,7 @@ if hasattr(spoke, "set_path"):
spoke.initialize()
if not spoke.showable:
- print "This %s is not showable, but I'll continue anyway." % spokeText
+ print("This %s is not showable, but I'll continue anyway." % spokeText)
spoke.refresh()
spoke.window.set_beta(True)
@@ -124,7 +124,7 @@ spoke.window.show_all()
Gtk.main()
if hasattr(spoke, "status"):
- print "%s status:\n%s\n" % (SpokeText, spoke.status)
+ print("%s status:\n%s\n" % (SpokeText, spoke.status))
if hasattr(spoke, "completed"):
- print "%s completed:\n%s\n" % (SpokeText, spoke.completed)
-print "%s kickstart fragment:\n%s" % (SpokeText, ksdata)
+ print("%s completed:\n%s\n" % (SpokeText, spoke.completed))
+print("%s kickstart fragment:\n%s" % (SpokeText, ksdata))
diff --git a/pyanaconda/ui/tui/simpleline/base.py b/pyanaconda/ui/tui/simpleline/base.py
index eae5c48..0ae0f57 100644
--- a/pyanaconda/ui/tui/simpleline/base.py
+++ b/pyanaconda/ui/tui/simpleline/base.py
@@ -322,7 +322,7 @@ class App(object):
# if redraw is needed, separate the content on the screen from the
# stuff we are about to display now
if self._redraw:
- print self._spacer
+ print(self._spacer)
try:
# draw the screen if redraw is needed or the screen changed
@@ -550,7 +550,7 @@ class UIScreen(object):
if num_lines < self._screen_height - 2:
# widget plus prompt are shorter than screen height, just print the widget
- print u"\n".join(lines)
+ print(u"\n".join(lines))
return
# long widget, print it in steps and prompt user to continue
@@ -560,12 +560,12 @@ class UIScreen(object):
# enough space to print the rest of the widget plus regular
# prompt (2 lines)
for line in lines[pos:]:
- print line
+ print(line)
pos += self._screen_height - 1
else:
# print part with a prompt to continue
for line in lines[pos:(pos + self._screen_height - 2)]:
- print line
+ print(line)
self._app.raw_input(_("Press ENTER to continue"))
pos += self._screen_height - 1
@@ -579,10 +579,10 @@ class UIScreen(object):
if isinstance(w, Widget):
self._print_long_widget(w)
elif type(w) == str:
- print w.decode("utf-8")
+ print(w.decode("utf-8"))
else:
# not a widget, just print its unicode representation
- print unicode(w)
+ print(unicode(w))
show = show_all
def hide(self):
@@ -825,7 +825,7 @@ class Widget(object):
if __name__ == "__main__":
class HelloWorld(UIScreen):
def show(self, args = None):
- print """Hello World\nquit by typing 'quit'"""
+ print("""Hello World\nquit by typing 'quit'""")
return True
a = App("Hello World")
diff --git a/pyanaconda/ui/tui/simpleline/widgets.py b/pyanaconda/ui/tui/simpleline/widgets.py
index fef1d01..b3d8508 100644
--- a/pyanaconda/ui/tui/simpleline/widgets.py
+++ b/pyanaconda/ui/tui/simpleline/widgets.py
@@ -205,10 +205,10 @@ if __name__ == "__main__":
c = ColumnWidget([(15, [t1, t2, t3]), (10, [t4, t5])], spacing = 1)
c.render(80)
- print u"\n".join(c.get_lines())
+ print(u"\n".join(c.get_lines()))
- print 80*"-"
+ print(80*"-")
c = ColumnWidget([(20, [t1, t2, t3]), (25, [t4, t5]), (15, [t1, t2, t3])], spacing = 3)
c.render(80)
- print u"\n".join(c.get_lines())
+ print(u"\n".join(c.get_lines()))
diff --git a/pyanaconda/ui/tui/spokes/__init__.py b/pyanaconda/ui/tui/spokes/__init__.py
index a1d7f9a..f908295 100644
--- a/pyanaconda/ui/tui/spokes/__init__.py
+++ b/pyanaconda/ui/tui/spokes/__init__.py
@@ -161,8 +161,8 @@ class EditTUIDialog(NormalTUISpoke):
self.close()
return True
else:
- print _("You have provided an invalid username: %s\n"
- "Do not use spaces or capital letters.\n") % key
+ print(_("You have provided an invalid username: %s\n"
+ "Do not use spaces or capital letters.\n") % key)
return NormalTUISpoke.input(self, entry, key)
class OneShotEditTUIDialog(EditTUIDialog):
diff --git a/pyanaconda/ui/tui/spokes/askvnc.py b/pyanaconda/ui/tui/spokes/askvnc.py
index dc9273e..d3835a0 100644
--- a/pyanaconda/ui/tui/spokes/askvnc.py
+++ b/pyanaconda/ui/tui/spokes/askvnc.py
@@ -138,15 +138,15 @@ class VNCPassSpoke(NormalTUISpoke):
p2 = getpass.getpass(_("Password (confirm): "))
if p1 != p2:
- print _("Passwords do not match!")
+ print(_("Passwords do not match!"))
return None
elif 0 < len(p1) < 6:
- print _("The password must be at least "
- "six characters long.")
+ print(_("The password must be at least "
+ "six characters long."))
return None
elif len(p1) > 8:
- print _("The password cannot be more than "
- "eight characters long.")
+ print(_("The password cannot be more than "
+ "eight characters long."))
return None
else:
self._password = p1
diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py
index 2fdebe9..f0d38d5 100644
--- a/pyanaconda/ui/tui/spokes/storage.py
+++ b/pyanaconda/ui/tui/spokes/storage.py
@@ -374,7 +374,7 @@ class StorageSpoke(NormalTUISpoke):
doKickstartStorage(self.storage, self.data, self.instclass)
except (StorageError, KickstartValueError) as e:
log.error("storage configuration failed: %s", e)
- print _("storage configuration failed: %s") % e
+ print(_("storage configuration failed: %s") % e)
self.errors = [str(e)]
self.data.bootloader.bootDrive = ""
self.data.clearpart.type = CLEARPART_TYPE_ALL
@@ -387,7 +387,7 @@ class StorageSpoke(NormalTUISpoke):
self._ready = True
except BootLoaderError as e:
log.error("BootLoader setup failed: %s", e)
- print _("storage configuration failed: %s") % e
+ print(_("storage configuration failed: %s") % e)
self.errors = [str(e)]
self.data.bootloader.bootDrive = ""
self._ready = True
diff --git a/pyanaconda/ui/tui/tools/run-text-spoke.py b/pyanaconda/ui/tui/tools/run-text-spoke.py
index 09c91a3..c503cdc 100755
--- a/pyanaconda/ui/tui/tools/run-text-spoke.py
+++ b/pyanaconda/ui/tui/tools/run-text-spoke.py
@@ -5,7 +5,7 @@ import os.path
# Check command line arguments
if len(sys.argv)<2:
- print "Usage: $0 <spoke module name> [<spoke widget class>]"
+ print("Usage: $0 <spoke module name> [<spoke widget class>]")
sys.exit(1)
# Logging always needs to be set up first thing, or there'll be tracebacks.
@@ -42,7 +42,7 @@ elif os.path.basename(sys.argv[0]) == "run-text-hub.py":
spokeText = "hub"
SpokeText = "Hub"
else:
- print "You have to run this command as run-spoke.py or run-hub.py."
+ print("You have to run this command as run-spoke.py or run-hub.py.")
sys.exit(1)
# Set default spoke class
@@ -61,7 +61,7 @@ except IndexError:
spokeModule = sys.modules[spokeModuleName]
for k,v in vars(spokeModule).iteritems():
try:
- print k,v
+ print(k,v)
if issubclass(v, spokeBaseClass) and v != spokeBaseClass:
spokeClassName = k
spokeClass = v
@@ -72,11 +72,11 @@ if not spokeClass:
try:
spokeClass = getattr(spokeModule, spokeClassName)
except KeyError:
- print "%s %s could not be found in %s" % (SpokeText, spokeClassName, spokeModuleName)
+ print("%s %s could not be found in %s" % (SpokeText, spokeClassName, spokeModuleName))
sys.exit(1)
-print "Running %s %s from %s" % (spokeText, spokeClass, spokeModule)
+print("Running %s %s from %s" % (spokeText, spokeClass, spokeModule))
ksdata = makeVersion()
storage = Blivet(ksdata=ksdata)
@@ -91,13 +91,13 @@ payload.install_log = sys.stdout
spoke = spokeClass(app, ksdata, storage, payload, instclass)
if not spoke.showable:
- print "This %s is not showable, but I'll continue anyway." % spokeText
+ print("This %s is not showable, but I'll continue anyway." % spokeText)
app.schedule_screen(spoke)
app.run()
if hasattr(spoke, "status"):
- print "%s status:\n%s\n" % (SpokeText, spoke.status)
+ print("%s status:\n%s\n" % (SpokeText, spoke.status))
if hasattr(spoke, "completed"):
- print "%s completed:\n%s\n" % (SpokeText, spoke.completed)
-print "%s kickstart fragment:\n%s" % (SpokeText, ksdata)
+ print("%s completed:\n%s\n" % (SpokeText, spoke.completed))
+print("%s kickstart fragment:\n%s" % (SpokeText, ksdata))
diff --git a/scripts/githooks/pre-commit b/scripts/githooks/pre-commit
index 5704b28..c8832ef 100755
--- a/scripts/githooks/pre-commit
+++ b/scripts/githooks/pre-commit
@@ -25,7 +25,7 @@ def is_python(filename):
OTHER_MODULES_PATH = ".:../blivet/:../pykickstart/"
if "NOPYLINT" in os.environ:
- print "Skipping pre-commit pylint run"
+ print("Skipping pre-commit pylint run")
sys.exit(0)
# run pylint on all the python files changed by this commit
@@ -63,11 +63,11 @@ if not pylint_files:
env = os.environ.copy()
env["PYTHONPATH"] = OTHER_MODULES_PATH
-print "Running pylint on %s" % " ".join(pylint_files)
+print("Running pylint on %s" % " ".join(pylint_files))
try:
check_output(["./tests/pylint/runpylint.sh"] + pylint_files, env=env)
except CalledProcessError as e:
- print e.output
+ print(e.output)
sys.exit(1)
sys.exit(0)
diff --git a/scripts/makebumpver b/scripts/makebumpver
index 7e25178..1d56129 100755
--- a/scripts/makebumpver
+++ b/scripts/makebumpver
@@ -166,47 +166,47 @@ class MakeBumpVer:
bzentry = self._queryBug(bug)
if not bzentry:
- print "*** Bugzilla query for %s failed.\n" % bug
+ print("*** Bugzilla query for %s failed.\n" % bug)
return False
if bzentry.product.startswith('Red Hat Enterprise Linux'):
return True
else:
- print "*** Bug %s is not a RHEL bug." % bug
- print "*** Commit: %s" % commit
- print "*** %s\n" % summary
+ print("*** Bug %s is not a RHEL bug." % bug)
+ print("*** Commit: %s" % commit)
+ print("*** %s\n" % summary)
return False
def _isRHELBugInCorrectState(self, bug, commit, summary):
bzentry = self._queryBug(bug)
if not bzentry:
- print "*** Bugzilla query for %s failed.\n" % bug
+ print("*** Bugzilla query for %s failed.\n" % bug)
return False
if bzentry.bug_status in ['MODIFIED', 'ON_QA']:
return True
else:
- print "*** Bug %s is not in MODIFIED or ON_QA." % bug
- print "*** Commit: %s" % commit
- print "*** %s\n" % summary
+ print("*** Bug %s is not in MODIFIED or ON_QA." % bug)
+ print("*** Commit: %s" % commit)
+ print("*** %s\n" % summary)
return False
def _isRHELBugFixedInVersion(self, bug, commit, summary, fixedIn):
bzentry = self._queryBug(bug)
if not bzentry:
- print "*** Bugzilla query for %s failed.\n" % bug
+ print("*** Bugzilla query for %s failed.\n" % bug)
return False
if bzentry.fixed_in == fixedIn:
return True
else:
- print "*** Bug %s does not have correct Fixed In Version." % bug
- print "*** Found: %s" % bzentry.fixed_in
- print "*** Expected: %s" % fixedIn
- print "*** Commit: %s" % commit
- print "*** %s\n" % summary
+ print("*** Bug %s does not have correct Fixed In Version." % bug)
+ print("*** Found: %s" % bzentry.fixed_in)
+ print("*** Expected: %s" % fixedIn)
+ print("*** Commit: %s" % commit)
+ print("*** %s\n" % summary)
return False
def _isRHELBugAcked(self, bug, commit, summary):
@@ -221,9 +221,9 @@ class MakeBumpVer:
if re.match(ack_pattern, f['name']) and f['status'] == '+':
return True
- print "*** Bug %s does not have ACK" % bug
- print "*** Commit: %s" % commit
- print "*** %s\n" % summary
+ print("*** Bug %s does not have ACK" % bug)
+ print("*** Commit: %s" % commit)
+ print("*** %s\n" % summary)
return False
def _rpmLog(self, fixedIn):
@@ -346,12 +346,12 @@ class MakeBumpVer:
bad = True
elif valid and action == 'Related' and \
self._isRHELBugAcked(ckbug, commit, summary):
- print "*** Bug %s Related commit %s is allowed\n" % (bug, commit)
+ print("*** Bug %s Related commit %s is allowed\n" % (bug, commit))
# Related bugs only need to be valid and have an ack
bad = False
if len(rhbz) == 0:
- print "*** No bugs referenced in commit %s\n" % commit
+ print("*** No bugs referenced in commit %s\n" % commit)
bad = True
rpm_log.append((summary.strip(), list(rhbz)))
diff --git a/tests/glade/pw_visibility/check_pw_visibility.py b/tests/glade/pw_visibility/check_pw_visibility.py
index 33fea2c..0e9a99f 100755
--- a/tests/glade/pw_visibility/check_pw_visibility.py
+++ b/tests/glade/pw_visibility/check_pw_visibility.py
@@ -44,20 +44,20 @@ def check_glade_file(glade_file_path):
# no entry should have visibility specified multiple times
if len(visibility_props) > 1:
- print "Visibility specified multiple times for the entry %s (%s)" % (entry_id, fpath)
+ print("Visibility specified multiple times for the entry %s (%s)" % (entry_id, fpath))
succ = False
# password entry should have visibility set to False
if any(ind in entry_id.lower() for ind in PW_ID_INDICATORS):
if not visibility_props:
- print "Visibility not specified for the password entry %s (%s)" % (entry_id, fpath)
+ print("Visibility not specified for the password entry %s (%s)" % (entry_id, fpath))
succ = False
elif visibility_props[0].text.strip() != "False":
- print "Visibility not set properly for the password entry %s (%s)" % (entry_id, fpath)
+ print("Visibility not set properly for the password entry %s (%s)" % (entry_id, fpath))
succ = False
# only password entries should have the visibility set to False
elif visibility_props and visibility_props[0].text.strip() == "False":
- print "Non-password entry %s (%s) has the visibility set to False (bad id?)" % (entry_id, fpath)
+ print("Non-password entry %s (%s) has the visibility set to False (bad id?)" % (entry_id, fpath))
succ = False
return succ
diff --git a/tests/storage/cases/__init__.py b/tests/storage/cases/__init__.py
index 00e0fed..87882a9 100644
--- a/tests/storage/cases/__init__.py
+++ b/tests/storage/cases/__init__.py
@@ -70,7 +70,7 @@ class TestCase(object):
failures = 0
if self.platforms and blivet.platform.getPlatform().__class__.__name__ not in self.platforms:
- print "Test %s skipped: not valid for this platform" % self.name
+ print("Test %s skipped: not valid for this platform" % self.name)
return
for c in self.components:
@@ -79,16 +79,16 @@ class TestCase(object):
try:
obj._run()
except FailedTest as e:
- print "Test %s-%s failed:\n\tExpected: %s\n\tGot: %s" % (self.name, obj.name, e.expected, e.got)
+ print("Test %s-%s failed:\n\tExpected: %s\n\tGot: %s" % (self.name, obj.name, e.expected, e.got))
failures += 1
continue
- print "Test %s-%s succeeded" % (self.name, obj.name)
+ print("Test %s-%s succeeded" % (self.name, obj.name))
successes += 1
- print "Test %s summary:" % self.name
- print "\tSuccesses: %s" % successes
- print "\tFailures: %s" % failures
+ print("Test %s summary:" % self.name)
+ print("\tSuccesses: %s" % successes)
+ print("\tFailures: %s" % failures)
return failures
class TestCaseComponent(object):
--
1.9.0