diff options
author | Andy Fiddaman <omnios@citrus-it.co.uk> | 2018-11-15 10:17:46 +0000 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2019-01-10 11:09:52 -0500 |
commit | ca13eaa51ee900abba73dfb6624e492f7e48863e (patch) | |
tree | 0e42badd7d21d429fb2cb02f823c20d30f90b113 /usr/src/tools/onbld/Checks/DbLookups.py | |
parent | 9b40c3052b9b0d91120c568df0c5211c131c8da1 (diff) | |
download | illumos-joyent-ca13eaa51ee900abba73dfb6624e492f7e48863e.tar.gz |
9979 Support python3 for in-gate tools
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Peter Tribble <peter.tribble@gmail.com>
Reviewed by: Alexander Pyhalov <apyhalov@gmail.com>
Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/tools/onbld/Checks/DbLookups.py')
-rw-r--r-- | usr/src/tools/onbld/Checks/DbLookups.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/usr/src/tools/onbld/Checks/DbLookups.py b/usr/src/tools/onbld/Checks/DbLookups.py index 11fd4185be..324cc58209 100644 --- a/usr/src/tools/onbld/Checks/DbLookups.py +++ b/usr/src/tools/onbld/Checks/DbLookups.py @@ -25,6 +25,7 @@ # # Copyright 2010, Richard Lowe +# Copyright 2018 OmniOS Community Edition (OmniOSce) Association. # # Various database lookup classes/methods, i.e.: @@ -33,10 +34,13 @@ # * redmine (illumos.org) # -import htmllib import re -import urllib -import urllib2 +try: + from urllib.request import urlopen, Request + from urllib.error import HTTPError +except ImportError: + # Python 2 + from urllib2 import Request, urlopen, HTTPError try: # Python >= 2.5 from xml.etree import ElementTree @@ -72,17 +76,17 @@ class BugDB(object): """ for database in priority: if database not in self.VALID_DBS: - raise BugDBException, database + raise BugDBException(database) self.__priority = priority def __illbug(self, cr): url = "http://illumos.org/issues/%s.xml" % cr - req = urllib2.Request(url) + req = Request(url) try: - data = urllib2.urlopen(req) - except urllib2.HTTPError, e: + data = urlopen(req) + except HTTPError as e: if e.code == 404: raise NonExistentBug(cr) else: |