From: biao716.wang Date: Mon, 10 Apr 2023 07:49:45 +0000 (+0900) Subject: fix pylint error on python3.10 on ubuntu22.04 X-Git-Tag: accepted/tools/devbase/tools/20250527.103741~18^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=626d695158b83a7077dbc1835825f868c695b137;p=tools%2Fgbs.git fix pylint error on python3.10 on ubuntu22.04 Change-Id: Id817c4e2cdf258987d454388525091f29036cd52 Signed-off-by: biao716.wang --- diff --git a/gitbuildsys/conf.py b/gitbuildsys/conf.py index 333c595..0f46df3 100644 --- a/gitbuildsys/conf.py +++ b/gitbuildsys/conf.py @@ -378,7 +378,7 @@ url = http://download.tizen.org/releases/daily/trunk/ivi/latest/ def _get(self, opt, section='general'): 'get value from multi-levels of config file' sect_found = True - global gerr + gerr = None for cfgparser in self._cfgparsers: try: return cfgparser.get(section, opt) @@ -393,12 +393,14 @@ url = http://download.tizen.org/releases/daily/trunk/ivi/latest/ def options(self, section='general'): 'merge and return options of certain section from multi-levels' sect_found = False + gerr = None options = set() for cfgparser in self._cfgparsers: try: options.update(cfgparser.options(section)) sect_found = True except Error as err: + gerr = err pass if not sect_found: diff --git a/gitbuildsys/oscapi.py b/gitbuildsys/oscapi.py index 23afe39..3d5cbee 100644 --- a/gitbuildsys/oscapi.py +++ b/gitbuildsys/oscapi.py @@ -54,6 +54,8 @@ class OSC(object): if oscrc: try: conf.get_config(override_conffile=oscrc) + except urllib.error.URLError: + raise ObsError("invalid service apiurl: %s" % apiurl) except OSError as err: if err.errno == 1: # permission problem, should be the chmod(0600) issue @@ -61,8 +63,6 @@ class OSC(object): 'for specified oscrc: %s' % oscrc) raise # else - except urllib.error.URLError: - raise ObsError("invalid service apiurl: %s" % apiurl) else: conf.get_config() diff --git a/tests/test_changelog.py b/tests/test_changelog.py index a93c09f..68f7ab6 100644 --- a/tests/test_changelog.py +++ b/tests/test_changelog.py @@ -32,7 +32,7 @@ from gbp.git.repository import GitRepository from gitbuildsys.errors import GbsError -GBS = SourceFileLoader("gbs", "./tools/gbs").load_module().main +GBS = SourceFileLoader("gbs", "./tools/gbs").load_module("gbs").main ENV = {} TEST_SPEC_CONTENT = """ diff --git a/tests/test_export.py b/tests/test_export.py index 007f5e2..a977439 100644 --- a/tests/test_export.py +++ b/tests/test_export.py @@ -8,7 +8,7 @@ import shutil import tempfile from nose.tools import eq_ -GBS = SourceFileLoader("gbs", "./tools/gbs").load_module().main +GBS = SourceFileLoader("gbs", "./tools/gbs").load_module("gbs").main class TestExport(unittest.TestCase): """Test export output of gbs commands""" diff --git a/tests/test_help.py b/tests/test_help.py index 643fee5..76483ff 100644 --- a/tests/test_help.py +++ b/tests/test_help.py @@ -23,7 +23,7 @@ from importlib.machinery import SourceFileLoader from nose.tools import eq_ -GBS = SourceFileLoader("gbs", "./tools/gbs").load_module().main +GBS = SourceFileLoader("gbs", "./tools/gbs").load_module("gbs").main class TestHelp(unittest.TestCase): """Test help output of gbs commands""" diff --git a/tests/test_import.py b/tests/test_import.py index 494a717..799e300 100644 --- a/tests/test_import.py +++ b/tests/test_import.py @@ -32,7 +32,7 @@ from gitbuildsys.errors import GbsError from gbp.git.repository import GitRepository -GBS = SourceFileLoader("gbs", "./tools/gbs").load_module().main +GBS = SourceFileLoader("gbs", "./tools/gbs").load_module("gbs").main def with_data(fname): """