summaryrefslogtreecommitdiff
path: root/lsb_release.py
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2012-05-23 11:16:39 +0200
committerDidier Raboud <odyx@debian.org>2012-05-23 14:56:48 +0200
commit8dbab4176cad719573acde7f65b7660d374a91dd (patch)
tree4498880f8a6e97cf229a4fd382dcde9cf1c25592 /lsb_release.py
parentaa85cb7a8af20c64c056a966a8bba9924ae56bc8 (diff)
Py3: Use new print() functions and fix types in lsb_release.py
Thanks-to: Jakub Wilk <jwilk@debian.org>
Diffstat (limited to 'lsb_release.py')
-rw-r--r--lsb_release.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/lsb_release.py b/lsb_release.py
index 408c96b..d35f8b1 100644
--- a/lsb_release.py
+++ b/lsb_release.py
@@ -17,6 +17,9 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA
+# Python3-compatible print() function
+from __future__ import print_function
+
import sys
import commands
import os
@@ -247,8 +250,8 @@ def guess_debian_release():
try:
with open(etc_debian_version) as debian_version:
release = debian_version.read().strip()
- except IOError, msg:
- print >> sys.stderr, 'Unable to open ' + etc_debian_version + ':', str(msg)
+ except IOError as msg:
+ print('Unable to open ' + etc_debian_version + ':', str(msg), file=sys.stderr)
release = 'unknown'
if not release[0:1].isalpha():
@@ -320,8 +323,8 @@ def get_lsb_information():
arg = arg[1:-1]
if arg: # Ignore empty arguments
distinfo[var] = arg.strip()
- except IOError, msg:
- print >> sys.stderr, 'Unable to open ' + etc_lsb_release , str(msg)
+ except IOError as msg:
+ print('Unable to open ' + etc_lsb_release + ':', str(msg), file=sys.stderr)
return distinfo
@@ -337,8 +340,8 @@ def get_distro_information():
return lsbinfo
def test():
- print get_distro_information()
- print check_modules_installed()
+ print(get_distro_information())
+ print(check_modules_installed())
if __name__ == '__main__':
test()