[elbe-devel] [PATCH 18/25] py3: use print("x") function instead of print "x"

Manuel Traut manut at linutronix.de
Mon Dec 11 10:11:12 CET 2017


print is a function in python3 and a statement in python2.
Convert the code to use the print function.

To be python2 compatible a __future__ import is used.

Signed-off-by: Manuel Traut <manut at linutronix.de>
---
 elbe                               | 15 ++++++-----
 elbepack/aptprogress.py            | 10 ++++---
 elbepack/commands/add.py           | 10 ++++---
 elbepack/commands/adjustpkgs.py    | 10 ++++---
 elbepack/commands/bootup-check.py  | 14 +++++-----
 elbepack/commands/buildchroot.py   | 16 ++++++-----
 elbepack/commands/buildsysroot.py  |  7 ++---
 elbepack/commands/check_updates.py | 22 +++++++++-------
 elbepack/commands/chg_archive.py   | 10 ++++---
 elbepack/commands/chroot.py        |  7 ++---
 elbepack/commands/control.py       | 40 ++++++++++++++--------------
 elbepack/commands/daemon.py        | 12 +++++----
 elbepack/commands/db.py            |  5 ++--
 elbepack/commands/debianize.py     | 10 ++++---
 elbepack/commands/diff.py          | 30 +++++++++++----------
 elbepack/commands/gen_update.py    | 20 +++++++-------
 elbepack/commands/genlicence.py    |  3 ++-
 elbepack/commands/get_archive.py   | 13 ++++-----
 elbepack/commands/hdimg.py         | 14 +++++-----
 elbepack/commands/init.py          | 28 +++++++++++---------
 elbepack/commands/parselicence.py  |  9 ++++---
 elbepack/commands/pin_versions.py  | 14 +++++-----
 elbepack/commands/pkgdiff.py       | 10 ++++---
 elbepack/commands/remove_sign.py   | 10 ++++---
 elbepack/commands/setsel.py        |  9 ++++---
 elbepack/commands/show.py          | 40 ++++++++++++++--------------
 elbepack/commands/sign.py          |  6 +++--
 elbepack/commands/validate.py      |  8 +++---
 elbepack/commands/xsdtoasciidoc.py |  6 +++--
 elbepack/db.py                     |  6 +++--
 elbepack/dbaction.py               | 54 ++++++++++++++++++++------------------
 elbepack/finetuning.py             |  4 ++-
 elbepack/gpg.py                    | 40 ++++++++++++++--------------
 elbepack/hdimg.py                  |  6 +++--
 elbepack/pkgutils.py               | 27 ++++++++++++-------
 elbepack/templates.py              |  4 ++-
 elbepack/updated.py                | 12 +++++----
 elbepack/updatepkg.py              | 12 +++++----
 elbepack/virtapt.py                | 11 ++++----
 elbepack/xmldefaults.py            | 11 +++++---
 test/modify_rfs.py                 | 10 ++++---
 test/updated.py                    | 18 +++++++------
 42 files changed, 353 insertions(+), 270 deletions(-)

diff --git a/elbe b/elbe
index 269b1920..2f41bee5 100755
--- a/elbe
+++ b/elbe
@@ -18,6 +18,9 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
+import os
 import sys
 
 import elbepack.commands
@@ -26,11 +29,11 @@ from elbepack.directories import init_directories, get_cmdlist
 
 
 def usage():
-    print 'elbe v' + elbe_version
-    print 'need a subcommand: e.g. \'elbe initvm\'. \n\
-    Available subcommands are: \n'
+    print("elbe v%s" % elbe_version)
+    print("need a subcommand: e.g. \'elbe initvm\'. \n\
+    Available subcommands are: \n")
     for i in get_cmdlist():
-        print '        * '+i
+        print("        * %s" % i)
 
 # First initialise the directories module
 # so that it knows, where the current elbe
@@ -43,13 +46,13 @@ if (len(sys.argv) < 2):
     sys.exit(20)
 
 if sys.argv[1] == "--version":
-    print 'elbe v' + elbe_version + ' ' + running_os[0] + ' ' + running_os[1]
+    print("elbe v %s %s %s" % (elbe_version, running_os[0], running_os[1]))
     sys.exit(0)
 
 cmd_list = get_cmdlist()
 
 if not sys.argv[1] in cmd_list:
-    print "Unknown subcommand !\n"
+    print("Unknown subcommand !\n")
     usage()
     sys.exit(20)
 
diff --git a/elbepack/aptprogress.py b/elbepack/aptprogress.py
index 7bca047a..fd3cc775 100644
--- a/elbepack/aptprogress.py
+++ b/elbepack/aptprogress.py
@@ -16,6 +16,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 from apt.progress.base import InstallProgress, AcquireProgress, OpProgress
 from apt_pkg import size_to_str
 import os
@@ -36,7 +38,7 @@ class ElbeInstallProgress (InstallProgress):
         if self.cb:
             self.cb (line)
         else:
-            print line
+            print(line)
 
     def processing (self, pkg, stage):
         self.write ("processing: " + pkg + " - " + stage)
@@ -51,7 +53,7 @@ class ElbeInstallProgress (InstallProgress):
         try:
             obj.do_install (self.fileno)
         except AttributeError:
-            print 'installing .deb files is not supported by elbe progress'
+            print("installing .deb files is not supported by elbe progress")
             raise SystemError
         return 0
 
@@ -76,7 +78,7 @@ class ElbeAcquireProgress (AcquireProgress):
         if self.cb:
             self.cb (line)
         else:
-            print line
+            print(line)
 
     def ims_hit(self, item):
         line = 'Hit ' + item.description
@@ -114,7 +116,7 @@ class ElbeOpProgress (OpProgress):
         if self.cb:
             self.cb (line)
         else:
-            print line
+            print(line)
     def update (self, percent=None):
         pass
     def done (self):
diff --git a/elbepack/commands/add.py b/elbepack/commands/add.py
index 2b1e344c..317e007c 100644
--- a/elbepack/commands/add.py
+++ b/elbepack/commands/add.py
@@ -18,6 +18,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import sys
 
 from elbepack.elbexml import ElbeXML
@@ -29,25 +31,25 @@ def run_command( argv ):
     (opt,args) = oparser.parse_args(argv)
 
     if len(args) < 2:
-        print "Wrong number of arguments"
+        print("Wrong number of arguments")
         oparser.print_help()
         sys.exit(20)
 
     try:
         xml = ElbeXML ( args[0] )
     except Exception as e:
-        print "Error reading xml file: %s" % str(e)
+        print(("Error reading xml file: %s" % str(e)))
         sys.exit(20)
 
     for a in args[1:]:
         try:
             xml.add_target_package( a )
         except Exception as e:
-            print "Error adding package %s: %s" % (a, str(e))
+            print(("Error adding package %s: %s" % (a, str(e))))
             sys.exit(20)
 
     try:
         xml.xml.write( args[0] )
     except:
-        print "Unable to write new xml file"
+        print("Unable to write new xml file")
         sys.exit(20)
diff --git a/elbepack/commands/adjustpkgs.py b/elbepack/commands/adjustpkgs.py
index 4c8d1779..d21da1bd 100644
--- a/elbepack/commands/adjustpkgs.py
+++ b/elbepack/commands/adjustpkgs.py
@@ -18,6 +18,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 from optparse import OptionParser
 
 from elbepack.asciidoclog import ASCIIDocLog
@@ -53,7 +55,7 @@ class adjpkg(object):
                     continue
                 if p.essential or p.is_auto_installed or (p.name in pkglist) or p.installed.priority == "important" or p.installed.priority == "required":
                     continue
-                print "MARK REMOVE %s" % p.name
+                print("MARK REMOVE %s" % p.name)
                 p.mark_delete( auto_fix=False, purge=True )
 
             for name in pkglist:
@@ -66,7 +68,7 @@ class adjpkg(object):
                 cp = cache[name]
 
                 cp.mark_install()
-                print "MARK INSTALL %s" % cp.name
+                print("MARK INSTALL %s" % cp.name)
 
             cache.commit(apt.progress.base.AcquireProgress(),
                          apt.progress.base.InstallProgress())
@@ -80,7 +82,7 @@ class adjpkg(object):
                     continue
                 if p.is_auto_removable:
                     p.mark_delete( purge=True )
-                    print "MARKED AS AUTOREMOVE %s" % p.name
+                    print("MARKED AS AUTOREMOVE %s" % p.name)
 
         cache.commit(apt.progress.base.AcquireProgress(),
                      apt.progress.base.InstallProgress())
@@ -97,7 +99,7 @@ def run_command( argv ):
     (opt,args) = oparser.parse_args(argv)
 
     if len(args) != 1:
-        print "Wrong number of arguments"
+        print("Wrong number of arguments")
         oparser.print_help()
         sys.exit(20)
 
diff --git a/elbepack/commands/bootup-check.py b/elbepack/commands/bootup-check.py
index c7e22c82..d63cc0cc 100755
--- a/elbepack/commands/bootup-check.py
+++ b/elbepack/commands/bootup-check.py
@@ -18,6 +18,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import apt
 import apt_pkg
 
@@ -33,7 +35,7 @@ def is_installed (ip, cache):
     try:
         p = cache[ip.et.text]
     except KeyError:
-        print '%s is not in local apt' % ip.et.text
+        print("%s is not in local apt" % ip.et.text)
         return False
     if p.current_state == apt_pkg.CURSTATE_INSTALLED:
         return True
@@ -50,26 +52,26 @@ def bootup_check (xml):
     for p in hl_cache:
         if p.is_installed:
             if not is_in_fpl (p, fpl):
-                print '%s installed by user' % p.name
+                print("%s installed by user" % p.name)
 
     for ip in fpl:
          if not is_installed (ip, cache):
-                print '%s removed by user' % ip.et.text
+                print("%s removed by user" % ip.et.text)
 
 def bootup_info ():
     with open ("/etc/elbe_version", 'r') as ev:
-        print ev.read()
+        print(ev.read())
 
 def run_command (argv):
     try:
         xml = etree ("/etc/elbe_base.xml")
     except IOError:
-        print '/etc/elbe_base.xml removed by user'
+        print("/etc/elbe_base.xml removed by user")
         return -1
 
     bootup_check (xml)
     try:
         bootup_info ()
     except IOError:
-        print '/etc/elbe_version removed by user'
+        print("/etc/elbe_version removed by user")
         return -1
diff --git a/elbepack/commands/buildchroot.py b/elbepack/commands/buildchroot.py
index 56f69723..bc7864bd 100644
--- a/elbepack/commands/buildchroot.py
+++ b/elbepack/commands/buildchroot.py
@@ -18,6 +18,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 from optparse import OptionParser
 import sys
 
@@ -85,23 +87,23 @@ def run_command( argv ):
     (opt,args) = oparser.parse_args(argv)
 
     if len(args) != 1:
-        print "wrong number of arguments"
+        print("wrong number of arguments")
         oparser.print_help()
         sys.exit(20)
 
     if not opt.target:
-        print "No target specified"
+        print("No target specified")
         sys.exit(20)
 
     if opt.skip_cdrom:
-        print "WARNING: Skip CDROMS is now the default, use --build-bin to build binary CDROM"
+        print("WARNING: Skip CDROMS is now the default, use --build-bin to build binary CDROM")
 
     try:
         project = ElbeProject( opt.target, args[0], opt.output, opt.name,
                 opt.buildtype, opt.skip_validation )
     except ValidationError as e:
-        print str(e)
-        print "xml validation failed. Bailing out"
+        print((str(e)))
+        print("xml validation failed. Bailing out")
         sys.exit(20)
 
     try:
@@ -109,12 +111,12 @@ def run_command( argv ):
                 opt.build_sources, opt.cdrom_size, opt.debug, opt.skip_pkglist,
                 opt.skip_pbuild )
     except CommandError as ce:
-        print "command in project build failed:", ce.cmd
+        print(("command in project build failed: %s" % ce.cmd))
         sys.exit(20)
 
     try:
         db = ElbeDB()
         db.save_project (project)
     except OperationalError:
-        print "failed to save project in database"
+        print("failed to save project in database")
         sys.exit(20)
diff --git a/elbepack/commands/buildsysroot.py b/elbepack/commands/buildsysroot.py
index 80f3782f..6fcba489 100644
--- a/elbepack/commands/buildsysroot.py
+++ b/elbepack/commands/buildsysroot.py
@@ -16,6 +16,7 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
 
 from optparse import OptionParser
 import sys
@@ -34,7 +35,7 @@ def run_command( argv ):
     (opt,args) = oparser.parse_args(argv)
 
     if len(args) != 1:
-        print "wrong number of arguments"
+        print("wrong number of arguments")
         oparser.print_help()
         sys.exit(20)
 
@@ -42,8 +43,8 @@ def run_command( argv ):
         project = ElbeProject( args[0], override_buildtype=opt.buildtype,
                 skip_validate=opt.skip_validation )
     except ValidationError as e:
-        print str(e)
-        print "xml validation failed. Bailing out"
+        print(str(e))
+        print("xml validation failed. Bailing out")
         sys.exit(20)
 
     project.build_sysroot ()
diff --git a/elbepack/commands/check_updates.py b/elbepack/commands/check_updates.py
index c3e9930a..cc0669eb 100644
--- a/elbepack/commands/check_updates.py
+++ b/elbepack/commands/check_updates.py
@@ -16,6 +16,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import os
 import sys
 
@@ -37,19 +39,19 @@ def run_command( argv ):
     (opt,args) = oparser.parse_args(argv)
 
     if len(args) != 1:
-        print "Wrong number of arguments"
+        print("Wrong number of arguments")
         oparser.print_help()
         sys.exit(20)
 
     if not opt.skip_validation:
         validation = validate_xml (args[0])
         if len (validation) != 0:
-            print "xml validation failed. Bailing out"
+            print("xml validation failed. Bailing out")
             for i in validation:
-                print i
+                print(i)
             sys.exit(20)
 
-    print "checking %s" % args[0]
+    print("checking %s" % args[0])
 
     xml = etree( args[0] )
 
@@ -93,10 +95,10 @@ def run_command( argv ):
 
         if not pname in v.cache:
             if pauto == 'false':
-                print pname, "does not exist in cache but is specified in pkg-list"
+                print("%s does not exist in cache but is specified in pkg-list" % pname)
                 errors += 1
             else:
-                print pname, "is no more required"
+                print("%s is no more required" % pname)
                 required_updates += 1
 
             continue
@@ -106,18 +108,18 @@ def run_command( argv ):
         if d.marked_install( centry ):
             cver = d.get_candidate_ver( v.cache[pname] ).ver_str
             if pver != cver:
-                print pname, "%s != %s" % (pver, cver)
+                print("%s: %s != %s" % (pname, pver, cver))
                 required_updates += 1
 
     sys.stdout.flush()
     sys.stderr.flush()
     if errors > 0:
-        print errors, "Errors occured, xml files needs fixing"
+        print("%d Errors occured, xml files needs fixing" % errors)
         if opt.script:
             os.system( "%s ERRORS %s" % (opt.script, args[0]) )
     elif required_updates > 0:
-        print required_updates, "updates required"
+        print("%d updates required" % required_updates)
         if opt.script:
             os.system( "%s UPDATE %s" % (opt.script, args[0]) )
     else:
-        print "No Updates available"
+        print("No Updates available")
diff --git a/elbepack/commands/chg_archive.py b/elbepack/commands/chg_archive.py
index 66c53d28..c0c148f1 100644
--- a/elbepack/commands/chg_archive.py
+++ b/elbepack/commands/chg_archive.py
@@ -18,6 +18,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import sys
 import os
 
@@ -51,14 +53,14 @@ def run_command( argv ):
     (opt,args) = oparser.parse_args(argv)
 
     if len(args) != 2:
-        print "Wrong number of arguments"
+        print("Wrong number of arguments")
         oparser.print_help()
         sys.exit(20)
 
     try:
         xml = etree( args[0] )
     except:
-        print "Error reading xml file!"
+        print("Error reading xml file!")
         sys.exit(20)
 
     if os.path.isdir (args[1]):
@@ -76,13 +78,13 @@ def run_command( argv ):
         arch = xml.ensure_child( "archive" )
         arch.set_text( enbase( archive ) )
     except:
-        print "Error reading archive"
+        print("Error reading archive")
         sys.exit(20)
 
     try:
         xml.write( args[0] )
     except:
-        print "Unable to write new xml file"
+        print("Unable to write new xml file")
         sys.exit(20)
 
     if os.path.isdir (args[1]):
diff --git a/elbepack/commands/chroot.py b/elbepack/commands/chroot.py
index 29e8de38..2a16d0f4 100644
--- a/elbepack/commands/chroot.py
+++ b/elbepack/commands/chroot.py
@@ -16,6 +16,7 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
 
 from optparse import OptionParser
 import sys
@@ -38,7 +39,7 @@ def run_command( argv ):
     (opt,args) = oparser.parse_args(argv)
 
     if len(args) < 1:
-        print "wrong number of arguments"
+        print("wrong number of arguments")
         oparser.print_help()
         sys.exit(20)
 
@@ -46,8 +47,8 @@ def run_command( argv ):
         project = ElbeProject(args[0], override_buildtype=opt.buildtype,
                 skip_validate=opt.skip_validation, url_validation=ValidationMode.NO_CHECK)
     except ValidationError as e:
-        print str(e)
-        print "xml validation failed. Bailing out"
+        print(str(e))
+        print("xml validation failed. Bailing out")
         sys.exit(20)
 
     os.environ["LANG"] = "C"
diff --git a/elbepack/commands/control.py b/elbepack/commands/control.py
index fa69cb76..e1784481 100755
--- a/elbepack/commands/control.py
+++ b/elbepack/commands/control.py
@@ -103,41 +103,41 @@ def run_command (argv):
     (opt,args) = oparser.parse_args (argv)
 
     if len(args) < 1:
-        print ('elbe control - no subcommand given', file=sys.stderr)
+        print("elbe control - no subcommand given", file=sys.stderr)
         ClientAction.print_actions ()
         return
 
     try:
         control = ElbeSoapClient (opt.host, opt.port, opt.user, opt.passwd, debug=opt.debug, retries=int(opt.retries))
     except socket.error as e:
-        print ("Failed to connect to Soap server %s:%s\n" % (opt.host, opt.port), file=sys.stderr)
-        print ("", file=sys.stderr)
-        print ("Check, wether the Soap Server is running inside the initvm", file=sys.stderr)
-        print ("try 'elbe initvm attach'", file=sys.stderr)
+        print("Failed to connect to Soap server %s:%s\n" % (opt.host, opt.port), file=sys.stderr)
+        print("", file=sys.stderr)
+        print("Check, wether the Soap Server is running inside the initvm", file=sys.stderr)
+        print("try 'elbe initvm attach'", file=sys.stderr)
         sys.exit(10)
     except URLError as e:
-        print ("Failed to connect to Soap server %s:%s\n" % (opt.host, opt.port), file=sys.stderr)
-        print ("", file=sys.stderr)
-        print ("Check, wether the initvm is actually running.", file=sys.stderr)
-        print ("try 'elbe initvm start'", file=sys.stderr)
+        print("Failed to connect to Soap server %s:%s\n" % (opt.host, opt.port), file=sys.stderr)
+        print("", file=sys.stderr)
+        print("Check, wether the initvm is actually running.", file=sys.stderr)
+        print("try 'elbe initvm start'", file=sys.stderr)
         sys.exit(10)
     except BadStatusLine as e:
-        print ("Failed to connect to Soap server %s:%s\n" % (opt.host, opt.port), file=sys.stderr)
-        print ("", file=sys.stderr)
-        print ("Check, wether the initvm is actually running.", file=sys.stderr)
-        print ("try 'elbe initvm start'", file=sys.stderr)
+        print("Failed to connect to Soap server %s:%s\n" % (opt.host, opt.port), file=sys.stderr)
+        print("", file=sys.stderr)
+        print("Check, wether the initvm is actually running.", file=sys.stderr)
+        print("try 'elbe initvm start'", file=sys.stderr)
         sys.exit(10)
 
     try:
         v_server = control.service.get_version ()
         if v_server != elbe_version:
-            print ("elbe v%s is used in initvm, this is not compatible with \
+            print("elbe v%s is used in initvm, this is not compatible with \
 elbe v%s that is used on this machine. Please install same \
 versions of elbe in initvm and on your machine." % (v_server, elbe_version), file=sys.stderr)
             if not (opt.ignore_version):
                 sys.exit (20)
     except AttributeError:
-        print ("the elbe installation inside the initvm doesn't provide a \
+        print("the elbe installation inside the initvm doesn't provide a \
 get_version interface. Please create a new initvm or upgrade \
 elbe inside the existing initvm.", file=sys.stderr)
         if not (opt.ignore_version):
@@ -146,7 +146,7 @@ elbe inside the existing initvm.", file=sys.stderr)
     try:
         action = ClientAction (args[0])
     except KeyError:
-        print ('elbe control - unknown subcommand', file=sys.stderr)
+        print("elbe control - unknown subcommand", file=sys.stderr)
         ClientAction.print_actions ()
         sys.exit(20)
 
@@ -155,10 +155,10 @@ elbe inside the existing initvm.", file=sys.stderr)
     try:
         action.execute (control, opt, args[1:])
     except WebFault as e:
-        print ('Server returned error:', file=sys.stderr)
-        print ('', file=sys.stderr)
+        print("Server returned error:", file=sys.stderr)
+        print("", file=sys.stderr)
         if hasattr (e.fault, 'faultstring'):
-            print (e.fault.faultstring, file=sys.stderr)
+            print(e.fault.faultstring, file=sys.stderr)
         else:
-            print (e, file=sys.stderr)
+            print(e, file=sys.stderr)
         sys.exit(5)
diff --git a/elbepack/commands/daemon.py b/elbepack/commands/daemon.py
index b670d06d..ca137675 100644
--- a/elbepack/commands/daemon.py
+++ b/elbepack/commands/daemon.py
@@ -16,6 +16,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import cherrypy
 
 from optparse import OptionParser
@@ -32,7 +34,7 @@ def run_command( argv ):
     daemons = get_daemonlist()
 
     if not daemons:
-        print 'no elbe daemons installed'
+        print("no elbe daemons installed")
 
     oparser = OptionParser(usage="usage: %prog")
     oparser.add_option( "--host", dest="host", default='0.0.0.0',
@@ -53,16 +55,16 @@ def run_command( argv ):
             if str(o) == str(d):
                 if getattr(opt,o) == True:
                     active = True
-                    print "enable", str(d)
+                    print(("enable %s" % str(d)))
                     module = "elbepack.daemons." + str(d)
                     mod = __import__(module)
                     cmdmod = sys.modules[module]
                     cherrypy.tree.graft(cmdmod.get_app(cherrypy.engine), "/"+str(d))
     if not active:
-        print 'no daemon activated, use'
+        print("no daemon activated, use")
         for d in daemons:
-            print '   --'+d
-        print 'to activate at least one daemon'
+            print(("   --%s" % d))
+        print("to activate at least one daemon")
         return
 
     cherrypy.server.unsubscribe()
diff --git a/elbepack/commands/db.py b/elbepack/commands/db.py
index d6396b6d..91bdfcf3 100644
--- a/elbepack/commands/db.py
+++ b/elbepack/commands/db.py
@@ -18,20 +18,21 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
 
 from elbepack.dbaction import DbAction
 
 def run_command (argv):
 
     if not len(argv):
-        print 'elbe db - no action given'
+        print("elbe db - no action given")
         DbAction.print_actions ()
         return
 
     try:
         DbAction (argv[0]).execute (argv[1:])
     except KeyError:
-        print 'elbe db - unknown action given'
+        print("elbe db - unknown action given")
         DbAction.print_actions ()
         return
 
diff --git a/elbepack/commands/debianize.py b/elbepack/commands/debianize.py
index 32ca7c9a..ecc36f39 100644
--- a/elbepack/commands/debianize.py
+++ b/elbepack/commands/debianize.py
@@ -18,6 +18,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import os
 import sys
 
@@ -25,7 +27,7 @@ from elbepack.debianize.debianize import Debianize, DebianizeBase
 
 def run_command ( args ):
     if os.path.exists ('debian'):
-        print 'debian folder already exists, nothing to do'
+        print("debian folder already exists, nothing to do")
         sys.exit (10)
 
     try:
@@ -33,7 +35,7 @@ def run_command ( args ):
         Debianize (debianizer).run ()
         sys.exit(10)
     except KeyError:
-        print ("This creates a debinization of a source directory.")
-        print ("The software was not able to identify the current directory.")
-        print ("Please run the command from source directory")
+        print("This creates a debinization of a source directory.")
+        print("The software was not able to identify the current directory.")
+        print("Please run the command from source directory")
         sys.exit (20)
diff --git a/elbepack/commands/diff.py b/elbepack/commands/diff.py
index 0cbe7107..a5f994a8 100644
--- a/elbepack/commands/diff.py
+++ b/elbepack/commands/diff.py
@@ -16,6 +16,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import os
 import sys
 import filecmp
@@ -40,7 +42,7 @@ def walk_generated( gen_path, fix_path, exclude ):
 
         if len(files)==0:
             if not os.path.exists(fix_path+infs_root):
-                print "empty directory %s only exists in gen image" % (infs_root)
+                print("empty directory %s only exists in gen image" % (infs_root))
                 file_to_rm.append( infs_root )
         else:
             for f in files:
@@ -51,17 +53,17 @@ def walk_generated( gen_path, fix_path, exclude ):
                     if os.path.isfile(gen_fname) and os.path.isfile(fix_fname):
                         if not os.path.islink(gen_fname) and not os.path.islink(fix_fname):
                             if not filecmp.cmp(gen_fname,fix_fname,shallow=False):
-                                print "files %s and %s differ" %(gen_fname, fix_fname)
+                                print("files %s and %s differ" %(gen_fname, fix_fname))
                                 file_differ.append(os.path.join( infs_root, f ) )
                         else:
                             if not (os.readlink(gen_fname) == os.readlink(fix_fname)):
-                                print "symlinks %s and %s differ" %(gen_fname, fix_fname)
+                                print("symlinks %s and %s differ" %(gen_fname, fix_fname))
                                 file_differ.append(os.path.join( infs_root, f ) )
 
                 elif not os.path.exists(gen_fname) and os.path.exists(fix_fname):
-                    print "file %s only exists in fixed image" % (fix_fname)
+                    print("file %s only exists in fixed image" % (fix_fname))
                 elif os.path.exists(gen_fname) and not os.path.exists(fix_fname):
-                    print "file %s only exists in gen image" % (gen_fname)
+                    print("file %s only exists in gen image" % (gen_fname))
                     file_to_rm.append( os.path.join( infs_root, f ) )
 
     return file_differ, file_to_rm
@@ -85,7 +87,7 @@ def walk_fixed( gen_path, fix_path, exclude ):
 
         if len(files)==0:
             if not os.path.exists(gen_path+infs_root):
-                print "empty directory %s only exists in fix image" % (infs_root)
+                print("empty directory %s only exists in fix image" % (infs_root))
                 dir_to_create.append( infs_root.lstrip("/") )
         else:
             for f in files:
@@ -93,7 +95,7 @@ def walk_fixed( gen_path, fix_path, exclude ):
                 fix_fname = os.path.join(fix_path+infs_root, f)
 
                 if not os.path.exists(gen_fname) and os.path.exists(fix_fname):
-                    print "file %s only exists in fixed image" % (fix_fname)
+                    print("file %s only exists in fixed image" % (fix_fname))
                     file_only.append( os.path.join( infs_root, f ) )
 
     return file_only, dir_to_create
@@ -106,7 +108,7 @@ def run_command( argv ):
     (opt,args) = oparser.parse_args(argv)
 
     if len(args) != 2:
-        print "Wrong number of arguments"
+        print("Wrong number of arguments")
         oparser.print_help()
         sys.exit(20)
 
@@ -120,19 +122,19 @@ def run_command( argv ):
     only, mkdir = walk_fixed( gen_rfs, fix_rfs, opt.exclude )
 
 
-    print "suggesting:"
-    print
+    print("suggesting:")
+    print()
 
     for f in rm:
-        print "<rm>%s</rm>"%f
+        print("<rm>%s</rm>"%f)
 
     for d in mkdir:
-        print "<mkdir>%s</mkdir>"%d
+        print("<mkdir>%s</mkdir>"%d)
 
-    print
+    print("")
 
     fileline=""
     for f in differ+only:
-        print "tar rf archive.tar -C %s %s"%(fix_rfs, f)
+        print("tar rf archive.tar -C %s %s"%(fix_rfs, f))
 
 
diff --git a/elbepack/commands/gen_update.py b/elbepack/commands/gen_update.py
index 7d7e00d0..bcae057c 100644
--- a/elbepack/commands/gen_update.py
+++ b/elbepack/commands/gen_update.py
@@ -18,6 +18,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 from optparse import OptionParser
 import sys
 import os.path
@@ -59,11 +61,11 @@ def run_command( argv ):
             sys.exit(20)
 
     if len(args) == 1 and not opt.target:
-        print "No target specified"
+        print("No target specified")
         sys.exit(20)
 
     if not opt.output:
-        print "No output file specified"
+        print("No output file specified")
         sys.exit(20)
 
     if opt.buildtype:
@@ -76,19 +78,19 @@ def run_command( argv ):
                 override_buildtype=buildtype,
                 skip_validate=opt.skip_validation)
     except ValidationError as e:
-        print str(e)
-        print "xml validation failed. Bailing out"
+        print(str(e))
+        print("xml validation failed. Bailing out")
         sys.exit(20)
 
     if opt.presh_file:
         if not os.path.isfile(opt.presh_file):
-            print 'pre.sh file does not exist'
+            print('pre.sh file does not exist')
             sys.exit(20)
         project.presh_file = opt.presh_file
 
     if opt.postsh_file:
         if not os.path.isfile(opt.postsh_file):
-            print 'post.sh file does not exist'
+            print('post.sh file does not exist')
             sys.exit(20)
         project.postsh_file = opt.postsh_file
 
@@ -102,9 +104,9 @@ def run_command( argv ):
                 cfg_dir = opt.cfg_dir, cmd_dir = opt.cmd_dir )
 
     except ValidationError as e:
-        print str(e)
-        print "xml validation failed. Bailing out"
+        print(str(e))
+        print("xml validation failed. Bailing out")
         sys.exit(20)
     except MissingData as e:
-        print str(e)
+        print(str(e))
         sys.exit(20)
diff --git a/elbepack/commands/genlicence.py b/elbepack/commands/genlicence.py
index 234000f7..dfe77dc3 100644
--- a/elbepack/commands/genlicence.py
+++ b/elbepack/commands/genlicence.py
@@ -16,6 +16,7 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
 
 from optparse import OptionParser
 import sys
@@ -35,7 +36,7 @@ def run_command( argv ):
     (opt,args) = oparser.parse_args(argv)
 
     if len(args) != 1:
-        print "wrong number of arguments"
+        print("wrong number of arguments")
         oparser.print_help()
         sys.exit(20)
 
diff --git a/elbepack/commands/get_archive.py b/elbepack/commands/get_archive.py
index cfba9825..ec0da856 100644
--- a/elbepack/commands/get_archive.py
+++ b/elbepack/commands/get_archive.py
@@ -18,10 +18,11 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import os
 import sys
 
-
 from base64 import standard_b64decode
 
 from elbepack.treeutils import etree
@@ -40,28 +41,28 @@ def run_command( argv ):
     (opt,args) = oparser.parse_args(argv)
 
     if len(args) != 2:
-        print "Wrong number of arguments"
+        print("Wrong number of arguments")
         oparser.print_help()
         sys.exit(20)
 
     if os.path.exists( args[1] ):
-        print "archive already exists, bailing out"
+        print("archive already exists, bailing out")
         sys.exit(20)
 
     try:
         xml = etree( args[0] )
     except:
-        print "Error reading xml file!"
+        print("Error reading xml file!")
         sys.exit(20)
 
     if xml.has("archive"):
         try:
             unbase( xml.text("/archive"), args[1] )
         except:
-            print "Error writing archive"
+            print("Error writing archive")
             sys.exit(20)
     else:
-        print "no archive in this xml file."
+        print("no archive in this xml file.")
         sys.exit(20)
 
 
diff --git a/elbepack/commands/hdimg.py b/elbepack/commands/hdimg.py
index 05be1138..1f0764c1 100644
--- a/elbepack/commands/hdimg.py
+++ b/elbepack/commands/hdimg.py
@@ -18,6 +18,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import sys
 
 from optparse import OptionParser
@@ -48,17 +50,17 @@ def run_command( argv ):
     (opt,args) = oparser.parse_args(argv)
 
     if len(args) != 1:
-        print "Wrong number of arguments"
+        print("Wrong number of arguments")
         oparser.print_help()
         sys.exit(20)
 
     if not opt.target:
-        print "No directory specified!"
+        print("No directory specified!")
         oparser.print_help()
         sys.exit(20)
 
     if not opt.output:
-        print "No Log output"
+        print("No Log output")
         oparser.print_help()
         sys.exit(20)
 
@@ -66,7 +68,7 @@ def run_command( argv ):
         opt.grub_version = 0
 
     if opt.grub_version not in [0,199,202]:
-        print "invalid grub version"
+        print("invalid grub version")
         oparser.print_help()
         sys.exit(20)
 
@@ -75,8 +77,8 @@ def run_command( argv ):
                 xmlpath=args[0], logpath=opt.output,
                 skip_validate=opt.skip_validation )
     except ValidationError as e:
-        print str(e)
-        print "xml validation failed. Bailing out"
+        print(str(e))
+        print("xml validation failed. Bailing out")
         sys.exit(20)
 
     project.targetfs.part_target(opt.target, opt.grub_version)
diff --git a/elbepack/commands/init.py b/elbepack/commands/init.py
index fdad0246..6700d49b 100644
--- a/elbepack/commands/init.py
+++ b/elbepack/commands/init.py
@@ -18,6 +18,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import os
 import sys
 import shutil
@@ -68,31 +70,31 @@ def run_command( argv ):
     (opt,args) = oparser.parse_args(argv)
 
     if len(args) == 0:
-        print "no filename specified"
+        print("no filename specified")
         oparser.print_help()
         sys.exit(20)
     elif len(args) > 1:
-        print "too many filenames specified"
+        print("too many filenames specified")
         oparser.print_help()
         sys.exit(20)
 
     if opt.devel:
         if not os.path.isdir( os.path.join (elbe_dir, "elbepack")):
-            print "Devel Mode only valid, when running from elbe checkout"
+            print("Devel Mode only valid, when running from elbe checkout")
             sys.exit(20)
 
     if not opt.skip_validation:
         validation = validate_xml (args[0])
         if len (validation) != 0:
-            print "xml validation failed. Bailing out"
+            print("xml validation failed. Bailing out")
             for i in validation:
-                print i
+                print(i)
             sys.exit(20)
 
     xml = etree( args[0] )
 
     if not xml.has( "initvm" ):
-        print "fatal error: xml missing mandatory section 'initvm'"
+        print("fatal error: xml missing mandatory section 'initvm'")
         sys.exit(20)
 
     if opt.buildtype:
@@ -126,14 +128,14 @@ def run_command( argv ):
     try:
         os.makedirs(path)
     except OSError as e:
-        print 'unable to create project directory: %s (%s)' % (path, e.strerror)
+        print("unable to create project directory: %s (%s)" % (path, e.strerror))
         sys.exit(30)
 
     out_path = os.path.join(path,".elbe-in")
     try:
         os.makedirs(out_path)
     except OSError as e:
-        print 'unable to create subdirectory: %s (%s)' % (out_path, e.strerror)
+        print("unable to create subdirectory: %s (%s)" % (out_path, e.strerror))
         sys.exit(30)
 
     d = {"elbe_version": elbe_version,
@@ -153,11 +155,11 @@ def run_command( argv ):
     try:
         copy_kinitrd(xml.node("/initvm"), out_path, defs, arch="amd64")
     except NoKinitrdException as e:
-        print "Failure to download kernel/initrd debian Package:"
-        print
-        print e.message
-        print
-        print "Check Mirror configuration"
+        print("Failure to download kernel/initrd debian Package:")
+        print("")
+        print(e.message)
+        print("")
+        print("Check Mirror configuration")
         sys.exit(20)
 
     templates = os.listdir( init_template_dir )
diff --git a/elbepack/commands/parselicence.py b/elbepack/commands/parselicence.py
index baa3b01f..e2d78f66 100644
--- a/elbepack/commands/parselicence.py
+++ b/elbepack/commands/parselicence.py
@@ -16,6 +16,7 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
 
 from optparse import OptionParser
 from datetime import datetime
@@ -160,7 +161,7 @@ def run_command( argv ):
     (opt,args) = oparser.parse_args(argv)
 
     if len(args) != 1:
-        print "wrong number of arguments"
+        print("wrong number of arguments")
         oparser.print_help()
         sys.exit(20)
 
@@ -172,7 +173,7 @@ def run_command( argv ):
     err_pkg = 0
 
     if not opt.mapping:
-        print "A mapping file is required"
+        print("A mapping file is required")
         oparser.print_help()
         sys.exit(20)
 
@@ -283,8 +284,8 @@ def run_command( argv ):
         tree.write (opt.output)
 
 
-    print "statistics:"
-    print 'num:%d mr:%d hr:%d err_pkg:%d' % (num_pkg, mr, hr, err_pkg)
+    print("statistics:")
+    print(("num:%d mr:%d hr:%d err_pkg:%d" % (num_pkg, mr, hr, err_pkg)))
 
 
 
diff --git a/elbepack/commands/pin_versions.py b/elbepack/commands/pin_versions.py
index 2b4b83b6..f8a28ca8 100644
--- a/elbepack/commands/pin_versions.py
+++ b/elbepack/commands/pin_versions.py
@@ -18,6 +18,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import sys
 
 from elbepack.treeutils import etree
@@ -35,26 +37,26 @@ def run_command( argv ):
     (opt,args) = oparser.parse_args(argv)
 
     if len(args) != 1:
-        print "Wrong number of arguments"
+        print("Wrong number of arguments")
         oparser.print_help()
         sys.exit(20)
 
     if not opt.skip_validation:
         validation = validate_xml (args[0])
         if len (validation) != 0:
-            print "xml validation failed. Bailing out"
+            print("xml validation failed. Bailing out")
             for i in validation:
-                print i
+                print(i)
             sys.exit(20)
 
     try:
         xml = etree( args[0] )
     except:
-        print "Error reading xml file!"
+        print("Error reading xml file!")
         sys.exit(20)
 
     if not xml.has ("fullpkgs"):
-        print "xml file does not have fullpkgs node"
+        print("xml file does not have fullpkgs node")
         sys.exit(20)
 
     plist = xml.ensure_child("/target/pkg-list")
@@ -74,6 +76,6 @@ def run_command( argv ):
     try:
         xml.write( args[0] )
     except:
-        print "Unable to write new xml file"
+        print("Unable to write new xml file")
         sys.exit(20)
 
diff --git a/elbepack/commands/pkgdiff.py b/elbepack/commands/pkgdiff.py
index 0cc27465..9e05966d 100644
--- a/elbepack/commands/pkgdiff.py
+++ b/elbepack/commands/pkgdiff.py
@@ -16,6 +16,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import os
 import sys
 
@@ -34,7 +36,7 @@ def run_command( argv ):
     (opt,args) = oparser.parse_args(argv)
 
     if len(args) != 2:
-        print "Wrong number of arguments"
+        print("Wrong number of arguments")
         oparser.print_help()
         sys.exit(20)
 
@@ -79,12 +81,12 @@ def run_command( argv ):
 
     for p in list(fix_pkgs.keys()):
         if not p in list(gen_pkgs.keys()):
-            print "+<pkg>%s</pkg>" % p
+            print("+<pkg>%s</pkg>" % p)
 
     for p in list(gen_pkgs.keys()):
         if not p in list(fix_pkgs.keys()):
-            print "-<pkg>%s</pkg>" % p
+            print("-<pkg>%s</pkg>" % p)
 
     for p in list(fix_pkgs.keys()):
         if p in list(gen_pkgs.keys()) and fix_pkgs[p] != gen_pkgs[p]:
-            print "%s: Version mismatch %s != %s" % (p, fix_pkgs[p], gen_pkgs[p])
+            print("%s: Version mismatch %s != %s" % (p, fix_pkgs[p], gen_pkgs[p]))
diff --git a/elbepack/commands/remove_sign.py b/elbepack/commands/remove_sign.py
index b2b58eee..4dd06f33 100644
--- a/elbepack/commands/remove_sign.py
+++ b/elbepack/commands/remove_sign.py
@@ -20,16 +20,18 @@
 # with has to have ultimate trust level, otherwise you'll only get
 # VALID (Untrusted)!
 
+from __future__ import print_function
+
 from elbepack.gpg import unsign_file
 
 def run_command( argv ):
     if(len(argv) != 1):
-        print 'Wrong number of arguments.'
-        print 'Please pass the name of the file to unsign.'
+        print("Wrong number of arguments.")
+        print("Please pass the name of the file to unsign.")
         return
 
     fname = unsign_file( argv[0] )
     if fname:
-        print "unsigned file:", fname
+        print("unsigned file: %s" % fname)
     else:
-        print "removing signature failed"
+        print("removing signature failed")
diff --git a/elbepack/commands/setsel.py b/elbepack/commands/setsel.py
index 799116db..26f17507 100644
--- a/elbepack/commands/setsel.py
+++ b/elbepack/commands/setsel.py
@@ -18,8 +18,9 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
-import sys
+from __future__ import print_function
 
+import sys
 
 from elbepack.treeutils import etree
 from optparse import OptionParser
@@ -38,12 +39,12 @@ def parse_selections( fname ):
         sp = l.split()
 
 
-        print sp[0], sp[1]
+        print("%s %s" % (sp[0], sp[1]))
 
         if sp[1] == 'install':
             sels.append(sp[0])
 
-    print sels
+    print(sels)
     return sels
 
 
@@ -53,7 +54,7 @@ def run_command( argv ):
     (opt,args) = oparser.parse_args(argv)
 
     if len(args) != 2:
-        print "Wrong number of arguments"
+        print("Wrong number of arguments")
         oparser.print_help()
         sys.exit(20)
 
diff --git a/elbepack/commands/show.py b/elbepack/commands/show.py
index 1a02155b..00df63ff 100644
--- a/elbepack/commands/show.py
+++ b/elbepack/commands/show.py
@@ -18,6 +18,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import sys
 
 from elbepack.treeutils import etree
@@ -39,12 +41,12 @@ def run_command( argv ):
     (opt,args) = oparser.parse_args(argv)
 
     if len(args) == 0:
-        print "No Filename specified"
+        print("No Filename specified")
         oparser.print_help()
         sys.exit(20)
 
     if len(args) > 1:
-        print "too many filenames specified"
+        print("too many filenames specified")
         oparser.print_help()
         sys.exit(20)
 
@@ -52,39 +54,39 @@ def run_command( argv ):
         if not opt.skip_validation:
             validation = validate_xml (args[0])
             if len (validation) != 0:
-                print "xml validation failed. Bailing out"
+                print("xml validation failed. Bailing out")
                 for i in validation:
-                    print i
+                    print(i)
                 sys.exit(20)
 
         xml = etree( args[0] )
     except:
-        print "Unable to open xml File. Bailing out"
+        print("Unable to open xml File. Bailing out")
         sys.exit(20)
 
     if not xml.has("./project"):
-        print "no project description available"
+        print("no project description available")
         sys.exit(20)
 
-    print '== %s ==' %(args[0])
-    print 'Debian suite: %s' % (xml.text("./project/suite"))
+    print("== %s ==" %(args[0]))
+    print("Debian suite: %s" % (xml.text("./project/suite")))
     for s in xml.text("./project/description").splitlines():
-        print '%s' % s.strip()
+        print("%s" % s.strip())
     if opt.verbose:
-        print 'root password: %s' % xml.text("./target/passwd")
-        print 'primary_mirror: %s://%s%s' %(
+        print("root password: %s" % xml.text("./target/passwd"))
+        print("primary_mirror: %s://%s%s" % (
               xml.text("./project/mirror/primary_proto"),
               xml.text("./project/mirror/primary_host"),
-              xml.text("./project/mirror/primary_path"))
+              xml.text("./project/mirror/primary_path")))
         if xml.has("./project/mirror/url-list"):
-            print 'additional mirrors:'
+            print("additional mirrors:")
             for url in xml.node("./project/mirror/url-list"):
                 if url.has("binary"):
-                    print '    deb %s' % url.text("binary").strip()
+                    print("    deb %s" % url.text("binary").strip())
                 if url.has("source"):
-                    print '    deb-src %s' % url.text("source").strip()
-        print 'packages:'
+                    print("    deb-src %s" % url.text("source").strip())
+        print("packages:")
         for pkg in xml.node("./target/pkg-list"):
-            print '    %s' % pkg.et.text
-        print 'skip package validation: %s' % xml.has("./project/noauth")
-        print 'archive embedded?        %s' % xml.has("./archive")
+            print("    %s" % pkg.et.text)
+        print("skip package validation: %s" % xml.has("./project/noauth"))
+        print("archive embedded?        %s" % xml.has("./archive"))
diff --git a/elbepack/commands/sign.py b/elbepack/commands/sign.py
index b87c9849..4047352b 100644
--- a/elbepack/commands/sign.py
+++ b/elbepack/commands/sign.py
@@ -16,12 +16,14 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 from elbepack.gpg import sign_file
 
 def run_command( argv ):
     if(len(argv) != 2):
-        print 'Wrong number of arguments.'
-        print 'Please pass the name of the file to sign and a valid gnupg fingerprint.'
+        print("Wrong number of arguments.")
+        print("Please pass the name of the file to sign and a valid gnupg fingerprint.")
         return
     else:
         sign_file( argv[0], argv[1])
diff --git a/elbepack/commands/validate.py b/elbepack/commands/validate.py
index 340eb506..9ab37f44 100644
--- a/elbepack/commands/validate.py
+++ b/elbepack/commands/validate.py
@@ -16,6 +16,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import sys
 import os
 from optparse import OptionParser
@@ -41,16 +43,16 @@ def run_command( argv ):
 
     validation = validate_xml (args[0])
     if len (validation):
-        print "validation failed"
+        print("validation failed")
         for i in validation:
-            print i
+            print(i)
         sys.exit(20)
 
     if opt.validate_urls:
         try:
             xml = ElbeXML(args[0], url_validation=ValidationMode.CHECK_ALL)
         except ValidationError as e:
-            print e
+            print(e)
             sys.exit(20)
 
     sys.exit (0)
diff --git a/elbepack/commands/xsdtoasciidoc.py b/elbepack/commands/xsdtoasciidoc.py
index c64e11c4..ec3e172e 100644
--- a/elbepack/commands/xsdtoasciidoc.py
+++ b/elbepack/commands/xsdtoasciidoc.py
@@ -18,6 +18,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import sys
 
 from elbepack.treeutils import etree
@@ -36,14 +38,14 @@ def run_command( argv ):
     (opt,args) = oparser.parse_args(argv)
 
     if len(args) != 1:
-        print "Wrong number of arguments"
+        print("Wrong number of arguments")
         oparser.print_help()
         sys.exit(20)
 
     xml = etree( args[0] )
 
     if not opt.out:
-        print 'output is mandatory'
+        print("--output is mandatory")
         sys.exit(20)
 
     d = {"opt": opt,
diff --git a/elbepack/db.py b/elbepack/db.py
index fa322a2e..6edfd0a1 100644
--- a/elbepack/db.py
+++ b/elbepack/db.py
@@ -18,6 +18,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 try:
     from urllib.parse import quote
 except ImportError:
@@ -977,7 +979,7 @@ class ElbeDB(object):
             try:
                 os.makedirs (cls.db_path)
             except OSError as e:
-                print e
+                print(str(e))
                 return
 
         db = ElbeDB()
@@ -985,7 +987,7 @@ class ElbeDB(object):
         try:
             db.add_user(name, fullname, password, email, admin)
         except ElbeDBError as e:
-            print e
+            print(str(e))
 
 
 class User(Base):
diff --git a/elbepack/dbaction.py b/elbepack/dbaction.py
index 92515c17..52dee742 100644
--- a/elbepack/dbaction.py
+++ b/elbepack/dbaction.py
@@ -18,6 +18,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import sys
 
 from optparse import OptionParser
@@ -35,9 +37,9 @@ class DbAction(object):
 
     @classmethod
     def print_actions(cls):
-        print 'available actions are:'
+        print("available actions are:")
         for a in cls.actiondict:
-            print '   ' + a
+            print("   %s" % a)
 
     def __new__(cls, node):
         action = cls.actiondict[node]
@@ -85,7 +87,7 @@ class AddUserAction(DbAction):
         (opt, arg) = oparser.parse_args (args)
 
         if len(arg) != 1:
-            print "wrong number of arguments"
+            print("wrong number of arguments")
             oparser.print_help()
             return
 
@@ -115,13 +117,13 @@ class DelUserAction(DbAction):
         (opt, arg) = oparser.parse_args (args)
 
         if len(arg) != 1:
-            print "usage: elbe db del_user <userid>"
+            print("usage: elbe db del_user <userid>")
             return
 
         try:
             userid = int(arg[0])
         except:
-            print "userid must be an integer"
+            print("userid must be an integer")
             return
 
         db = ElbeDB()
@@ -131,18 +133,18 @@ class DelUserAction(DbAction):
         if projects:
             if not opt.quiet:
                 if opt.delete_projects:
-                    print "removing projects owned by the deleted user:"
+                    print("removing projects owned by the deleted user:")
                 else:
-                    print "keeping projects owned by the deleted user:"
+                    print("keeping projects owned by the deleted user:")
 
         for p in projects:
             if not opt.quiet:
-                print p.builddir + ":", p.name, "[", p.version, "]", p.edit
+                print("%s: %s [%s] %s" % (p.builddir, p.name, p.version, p.edit))
             if opt.delete_projects:
                 try:
                     db.del_project( p.builddir )
                 except ElbeDBError as e:
-                    print "  ==> ", e
+                    print("  ==> %s " % str(e))
 
 DbAction.register(DelUserAction)
 
@@ -158,7 +160,7 @@ class ListProjectsAction(DbAction):
         projects = db.list_projects ()
 
         for p in projects:
-            print p.builddir+":", p.name, "[", p.version, "]", p.edit
+            print("%s: %s [%s] %s" % (p.builddir, p.name, p.version, p.edit))
 
 DbAction.register(ListProjectsAction)
 
@@ -174,7 +176,7 @@ class ListUsersAction(DbAction):
         users = db.list_users ()
 
         for u in users:
-            print u.name+":", u.fullname, "<"+u.email+">"
+            print("%s: %s <%s>" % (u.name, u.fullname, u.email))
 
 DbAction.register(ListUsersAction)
 
@@ -211,7 +213,7 @@ class DeleteProjectAction(DbAction):
 
     def execute(self, args):
         if len (args) != 1:
-            print "usage: elbe db del_project <project_dir>"
+            print("usage: elbe db del_project <project_dir>")
             return
 
         db = ElbeDB()
@@ -228,7 +230,7 @@ class SetXmlAction(DbAction):
 
     def execute(self, args):
         if len (args) != 2:
-            print "usage: elbe db set_xml <project_dir> <xml>"
+            print("usage: elbe db set_xml <project_dir> <xml>")
             return
 
         db = ElbeDB()
@@ -246,7 +248,7 @@ class BuildAction(DbAction):
 
     def execute(self, args):
         if len (args) != 1:
-            print "usage: elbe db build <project_dir>"
+            print("usage: elbe db build <project_dir>")
             return
 
         db = ElbeDB()
@@ -259,7 +261,7 @@ class BuildAction(DbAction):
         except Exception as e:
             db.update_project_files( ep )
             db.reset_busy( args[0], "build_failed" )
-            print e
+            print(str(e))
             return
         db.reset_busy( args[0], "build_done" )
 
@@ -275,16 +277,16 @@ class GetFilesAction(DbAction):
 
     def execute(self, args):
         if len (args) != 1:
-            print "usage: elbe db get_files <project_dir>"
+            print("usage: elbe db get_files <project_dir>")
             return
 
         db = ElbeDB()
         files = db.get_project_files (args[0])
         for f in files:
             if f.description:
-                print "%-40s  %s" % (f.name, f.description)
+                print("%-40s  %s" % (f.name, f.description))
             else:
-                print f.name
+                print(f.name)
 
 DbAction.register(GetFilesAction)
 
@@ -305,7 +307,7 @@ class ResetProjectAction(DbAction):
         (opt, arg) = oparser.parse_args (args)
 
         if len(arg) != 1:
-            print "wrong number of arguments"
+            print("wrong number of arguments")
             oparser.print_help()
             return
 
@@ -324,7 +326,7 @@ class SetProjectVersionAction(DbAction):
 
     def execute(self, args):
         if len(args) != 2:
-            print "usage: elbe db set_project_version <project_dir> <version>"
+            print("usage: elbe db set_project_version <project_dir> <version>")
             return
 
         db = ElbeDB()
@@ -342,7 +344,7 @@ class ListVersionsAction(DbAction):
 
     def execute(self, args):
         if len(args) != 1:
-            print "usage: elbe db list_versions <project_dir>"
+            print("usage: elbe db list_versions <project_dir>")
             return
 
         db = ElbeDB()
@@ -350,9 +352,9 @@ class ListVersionsAction(DbAction):
 
         for v in versions:
             if v.description:
-                print v.version + ": " + v.description
+                print("%s: %s" % (v.version, v.description))
             else:
-                print v.version
+                print(v.version)
 
 DbAction.register(ListVersionsAction)
 
@@ -371,7 +373,7 @@ class SaveVersionAction(DbAction):
         (opt, arg) = oparser.parse_args (args)
 
         if len(arg) != 1:
-            print "wrong number of arguments"
+            print("wrong number of arguments")
             oparser.print_help()
             return
 
@@ -390,7 +392,7 @@ class DelVersionAction(DbAction):
 
     def execute(self, args):
         if len(args) != 2:
-            print "usage: elbe db del_version <project_dir> <version>"
+            print("usage: elbe db del_version <project_dir> <version>")
             return
 
         db = ElbeDB()
@@ -408,7 +410,7 @@ class PrintVersionXMLAction(DbAction):
 
     def execute(self, args):
         if len(args) != 2:
-            print "usage: elbe db print_version_xml <project_dir> <version>"
+            print("usage: elbe db print_version_xml <project_dir> <version>")
             return
 
         db = ElbeDB()
diff --git a/elbepack/finetuning.py b/elbepack/finetuning.py
index 64bfec81..8166dd32 100644
--- a/elbepack/finetuning.py
+++ b/elbepack/finetuning.py
@@ -16,6 +16,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import os
 import gpgme
 
@@ -397,6 +399,6 @@ def do_finetuning(xml, log, buildenv, target):
             action = FinetuningAction( i )
             action.execute(log, buildenv, target)
         except KeyError:
-            print "Unimplemented finetuning action " + i.et.tag
+            print("Unimplemented finetuning action '%s'" % (i.et.tag))
         except CommandError:
             log.printo( "Finetuning Error, trying to continue anyways" )
diff --git a/elbepack/gpg.py b/elbepack/gpg.py
index 89b9077f..0ea42be9 100644
--- a/elbepack/gpg.py
+++ b/elbepack/gpg.py
@@ -18,6 +18,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import gpgme
 import os
 
@@ -67,46 +69,46 @@ def check_signature(ctx, sig):
     status = OverallStatus()
 
     if sig.summary & gpgme.SIGSUM_KEY_MISSING:
-        print 'Signature with unknown key: %s' % sig.fpr
+        print("Signature with unknown key: %s" % sig.fpr)
         status.key_missing = True
         return status
 
     # there should be a key
     key = ctx.get_key(sig.fpr)
-    print '%s <%s> (%s):' % (key.uids[0].name, key.uids[0].email, sig.fpr),
+    print("%s <%s> (%s):" % (key.uids[0].name, key.uids[0].email, sig.fpr))
     if sig.summary & gpgme.SIGSUM_VALID == gpgme.SIGSUM_VALID:
         # signature fully valid and trusted
-        print 'VALID (Trusted)'
+        print("VALID (Trusted)")
         return status
 
     # print detailed status in case it's not fully valid and trusted
     if sig.summary == 0:
         # Signature is valid, but the key is not ultimately trusted,
         # see: http://www.gossamer-threads.com/lists/gnupg/users/52350
-        print 'VALID (Untrusted).',
+        print("VALID (Untrusted).")
     if sig.summary & gpgme.SIGSUM_SIG_EXPIRED == gpgme.SIGSUM_SIG_EXPIRED:
-        print 'SIGNATURE EXPIRED!',
+        print("SIGNATURE EXPIRED!")
         status.sig_expired = True
     if sig.summary & gpgme.SIGSUM_KEY_EXPIRED == gpgme.SIGSUM_KEY_EXPIRED:
-        print 'KEY EXPIRED!',
+        print("KEY EXPIRED!")
         status.key_expired = True
     if sig.summary & gpgme.SIGSUM_KEY_REVOKED == gpgme.SIGSUM_KEY_REVOKED:
-        print 'KEY REVOKED!',
+        print("KEY REVOKED!")
         status.key_revoked = True
     if sig.summary & gpgme.SIGSUM_RED == gpgme.SIGSUM_RED:
-        print 'INVALID SIGNATURE!',
+        print("INVALID SIGNATURE!")
         status.invalid = True
     if sig.summary & gpgme.SIGSUM_CRL_MISSING == gpgme.SIGSUM_CRL_MISSING:
-        print 'CRL MISSING!',
+        print("CRL MISSING!")
         status.gpgme_error = True
     if sig.summary & gpgme.SIGSUM_CRL_TOO_OLD == gpgme.SIGSUM_CRL_TOO_OLD:
-        print 'CRL TOO OLD!',
+        print("CRL TOO OLD!")
         status.gpgme_error = True
     if sig.summary & gpgme.SIGSUM_BAD_POLICY == gpgme.SIGSUM_BAD_POLICY:
-        print 'UNMET POLICY REQUIREMENT!',
+        print("UNMET POLICY REQUIREMENT!")
         status.gpgme_error = True
     if sig.summary & gpgme.SIGSUM_SYS_ERROR == gpgme.SIGSUM_SYS_ERROR:
-        print 'SYSTEM ERROR!',
+        print("SYSTEM ERROR!'")
         status.gpgme_error = True
 
     return status
@@ -115,7 +117,7 @@ def check_signature(ctx, sig):
 def unsign_file(fname):
     # check for .gpg extension and create an output filename without it
     if len(fname) <= 4 or fname[len(fname)-4:] != '.gpg':
-        print 'The input file needs a .gpg extension'
+        print("The input file needs a .gpg extension")
         return None
 
     outfilename = fname[:len(fname)-4]
@@ -143,9 +145,9 @@ def unsign_file(fname):
         return outfilename
 
     except IOError as ex:
-        print ex.message
+        print(ex.message)
     except Exception as ex:
-        print 'Error checking the file %s: %s' % (fname, ex.message)
+        print("Error checking the file %s: %s" % (fname, ex.message))
 
     return None
 
@@ -158,7 +160,7 @@ def sign (infile, outfile, fingerprint):
     try:
         key = ctx.get_key(fingerprint)
     except gpgme.GpgmeError as ex:
-        print 'no key with fingerprint %s: %s' % (fingerprint, ex.message)
+        print("no key with fingerprint %s: %s" % (fingerprint, ex.message))
         pass
 
     ctx.signers = [key]
@@ -167,7 +169,7 @@ def sign (infile, outfile, fingerprint):
     try:
         ctx.sign(infile, outfile, gpgme.SIG_MODE_NORMAL)
     except Exception as ex:
-        print 'Error signing file %s' % ex.message
+        print("Error signing file %s" % ex.message)
         pass
 
 
@@ -179,7 +181,7 @@ def sign_file(fname, fingerprint):
             with open(outfilename, 'w') as outfile:
                 sign (infile, outfile, fingerprint)
     except Exception as ex:
-        print 'Error signing file %s' % ex.message
+        print("Error signing file %s" % ex.message)
         pass
 
 
@@ -208,6 +210,6 @@ def export_key (fingerprint, outfile):
     try:
         ctx.export(fingerprint, outfile)
     except Exception as ex:
-        print 'Error exporting key %s' % (fingerprint)
+        print("Error exporting key %s" % (fingerprint))
 
     return '/var/cache/elbe/gnupg/pubring.gpg'
diff --git a/elbepack/hdimg.py b/elbepack/hdimg.py
index 872b0ded..aca04208 100644
--- a/elbepack/hdimg.py
+++ b/elbepack/hdimg.py
@@ -16,6 +16,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import os
 from string import digits
 
@@ -177,7 +179,7 @@ class grubinstaller_base( object ):
         self.boot = None
 
     def set_boot_entry( self, entry ):
-        print "setting boot entry"
+        print("setting boot entry")
         self.boot = entry
 
     def set_root_entry( self, entry ):
@@ -431,7 +433,7 @@ def add_binary_blob( outf, hd, target ):
         # use file from target/ dir if binary path starts with /
         if (binary.et.text[0] == '/'):
             bf = os.path.join(target, 'target', binary.et.text[1:])
-            print bf
+            print(bf)
         # else use file from /var/cache/elbe/<uuid> project dir
         else:
             bf = os.path.join(target, binary.et.text)
diff --git a/elbepack/pkgutils.py b/elbepack/pkgutils.py
index e8288941..88c7c8b7 100644
--- a/elbepack/pkgutils.py
+++ b/elbepack/pkgutils.py
@@ -16,13 +16,20 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
 
+# different module names in python 2 and 3
+try:
+    import urllib.request
+    urlopen = urllib.request.urlopen
+except ImportError:
+    import urllib2
+    urlopen = urllib2.urlopen
 
 import os
+import hashlib
 
 from tempfile import mkdtemp
-import urllib2
-import hashlib
 
 from elbepack.shellhelper import CommandError, system
 
@@ -31,10 +38,10 @@ try:
     from apt_pkg import TagFile
     virtapt_imported = True
 except ImportError:
-    print "WARNING - python-apt not available: if there are multiple versions of"
-    print " elbe-bootstrap packages on the mirror(s) elbe selects the first package it"
-    print " has found. There is no guarantee that the latest package is used."
-    print " To ensure this, the python-apt package needs to be installed."
+    print("WARNING - python-apt not available: if there are multiple versions of")
+    print(" elbe-bootstrap packages on the mirror(s) elbe selects the first package it")
+    print(" has found. There is no guarantee that the latest package is used.")
+    print(" To ensure this, the python-apt package needs to be installed.")
     virtapt_imported = False
 
 
@@ -213,10 +220,10 @@ def copy_kinitrd( prj, target_dir, defs, arch="default" ):
             if m.hexdigest() != sha1:
                 raise NoKinitrdException ('elbe-bootstrap failed to verify !!!')
         else:
-            print "-----------------------------------------------------"
-            print "WARNING:"
-            print "Using untrusted elbe-bootstrap"
-            print "-----------------------------------------------------"
+            print("-----------------------------------------------------")
+            print("WARNING:")
+            print("Using untrusted elbe-bootstrap")
+            print("-----------------------------------------------------")
 
 
         try:
diff --git a/elbepack/templates.py b/elbepack/templates.py
index 9bbca711..1e552058 100644
--- a/elbepack/templates.py
+++ b/elbepack/templates.py
@@ -16,6 +16,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import os
 
 from elbepack.treeutils import etree
@@ -34,7 +36,7 @@ def template(fname, d, linebreak=False):
         else:
             return Template(filename=fname).render(**d)
     except:
-        print exceptions.text_error_template().render()
+        print(exceptions.text_error_template().render())
         raise
 
 def write_template( outname, fname, d, linebreak=False ):
diff --git a/elbepack/updated.py b/elbepack/updated.py
index 5e5dc9c2..d984595d 100644
--- a/elbepack/updated.py
+++ b/elbepack/updated.py
@@ -19,6 +19,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import apt
 import apt_pkg
 import errno
@@ -92,15 +94,15 @@ class UpdateStatus:
             try:
                 self.monitor.service.msg (msg)
             except:
-                print "logging to monitor failed, removing monitor connection"
+                print("logging to monitor failed, removing monitor connection")
                 self.monitor = None
-                print msg
+                print(msg)
         try:
             syslog (msg)
         except:
-            print msg
+            print(msg)
         if self.verbose:
-            print msg
+            print(msg)
 
 class UpdateApplication (Application):
     def __init__(self, *args, **kargs):
@@ -133,8 +135,8 @@ class UpdateService (ServiceBase):
 
         try:
             apply_update (fname, self.app.status)
-            print Exception, err
         except Exception as err:
+            print("%s" % str(err))
             self.app.status.set_finished ('error')
             return "apply snapshot %s failed" % version
 
diff --git a/elbepack/updatepkg.py b/elbepack/updatepkg.py
index 409c3959..cb3afeba 100644
--- a/elbepack/updatepkg.py
+++ b/elbepack/updatepkg.py
@@ -18,6 +18,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import os
 
 from shutil import rmtree, copyfile, copytree
@@ -78,7 +80,7 @@ def gen_update_pkg (project, xml_filename, upd_filename,
             xmlindex[name] = p
 
             if not name in instindex:
-                print "package removed: " + name
+                print("package removed: %s" % name)
                 continue
 
             ipkg = instindex[name]
@@ -87,22 +89,22 @@ def gen_update_pkg (project, xml_filename, upd_filename,
             pfname = ipkg.installed_deb
 
             if comp == 0:
-                print "package ok: " + name + "-" + ipkg.installed_version
+                print("package ok: %s-%s" % (name, ipkg.installed_version))
                 if debug:
                     fnamelist.append( pfname )
                 continue
 
             if comp > 0:
-                print "package upgrade: " + pfname
+                print("package upgrade: %s" % pfname)
                 fnamelist.append( pfname )
             else:
-                print "package downgrade: " + name + "-" + ipkg.installed_version
+                print("package downgrade: %s-%s" % (name, ipkg.installed_version))
 
         for p in instpkgs:
             if p.name in xmlindex:
                 continue
 
-            print "package new installed " + p.name
+            print("package %s newly installed" % p.name)
             pfname = p.installed_deb
             fnamelist.append( pfname )
 
diff --git a/elbepack/virtapt.py b/elbepack/virtapt.py
index 53607ad7..62d9c725 100644
--- a/elbepack/virtapt.py
+++ b/elbepack/virtapt.py
@@ -16,6 +16,8 @@
 # You should have received a copy of the GNU General Public License
 # along with ELBE.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
+
 import apt_pkg
 import os
 import sys
@@ -83,7 +85,6 @@ class VirtApt:
         pass
 
     def pulse (self, obj):
-        #print "updating in progress", obj
         return True
 
     def mkdir_p (self, newdir, mode=0o755):
@@ -121,8 +122,8 @@ class VirtApt:
     def setup_gpg (self):
         ring_path = self.projectpath + "/etc/apt/trusted.gpg"
         if not os.path.isdir ("/etc/apt/trusted.gpg.d"):
-            print ("/etc/apt/trusted.gpg.d doesn't exist")
-            print ("apt-get install debian-archive-keyring may fix this problem")
+            print("/etc/apt/trusted.gpg.d doesn't exist")
+            print("apt-get install debian-archive-keyring may fix this problem")
             sys.exit (20)
 
         system ('cp /etc/apt/trusted.gpg "%s"' % ring_path )
@@ -137,13 +138,13 @@ class VirtApt:
 
         trustkeys = os.listdir("/etc/apt/trusted.gpg.d")
         for key in trustkeys:
-            print "Import %s: " % key
+            print("Import %s: " % key)
             try:
                 system ('gpg %s --import "%s"' % (
                     gpg_options,
                     os.path.join ("/etc/apt/trusted.gpg.d", key)))
             except CommandError as e:
-                print "adding elbe-pubkey to keyring failed"
+                print("adding elbe-pubkey to keyring failed")
 
     def add_pubkey_url (self, url):
         ring_path = self.projectpath + "/etc/apt/trusted.gpg"
diff --git a/elbepack/xmldefaults.py b/elbepack/xmldefaults.py
index 56a1f95a..6857169d 100644
--- a/elbepack/xmldefaults.py
+++ b/elbepack/xmldefaults.py
@@ -1,4 +1,6 @@
 
+from __future__ import print_function
+
 import random
 import string
 import sys
@@ -186,9 +188,12 @@ class ElbeDefaults(object):
     def __init__(self, build_type):
 
         if build_type not in defaults:
-            print "Please specify a valid buildtype."
-            print "Valid buildtypes:"
-            print defaults.keys()
+            print("Please specify a valid buildtype.")
+            print("Valid buildtypes:")
+            print(defaults.keys())
+            print("Please specify a valid buildtype.")
+            print("Valid buildtypes:")
+            print(list(defaults.keys()))
             sys.exit(20)
 
         self.defaults = defaults[build_type]
diff --git a/test/modify_rfs.py b/test/modify_rfs.py
index a1934863..d94121d3 100644
--- a/test/modify_rfs.py
+++ b/test/modify_rfs.py
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from elbepack import rfs
 from elbepack import elbexml
 from elbepack import filesystem
@@ -10,7 +12,7 @@ class AsyncStatus:
     def __init__ (self):
         pass
     def status (self, msg):
-        print "current status: " + msg
+        print("current status: " + msg)
 
 xml = elbexml.ElbeXML('source.xml')
 log = asciidoclog.ASCIIDocLog( "update.log" )
@@ -22,11 +24,11 @@ from elbepack.rpcaptcache import get_rpcaptcache
 # Use "with br" to mount the necessary bind mounts
 with br:
     cc = get_rpcaptcache(br.rfs, "aptcache.log", "armel", notifier=status)
-    print "SECTIONS: ", cc.get_sections()
+    print("SECTIONS: ", cc.get_sections())
     time.sleep (2)
-    print "SHELLS: ", cc.get_pkglist('shells')
+    print("SHELLS: ", cc.get_pkglist('shells'))
     time.sleep (2)
-    print "QUICKPLOT: ", cc.get_dependencies('quickplot')
+    print("QUICKPLOT: ", cc.get_dependencies('quickplot'))
     time.sleep (2)
     cc.mark_install('quickplot','2')
     cc.commit()
diff --git a/test/updated.py b/test/updated.py
index 2a132182..692b1cc9 100755
--- a/test/updated.py
+++ b/test/updated.py
@@ -1,5 +1,7 @@
 #!/usr/bin/env python2
 
+from __future__ import print_function
+
 import soaplib
 import sys
 import threading
@@ -16,7 +18,7 @@ from wsgiref.simple_server import make_server
 class MonitorService (ServiceBase):
     @rpc (String)
     def msg (self, m):
-        print m
+        print(m)
 
 class MonitorThread (threading.Thread):
     def __init__ (self, port):
@@ -25,7 +27,7 @@ class MonitorThread (threading.Thread):
         self.server = None
 
     def run (self):
-        print "monitor ready :%s" % (self.port)
+        print("monitor ready :%s" % (self.port))
         application = Application([MonitorService], 'monitor',
                                   in_protocol=Soap11(validator='lxml'),
                                   out_protocol=Soap11())
@@ -89,7 +91,7 @@ wsdl = "http://" + target + ":" + port + "/?wsdl"
 try:
     control = Client (wsdl)
 except:
-    print wsdl, "not reachable"
+    print(wsdl, "not reachable")
     sys.exit (1)
 
 monitor = MonitorThread (monitorport)
@@ -101,7 +103,7 @@ try:
     monitor_wsdl = "http://" + host + ":" + monitorport + "/?wsdl"
     control.service.register_monitor (monitor_wsdl)
 except:
-    print "monitor couldn't be registered (port already in use?)"
+    print("monitor couldn't be registered (port already in use?)")
     shutdown (monitor)
 
 while 1:
@@ -110,20 +112,20 @@ while 1:
     try:
         snapshots = s.split (',')
 
-        print "select snapshot:"
+        print("select snapshot:")
         i = 0
         for s in snapshots:
             if s:
-                print "  [%d] %s" % (i, s)
+                print("  [%d] %s" % (i, s))
             i = i + 1
     except:
-        print "no snapshots available"
+        print("no snapshots available")
 
     sys.stdout.write ("% ")
     sys.stdout.flush ()
 
     try:
         n = int (input ())
-        print control.service.apply_snapshot (snapshots [n])
+        print(control.service.apply_snapshot (snapshots [n]))
     except:
         shutdown (monitor)
-- 
2.15.1




More information about the elbe-devel mailing list