From: xuhy Date: Thu, 6 Jun 2024 09:11:58 +0000 (+0800) Subject: Fix build errors on Ubuntu 24.04 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7b3cc42ccd5732e0a200de29d10778ad33f40609;p=tools%2Fmic.git Fix build errors on Ubuntu 24.04 python3 setup.py install --prefix=/usr does not work. packages are always installed into /usr/local in default. Change-Id: I3e30b704b5a30e49a029b7ed4c1bad8c327f8dd9 Signed-off-by: xuhy --- diff --git a/debian/mic.install b/debian/mic.install index adadd7f..4206618 100644 --- a/debian/mic.install +++ b/debian/mic.install @@ -1,4 +1,4 @@ -debian/tmp/usr/bin/mic /usr/bin -debian/tmp/usr/lib/* /usr/lib +debian/tmp/usr/local/bin/mic /usr/bin +debian/tmp/usr/local/lib/* /usr/lib debian/tmp/usr/share/* /usr/share debian/tmp/etc/* /etc diff --git a/debian/rules b/debian/rules index dd312e2..33f3b5f 100755 --- a/debian/rules +++ b/debian/rules @@ -1,8 +1,10 @@ #!/usr/bin/make -f %: dh $@ --with python3 --buildsystem=pybuild + build: make man + override_dh_auto_install: dh_auto_install # Installing package @@ -14,9 +16,10 @@ override_dh_auto_install: install -m644 doc/mic.1 $(CURDIR)/debian/tmp/usr/share/man/man1 install -m755 etc/bash_completion.d/mic.sh $(CURDIR)/debian/tmp/etc/bash_completion.d/ install -m755 etc/zsh_completion.d/_mic $(CURDIR)/debian/tmp/etc/zsh_completion.d/_mic - python3 setup.py install --root=$(CURDIR)/debian/tmp --prefix=/usr + python3 setup.py install --root=$(CURDIR)/debian/tmp --prefix=/usr/local override_dh_installchangelogs: dh_installchangelogs ChangeLog + override_dh_auto_test: diff --git a/mic/3rdparty/requests/api.py b/mic/3rdparty/requests/api.py index d40fa38..9c7dd2a 100755 --- a/mic/3rdparty/requests/api.py +++ b/mic/3rdparty/requests/api.py @@ -56,7 +56,7 @@ def request(method, url, **kwargs): def get(url, params=None, **kwargs): - """Sends a GET request. + r"""Sends a GET request. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`. @@ -70,7 +70,7 @@ def get(url, params=None, **kwargs): def options(url, **kwargs): - """Sends a OPTIONS request. + r"""Sends a OPTIONS request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. @@ -83,7 +83,7 @@ def options(url, **kwargs): def head(url, **kwargs): - """Sends a HEAD request. + r"""Sends a HEAD request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. @@ -96,7 +96,7 @@ def head(url, **kwargs): def post(url, data=None, json=None, **kwargs): - """Sends a POST request. + r"""Sends a POST request. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`. @@ -110,7 +110,7 @@ def post(url, data=None, json=None, **kwargs): def put(url, data=None, **kwargs): - """Sends a PUT request. + r"""Sends a PUT request. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`. @@ -123,7 +123,7 @@ def put(url, data=None, **kwargs): def patch(url, data=None, **kwargs): - """Sends a PATCH request. + r"""Sends a PATCH request. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`. @@ -136,7 +136,7 @@ def patch(url, data=None, **kwargs): def delete(url, **kwargs): - """Sends a DELETE request. + r"""Sends a DELETE request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. diff --git a/mic/3rdparty/requests/models.py b/mic/3rdparty/requests/models.py index 42369c5..85f206c 100755 --- a/mic/3rdparty/requests/models.py +++ b/mic/3rdparty/requests/models.py @@ -792,7 +792,7 @@ class Response(object): return content def json(self, **kwargs): - """Returns the json-encoded content of a response, if any. + r"""Returns the json-encoded content of a response, if any. :param \*\*kwargs: Optional arguments that ``json.loads`` takes. """ diff --git a/mic/3rdparty/requests/packages/urllib3/connectionpool.py b/mic/3rdparty/requests/packages/urllib3/connectionpool.py index c5f8b8e..7e1fb57 100755 --- a/mic/3rdparty/requests/packages/urllib3/connectionpool.py +++ b/mic/3rdparty/requests/packages/urllib3/connectionpool.py @@ -92,7 +92,7 @@ _blocking_errnos = set([errno.EAGAIN, errno.EWOULDBLOCK]) class HTTPConnectionPool(ConnectionPool, RequestMethods): - """ + r""" Thread-safe connection pool for one host. :param host: @@ -421,7 +421,7 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods): def urlopen(self, method, url, body=None, headers=None, retries=None, redirect=True, assert_same_host=True, timeout=_Default, pool_timeout=None, release_conn=None, **response_kw): - """ + r""" Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. @@ -769,7 +769,7 @@ class HTTPSConnectionPool(HTTPConnectionPool): def connection_from_url(url, **kw): - """ + r""" Given a url, return an :class:`.ConnectionPool` instance of its host. This is a shortcut for not having to parse out the scheme, host, and port diff --git a/mic/3rdparty/requests/packages/urllib3/poolmanager.py b/mic/3rdparty/requests/packages/urllib3/poolmanager.py index a50ac23..e103d76 100755 --- a/mic/3rdparty/requests/packages/urllib3/poolmanager.py +++ b/mic/3rdparty/requests/packages/urllib3/poolmanager.py @@ -29,7 +29,7 @@ SSL_KEYWORDS = ('key_file', 'cert_file', 'cert_reqs', 'ca_certs', class PoolManager(RequestMethods): - """ + r""" Allows for arbitrary requests while transparently keeping track of necessary connection pools for you. diff --git a/mic/3rdparty/requests/sessions.py b/mic/3rdparty/requests/sessions.py index 4195a7d..0d0e71c 100755 --- a/mic/3rdparty/requests/sessions.py +++ b/mic/3rdparty/requests/sessions.py @@ -467,7 +467,7 @@ class Session(SessionRedirectMixin): return resp def get(self, url, **kwargs): - """Sends a GET request. Returns :class:`Response` object. + r"""Sends a GET request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. @@ -477,7 +477,7 @@ class Session(SessionRedirectMixin): return self.request('GET', url, **kwargs) def options(self, url, **kwargs): - """Sends a OPTIONS request. Returns :class:`Response` object. + r"""Sends a OPTIONS request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. @@ -487,7 +487,7 @@ class Session(SessionRedirectMixin): return self.request('OPTIONS', url, **kwargs) def head(self, url, **kwargs): - """Sends a HEAD request. Returns :class:`Response` object. + r"""Sends a HEAD request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. @@ -497,7 +497,7 @@ class Session(SessionRedirectMixin): return self.request('HEAD', url, **kwargs) def post(self, url, data=None, json=None, **kwargs): - """Sends a POST request. Returns :class:`Response` object. + r"""Sends a POST request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`. @@ -508,7 +508,7 @@ class Session(SessionRedirectMixin): return self.request('POST', url, data=data, json=json, **kwargs) def put(self, url, data=None, **kwargs): - """Sends a PUT request. Returns :class:`Response` object. + r"""Sends a PUT request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`. @@ -518,7 +518,7 @@ class Session(SessionRedirectMixin): return self.request('PUT', url, data=data, **kwargs) def patch(self, url, data=None, **kwargs): - """Sends a PATCH request. Returns :class:`Response` object. + r"""Sends a PATCH request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`. @@ -528,7 +528,7 @@ class Session(SessionRedirectMixin): return self.request('PATCH', url, data=data, **kwargs) def delete(self, url, **kwargs): - """Sends a DELETE request. Returns :class:`Response` object. + r"""Sends a DELETE request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. diff --git a/mic/cmd_create.py b/mic/cmd_create.py index bb60c9d..ed8a7c9 100644 --- a/mic/cmd_create.py +++ b/mic/cmd_create.py @@ -231,9 +231,9 @@ def do_auto(parser, ksfile, argv): inline_argv = m.group(1).strip() if ptype == 'mic': - m2 = re.search('(?P\w+)', inline_argv) + m2 = re.search(r'(?P\w+)', inline_argv) elif ptype == 'mic2': - m2 = re.search('(-f|--format(=)?)\s*(?P\w+)', + m2 = re.search(r'(-f|--format(=)?)\s*(?P\w+)', inline_argv) else: return None @@ -251,8 +251,8 @@ def do_auto(parser, ksfile, argv): with open(ksfile, 'r') as rf: first_line = rf.readline() - mic_re = '^#\s*-\*-mic-options-\*-\s+(.*)\s+-\*-mic-options-\*-' - mic2_re = '^#\s*-\*-mic2-options-\*-\s+(.*)\s+-\*-mic2-options-\*-' + mic_re = r'^#\s*-\*-mic-options-\*-\s+(.*)\s+-\*-mic-options-\*-' + mic2_re = r'^#\s*-\*-mic2-options-\*-\s+(.*)\s+-\*-mic2-options-\*-' result = parse_magic_line(mic_re, first_line, 'mic') \ or parse_magic_line(mic2_re, first_line, 'mic2') diff --git a/mic/conf.py b/mic/conf.py index d24616b..0666d1f 100755 --- a/mic/conf.py +++ b/mic/conf.py @@ -163,7 +163,7 @@ class ConfigMgr(object): return - parser = configparser.SafeConfigParser() + parser = configparser.ConfigParser() parser.read(siteconf) for section in parser.sections(): @@ -177,7 +177,7 @@ class ConfigMgr(object): # check and normalize the scheme of proxy url if self.create['proxy']: - m = re.match('^(\w+)://.*', self.create['proxy']) + m = re.match(r'^(\w+)://.*', self.create['proxy']) if m: scheme = m.group(1) if scheme not in ('http', 'https', 'ftp', 'socks'): diff --git a/mic/rt_util.py b/mic/rt_util.py index 5867d93..44b8dfd 100644 --- a/mic/rt_util.py +++ b/mic/rt_util.py @@ -221,7 +221,7 @@ def sync_mic_conf(bootstrap, conf = '/etc/mic/mic.conf'): # auto select backend with open(_path(conf), 'r') as rf: conf_str = rf.read() - conf_str = re.sub("pkgmgr\s*=\s*.*", "pkgmgr=auto", conf_str) + conf_str = re.sub(r"pkgmgr\s*=\s*.*", "pkgmgr=auto", conf_str) with open(_path(conf), 'w') as wf: wf.write(conf_str) @@ -259,7 +259,7 @@ def sync_mic(bootstrap, binpth = '/usr/bin/mic', # auto select backend with open(_path(conf), 'r') as rf: conf_str = rf.read() - conf_str = re.sub("pkgmgr\s*=\s*.*", "pkgmgr=auto", conf_str) + conf_str = re.sub(r"pkgmgr\s*=\s*.*", "pkgmgr=auto", conf_str) with open(_path(conf), 'w') as wf: wf.write(conf_str) diff --git a/mic/utils/misc.py b/mic/utils/misc.py index 25c6bb0..b52b617 100755 --- a/mic/utils/misc.py +++ b/mic/utils/misc.py @@ -51,9 +51,9 @@ from mic.utils import rpmmisc from mic.utils.safeurl import SafeURL -RPM_RE = re.compile("(.*)\.(.*) (.*)-(.*)") +RPM_RE = re.compile(r"(.*)\.(.*) (.*)-(.*)") RPM_FMT = "%(name)s.%(arch)s %(version)s-%(release)s" -SRPM_RE = re.compile("(.*)-(\d+.*)-(\d+\.\d+).src.rpm") +SRPM_RE = re.compile(r"(.*)-(\d+.*)-(\d+\.\d+).src.rpm") def build_name(kscfg, release=None, prefix = None, suffix = None): @@ -341,7 +341,7 @@ def selinux_check(arch, fstypes): def get_image_type(path): def _get_extension_name(path): - match = re.search("(?<=\.)\w+$", path) + match = re.search(r"(?<=\.)\w+$", path) if match: return match.group(0) else: diff --git a/mic/utils/rpmmisc.py b/mic/utils/rpmmisc.py index a4c4962..210d0b3 100644 --- a/mic/utils/rpmmisc.py +++ b/mic/utils/rpmmisc.py @@ -114,7 +114,7 @@ class RPMInstallCallback: rpmloc = h hdr = readRpmHeader(self.ts, h) - m = re.match("(.*)-(\d+.*)-(\d+\.\d+)\.(.+)\.rpm", os.path.basename(rpmloc)) + m = re.match(r"(.*)-(\d+.*)-(\d+\.\d+)\.(.+)\.rpm", os.path.basename(rpmloc)) if m: pkgname = m.group(1) else: @@ -163,7 +163,7 @@ class RPMInstallCallback: except: rpmloc = h - m = re.match("(.*)-(\d+.*)-(\d+\.\d+)\.(.+)\.rpm", os.path.basename(rpmloc)) + m = re.match(r"(.*)-(\d+.*)-(\d+\.\d+)\.(.+)\.rpm", os.path.basename(rpmloc)) if m: pkgname = m.group(1) else: @@ -204,7 +204,7 @@ class RPMInstallCallback: except: rpmloc = h - m = re.match("(.*)-(\d+.*)-(\d+\.\d+)\.(.+)\.rpm", os.path.basename(rpmloc)) + m = re.match(r"(.*)-(\d+.*)-(\d+\.\d+)\.(.+)\.rpm", os.path.basename(rpmloc)) if m: pkgname = m.group(1) else: diff --git a/plugins/imager/raw_plugin.py b/plugins/imager/raw_plugin.py index e5b35dc..66d2b8c 100644 --- a/plugins/imager/raw_plugin.py +++ b/plugins/imager/raw_plugin.py @@ -133,7 +133,7 @@ class RawPlugin(ImagerPlugin): # 2 3400531968B 3656384511B 255852544B primary linux-swap(v1) # 3 3656384512B 3720347647B 63963136B primary fat16 boot, lba - partition_info = re.split("\s+", line) + partition_info = re.split(r"\s+", line) size = partition_info[3].split("B")[0]