[Libreoffice-commits] dev-tools.git: ciabot/irker-cia-proxy.py ciabot/libreoffice-bugzilla2.py ciabot/run-libreoffice-ciabot.pl

2020-07-01 Thread Guilhem Moulin (via logerrit)
 ciabot/irker-cia-proxy.py|   12 ++--
 ciabot/libreoffice-bugzilla2.py  |   19 +--
 ciabot/run-libreoffice-ciabot.pl |6 +++---
 3 files changed, 14 insertions(+), 23 deletions(-)

New commits:
commit f2204d126c2334ccbe061cd27d519316426448c1
Author: Guilhem Moulin 
AuthorDate: Thu Jul 2 01:13:10 2020 +0200
Commit: Guilhem Moulin 
CommitDate: Thu Jul 2 01:46:13 2020 +0200

ciabot: Port libreoffice-bugzilla2.py and irker-cia-proxy.py to python3.

diff --git a/ciabot/irker-cia-proxy.py b/ciabot/irker-cia-proxy.py
index c26996c..ed8835f 100644
--- a/ciabot/irker-cia-proxy.py
+++ b/ciabot/irker-cia-proxy.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 """
 irker-cia-proxy - proxy CIA requests to an irker relay agent
 
@@ -15,8 +15,8 @@ from the use of this software.
 
 import json, socket, posixpath, re, sys
 from xml.dom import minidom
-from SimpleXMLRPCServer import SimpleXMLRPCServer
-from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
+from xmlrpc.server import SimpleXMLRPCServer
+from xmlrpc.server import SimpleXMLRPCRequestHandler
 
 bind_ip = ''
 bind_port = 8000
@@ -117,9 +117,9 @@ class CIAMessage:
 def get_template(self):
 # If there is a template for this branch, use it, otherwise fall back 
to the project or the global one.
 branch_template = "template-%s" % self.data()['branch']
-if projmap[self.project()].has_key(branch_template):
+if branch_template in projmap[self.project()]:
 return projmap[self.project()][branch_template]
-if projmap[self.project()].has_key('template'):
+if 'template' in projmap[self.project()]:
 return projmap[self.project()]['template']
 return template
 def get_target(self):
@@ -131,7 +131,7 @@ class CIAMessage:
 envelope = json.dumps(structure)
 try:
 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
-sock.sendto(envelope + "\n", (target_server, target_port))
+sock.sendto(envelope.encode() + b"\n", (target_server, 
target_port))
 finally:
 sock.close()
 
diff --git a/ciabot/libreoffice-bugzilla2.py b/ciabot/libreoffice-bugzilla2.py
index 8d11e31..8ba84e2 100644
--- a/ciabot/libreoffice-bugzilla2.py
+++ b/ciabot/libreoffice-bugzilla2.py
@@ -18,23 +18,14 @@
 # - adds a comment to the report
 # - updates the whiteboard field with target information
 
-from __future__ import print_function
-
 import datetime
 import os
 import re
 import sys, getopt
 import git
-import ConfigParser
-
-if hasattr(sys.version_info, "major") and sys.version_info.major >= 3:
-# pylint: disable=F0401,E0611
-from urllib.parse import urlparse
-else:
-from urlparse import urlparse
+import configparser
 
 import bugzilla
-from bugzilla import Bugzilla
 
 master_target = "7.1.0"
 bug_regex = "\\b(?:bug|fdo|tdf|lo)[#:]?(\\d+)\\b"
@@ -46,7 +37,7 @@ class FreedesktopBZ:
 bz = None
 
 def connect(self):
-config = ConfigParser.ConfigParser()
+config = configparser.ConfigParser()
 config.read(os.path.dirname(os.path.abspath(__file__)) + '/config.cfg')
 url = config.get('bugzilla', 'url')
 user = config.get('bugzilla', 'user')
@@ -58,7 +49,7 @@ class FreedesktopBZ:
 def update_whiteboard(self, commit, bugnr, new_version, branch, repo_name):
 print(bugnr)
 if dry_run:
-print("DRY RUN, we would set the whiteboard to: target:\n%s" % 
new_version)
+print(("DRY RUN, we would set the whiteboard to: target:\n%s" % 
new_version))
 else:
 bug = self.bz.getbug(bugnr)
 print(bug)
@@ -99,7 +90,7 @@ https://wiki.documentfoundation.org/Testing_Daily_Builds
 Affected users are encouraged to test the fix and report feedback.""" 
%(new_version)
 
 if dry_run:
-print("DRY RUN, we would add the following comment:\n%s" % 
comment_msg)
+print(("DRY RUN, we would add the following comment:\n%s" % 
comment_msg))
 else:
 bug.addcomment(comment_msg)
 
@@ -177,7 +168,7 @@ def find_bugid(repo, commit_id):
 return m
 
 def read_repo(repo_name):
-config = ConfigParser.ConfigParser()
+config = configparser.ConfigParser()
 config.read(os.path.dirname(os.path.abspath(__file__)) + '/config.cfg')
 path = config.get(repo_name, 'location')
 repo = git.repo.base.Repo(path)
diff --git a/ciabot/run-libreoffice-ciabot.pl b/ciabot/run-libreoffice-ciabot.pl
index c48e821..eb90f0b 100755
--- a/ciabot/run-libreoffice-ciabot.pl
+++ b/ciabot/run-libreoffice-ciabot.pl
@@ -89,7 +89,7 @@ sub report($$$) {
 my %old = %{$old_ref};
 my %new = %{$new_ref};
 my $ciabot = "timeout 60 $cwd/libreoffice-ciabot.pl";
-my $ciaproxy = "| ( cd $cwd && python irker-cia-proxy.py -s )";
+my $ciaproxy = "| ( cd $cwd && python3 irker-cia-proxy.py -s )";
 
 foreach my $key ( keys %new ) {
 my $branch_name = 

[Libreoffice-commits] dev-tools.git: ciabot/irker-cia-proxy.py ciabot/libreoffice-bugzilla2.py ciabot/run-libreoffice-ciabot.pl

2020-07-01 Thread Guilhem Moulin (via logerrit)
 ciabot/irker-cia-proxy.py|   10 +-
 ciabot/libreoffice-bugzilla2.py  |   19 +--
 ciabot/run-libreoffice-ciabot.pl |6 +++---
 3 files changed, 13 insertions(+), 22 deletions(-)

New commits:
commit 00bd505620f9c5f491c3dd0d15fe38ab383b98a3
Author: Guilhem Moulin 
AuthorDate: Thu Jul 2 01:13:10 2020 +0200
Commit: Guilhem Moulin 
CommitDate: Thu Jul 2 01:27:25 2020 +0200

ciabot: Port libreoffice-bugzilla2.py and irker-cia-proxy.py to python3.

diff --git a/ciabot/irker-cia-proxy.py b/ciabot/irker-cia-proxy.py
index c26996c..6ea6c83 100644
--- a/ciabot/irker-cia-proxy.py
+++ b/ciabot/irker-cia-proxy.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 """
 irker-cia-proxy - proxy CIA requests to an irker relay agent
 
@@ -15,8 +15,8 @@ from the use of this software.
 
 import json, socket, posixpath, re, sys
 from xml.dom import minidom
-from SimpleXMLRPCServer import SimpleXMLRPCServer
-from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
+from xmlrpc.server import SimpleXMLRPCServer
+from xmlrpc.server import SimpleXMLRPCRequestHandler
 
 bind_ip = ''
 bind_port = 8000
@@ -117,9 +117,9 @@ class CIAMessage:
 def get_template(self):
 # If there is a template for this branch, use it, otherwise fall back 
to the project or the global one.
 branch_template = "template-%s" % self.data()['branch']
-if projmap[self.project()].has_key(branch_template):
+if branch_template in projmap[self.project()]:
 return projmap[self.project()][branch_template]
-if projmap[self.project()].has_key('template'):
+if 'template' in projmap[self.project()]:
 return projmap[self.project()]['template']
 return template
 def get_target(self):
diff --git a/ciabot/libreoffice-bugzilla2.py b/ciabot/libreoffice-bugzilla2.py
index 8d11e31..8ba84e2 100644
--- a/ciabot/libreoffice-bugzilla2.py
+++ b/ciabot/libreoffice-bugzilla2.py
@@ -18,23 +18,14 @@
 # - adds a comment to the report
 # - updates the whiteboard field with target information
 
-from __future__ import print_function
-
 import datetime
 import os
 import re
 import sys, getopt
 import git
-import ConfigParser
-
-if hasattr(sys.version_info, "major") and sys.version_info.major >= 3:
-# pylint: disable=F0401,E0611
-from urllib.parse import urlparse
-else:
-from urlparse import urlparse
+import configparser
 
 import bugzilla
-from bugzilla import Bugzilla
 
 master_target = "7.1.0"
 bug_regex = "\\b(?:bug|fdo|tdf|lo)[#:]?(\\d+)\\b"
@@ -46,7 +37,7 @@ class FreedesktopBZ:
 bz = None
 
 def connect(self):
-config = ConfigParser.ConfigParser()
+config = configparser.ConfigParser()
 config.read(os.path.dirname(os.path.abspath(__file__)) + '/config.cfg')
 url = config.get('bugzilla', 'url')
 user = config.get('bugzilla', 'user')
@@ -58,7 +49,7 @@ class FreedesktopBZ:
 def update_whiteboard(self, commit, bugnr, new_version, branch, repo_name):
 print(bugnr)
 if dry_run:
-print("DRY RUN, we would set the whiteboard to: target:\n%s" % 
new_version)
+print(("DRY RUN, we would set the whiteboard to: target:\n%s" % 
new_version))
 else:
 bug = self.bz.getbug(bugnr)
 print(bug)
@@ -99,7 +90,7 @@ https://wiki.documentfoundation.org/Testing_Daily_Builds
 Affected users are encouraged to test the fix and report feedback.""" 
%(new_version)
 
 if dry_run:
-print("DRY RUN, we would add the following comment:\n%s" % 
comment_msg)
+print(("DRY RUN, we would add the following comment:\n%s" % 
comment_msg))
 else:
 bug.addcomment(comment_msg)
 
@@ -177,7 +168,7 @@ def find_bugid(repo, commit_id):
 return m
 
 def read_repo(repo_name):
-config = ConfigParser.ConfigParser()
+config = configparser.ConfigParser()
 config.read(os.path.dirname(os.path.abspath(__file__)) + '/config.cfg')
 path = config.get(repo_name, 'location')
 repo = git.repo.base.Repo(path)
diff --git a/ciabot/run-libreoffice-ciabot.pl b/ciabot/run-libreoffice-ciabot.pl
index c48e821..eb90f0b 100755
--- a/ciabot/run-libreoffice-ciabot.pl
+++ b/ciabot/run-libreoffice-ciabot.pl
@@ -89,7 +89,7 @@ sub report($$$) {
 my %old = %{$old_ref};
 my %new = %{$new_ref};
 my $ciabot = "timeout 60 $cwd/libreoffice-ciabot.pl";
-my $ciaproxy = "| ( cd $cwd && python irker-cia-proxy.py -s )";
+my $ciaproxy = "| ( cd $cwd && python3 irker-cia-proxy.py -s )";
 
 foreach my $key ( keys %new ) {
 my $branch_name = $key;
@@ -127,13 +127,13 @@ sub report($$$) {
 my $branch = $branch_name;
 $branch = 'master' if ($branch eq '');
 print "reporting to bugzilla: $_ and 
branch $branch\n";
-qx(python