port update-motd.d/40-updates to python3
jessie and trusty install python3-apt by default, xenial no longer installes python-apt.
This commit is contained in:
parent
04845ffdf7
commit
700d109af6
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
#
|
||||
# 40-updates - create the list of packages for update with caching
|
||||
# Copyright (c) 2015 Igor Pecovnik
|
||||
@ -59,7 +59,7 @@ def refreshdata ():
|
||||
# open the apt cache
|
||||
try:
|
||||
cache = apt_pkg.Cache(OpNullProgress())
|
||||
except SystemError, e:
|
||||
except SystemError as e:
|
||||
sys.stderr.write("Error: Opening the cache (%s)" % e)
|
||||
sys.exit(-1)
|
||||
|
||||
@ -87,7 +87,7 @@ def refreshdata ():
|
||||
|
||||
# then a standard upgrade
|
||||
depcache.upgrade()
|
||||
except SystemError, e:
|
||||
except SystemError as e:
|
||||
sys.stderr.write("Error: Couldn't mark the upgrade (%s)" % e)
|
||||
sys.exit(-1)
|
||||
|
||||
@ -146,7 +146,7 @@ else:
|
||||
file = open(myfile, 'r+')
|
||||
updates = int(file.read())
|
||||
if updates > 0:
|
||||
print "[ \033[92m%d updates to install\033[0m: apt-get upgrade ]\n" % (updates)
|
||||
print("[ \033[92m%d updates to install\033[0m: apt-get upgrade ]\n" % (updates))
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user