[Debian-ha-commits] [cluster-glue] 01/05: Switch to python3 (Closes: #883149)

Valentin Vidic vvidic-guest at moszumanska.debian.org
Fri Dec 1 12:50:32 UTC 2017


This is an automated email from the git hooks/post-receive script.

vvidic-guest pushed a commit to branch master
in repository cluster-glue.

commit 949e17a3eee8df4eeff3854d705cb4c190876db5
Author: Valentin Vidic <Valentin.Vidic at CARNet.hr>
Date:   Fri Dec 1 12:13:37 2017 +0100

    Switch to python3 (Closes: #883149)
---
 debian/control               |   5 +-
 debian/patches/python3.patch | 212 +++++++++++++++++++++++++++++++++++++++++++
 debian/patches/series        |   1 +
 debian/rules                 |   7 +-
 4 files changed, 218 insertions(+), 7 deletions(-)

diff --git a/debian/control b/debian/control
index f29169f..748ebc8 100644
--- a/debian/control
+++ b/debian/control
@@ -38,8 +38,7 @@ Build-Depends: debhelper (>= 10),
  openssh-client,
  perl,
  psmisc,
- python-dev (>= 2.6.6-3~),
- python (>= 2.6.6-3~),
+ python3,
  swig,
  systemd [linux-any],
  uuid-dev,
@@ -55,7 +54,7 @@ Architecture: any
 Depends: ${shlibs:Depends},
  ${misc:Depends},
  ${perl:Depends},
- ${python:Depends},
+ ${python3:Depends},
  adduser,
  bzip2,
  libtimedate-perl,
diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
new file mode 100644
index 0000000..35b0355
--- /dev/null
+++ b/debian/patches/python3.patch
@@ -0,0 +1,212 @@
+--- a/lib/plugins/stonith/external/dracmc-telnet
++++ b/lib/plugins/stonith/external/dracmc-telnet
+@@ -75,7 +75,7 @@
+ 
+     def _get_timestamp(self):
+         ct = time.time()
+-        msecs = (ct - long(ct)) * 1000
++        msecs = (ct - int(ct)) * 1000
+         return "%s,%03d" % (time.strftime("%Y-%m-%d %H:%M:%S",
+                             time.localtime(ct)), msecs)
+ 
+@@ -171,7 +171,7 @@
+ 
+     def _get_timestamp(self):
+         ct = time.time()
+-        msecs = (ct - long(ct)) * 1000
++        msecs = (ct - int(ct)) * 1000
+         return "%s,%03d" % (time.strftime("%Y-%m-%d %H:%M:%S",
+                             time.localtime(ct)), msecs)
+ 
+@@ -201,7 +201,7 @@
+                            self._parameters['cyclades_port'])
+                     c.login(self._parameters['username'],
+                             self._parameters['password'])
+-                except Exception, args:
++                except Exception as args:
+                     if "Connection reset by peer" in str(args):
+                         self._echo_debug("Someone is already logged in... retry=%s" % tries)
+                         c.close()
+@@ -363,7 +363,7 @@
+             func = getattr(self, cmd, self.not_implemented)
+             rc = func()
+             return(rc)
+-        except Exception, args:
++        except Exception as args:
+             self.echo_log("err", 'Exception raised:', str(args))
+             if self._connection:
+                 self.echo_log("err", self._connection.get_history())
+--- a/lib/plugins/stonith/external/ibmrsa-telnet
++++ b/lib/plugins/stonith/external/ibmrsa-telnet
+@@ -72,7 +72,7 @@
+ 
+     def _get_timestamp(self):
+         ct = time.time()
+-        msecs = (ct - long(ct)) * 1000
++        msecs = (ct - int(ct)) * 1000
+         return "%s,%03d" % (time.strftime("%Y-%m-%d %H:%M:%S",
+                             time.localtime(ct)), msecs)
+ 
+@@ -150,7 +150,7 @@
+ 
+     def _get_timestamp(self):
+         ct = time.time()
+-        msecs = (ct - long(ct)) * 1000
++        msecs = (ct - int(ct)) * 1000
+         return "%s,%03d" % (time.strftime("%Y-%m-%d %H:%M:%S",
+                             time.localtime(ct)), msecs)
+ 
+@@ -306,7 +306,7 @@
+             func = getattr(self, cmd, self.not_implemented)
+             rc = func()
+             return(rc)
+-        except Exception, args:
++        except Exception as args:
+             self.echo_log("err", 'Exception raised:', str(args))
+             if self._connection:
+                 self.echo_log("err", self._connection.get_history())
+--- a/lib/plugins/stonith/ribcl.py.in
++++ b/lib/plugins/stonith/ribcl.py.in
+@@ -19,7 +19,7 @@
+ 
+ import sys
+ import socket
+-from httplib import *
++from http.client import *
+ from time import sleep
+ 
+ 
+@@ -30,7 +30,7 @@
+         host = argv[1].split('.')[0]+'-rm'
+         cmd = argv[2]
+ except IndexError:
+-        print "Not enough arguments"
++        print("Not enough arguments")
+         sys.exit(1)
+ 
+ 
+@@ -67,7 +67,7 @@
+         else:   
+                 acmds.append(login + todo[cmd] + logout)
+ except KeyError:
+-        print "Invalid command: "+ cmd
++        print("Invalid command: "+ cmd)
+         sys.exit(1)
+ 
+ 
+@@ -89,13 +89,13 @@
+                 sleep(1)
+ 
+ 
+-except socket.gaierror, msg:
+-        print msg
++except socket.gaierror as msg:
++        print(msg)
+         sys.exit(1)
+-except socket.sslerror, msg:
+-        print msg
++except socket.sslerror as msg:
++        print(msg)
+         sys.exit(1)
+-except socket.error, msg:
+-        print msg
++except socket.error as msg:
++        print(msg)
+         sys.exit(1)
+ 
+--- a/lib/plugins/stonith/external/riloe
++++ b/lib/plugins/stonith/external/riloe
+@@ -36,7 +36,7 @@
+ import socket
+ import subprocess
+ import xml.dom.minidom
+-import httplib
++import http.client
+ import time
+ import re
+ 
+@@ -164,12 +164,12 @@
+ }
+ 
+ if cmd in info:
+-    print info[cmd]
++    print(info[cmd])
+     sys.exit(0)
+ 
+ if cmd == 'getconfignames':
+     for arg in [ "hostlist", "ilo_hostname", "ilo_user", "ilo_password", "ilo_can_reset", "ilo_protocol", "ilo_powerdown_method", "ilo_proxyhost", "ilo_proxyport"]:
+-        print arg
++        print(arg)
+     sys.exit(0)
+ 
+ if not rihost:
+@@ -258,7 +258,7 @@
+     '''
+     msg = ""
+     str_status = ""
+-    for attr in node.attributes.keys():
++    for attr in list(node.attributes.keys()):
+         if attr == A_STATUS:
+             str_status = node.getAttribute(attr)
+         elif attr == A_MSG:
+@@ -286,7 +286,7 @@
+     variable correspondingly.
+     '''
+     global power
+-    for attr in node.attributes.keys():
++    for attr in list(node.attributes.keys()):
+         if attr == A_POWER_STATE:
+             power_state = node.getAttribute(attr).upper()
+         else:
+@@ -340,18 +340,18 @@
+                 fatal("Error status=: %s" %(response))
+             import ssl
+             sock = ssl.wrap_socket(proxy) 
+-            h=httplib.HTTPConnection('localhost')
++            h=http.client.HTTPConnection('localhost')
+             h.sock=sock
+             return h
+         else:
+-            return httplib.HTTPSConnection(host)
+-    except socket.gaierror, msg:
++            return http.client.HTTPSConnection(host)
++    except socket.gaierror as msg:
+         fatal("%s: %s" %(msg,host))
+-    except socket.sslerror, msg:
++    except socket.sslerror as msg:
+         fatal("%s for %s" %(msg,host))
+-    except socket.error, msg:
++    except socket.error as msg:
+         fatal("%s while talking to %s" %(msg,host))
+-    except ImportError, msg:
++    except ImportError as msg:
+         fatal("ssl support missing (%s)" %msg)
+ 
+ def send_request(req,proc_f):
+@@ -365,7 +365,7 @@
+     c = open_ilo(rihost)
+     try:
+         c.send(req+'\r\n')
+-    except socket.error, msg:
++    except socket.error as msg:
+         fatal("%s, while talking to %s" %(msg,rihost))
+     t_end = time.time()
+     my_debug("request sent in %0.2f s" % ((t_end-t_begin)))
+@@ -378,7 +378,7 @@
+             if not reply:
+                 break
+             result.append(reply)
+-        except socket.error, msg:
++        except socket.error as msg:
+             if msg[0] == 6: # connection closed
+                 break
+             my_err("%s, while talking to %s" %(msg,rihost))
+@@ -394,7 +394,7 @@
+             reply = re.sub("<(RIBCL.*)/>", r"<\1>", reply)
+         try:
+             doc = xml.dom.minidom.parseString(reply)
+-        except xml.parsers.expat.ExpatError,msg:
++        except xml.parsers.expat.ExpatError as msg:
+             fatal("malformed response: %s\n%s"%(msg,reply))
+         rc = proc_f(doc)
+         doc.unlink()
diff --git a/debian/patches/series b/debian/patches/series
index 10454af..736b12d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,4 @@ kfbsd.diff
 hurd.diff
 x32-cl_times
 ipc_param_type
+python3.patch
diff --git a/debian/rules b/debian/rules
index 5c07220..6a59a97 100755
--- a/debian/rules
+++ b/debian/rules
@@ -11,7 +11,7 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
 # main packaging script based on dh7 syntax
 %:
-	dh $@ --with python2
+	dh $@ --with python3
 
 override_dh_autoreconf:
 	dh_autoreconf ./autogen.sh
@@ -49,9 +49,8 @@ override_dh_installinit:
 override_dh_installchangelogs:
 	dh_installchangelogs ChangeLog
 
-override_dh_python2:
-	dh_python2
-	dh_python2 /usr/lib/stonith/plugins/stonith2
+override_dh_python3:
+	dh_python3 --no-ext-rename --shebang=/usr/bin/python3 /usr/lib/stonith/plugins
 
 override_dh_strip:
 	dh_strip --dbgsym-migration='cluster-glue-dbg (<< 1.0.12-6~)'

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-ha/cluster-glue.git



More information about the Debian-HA-Commits mailing list