Fix build errors on Ubuntu 24.04 03/312303/4 sandbox/xuhy/devel-build-ubuntu2404
authorxuhy <huayong.xu@samsung.com>
Thu, 6 Jun 2024 09:11:58 +0000 (17:11 +0800)
committerxuhy <huayong.xu@samsung.com>
Thu, 4 Jul 2024 02:31:18 +0000 (10:31 +0800)
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 <huayong.xu@samsung.com>
13 files changed:
debian/mic.install
debian/rules
mic/3rdparty/requests/api.py
mic/3rdparty/requests/models.py
mic/3rdparty/requests/packages/urllib3/connectionpool.py
mic/3rdparty/requests/packages/urllib3/poolmanager.py
mic/3rdparty/requests/sessions.py
mic/cmd_create.py
mic/conf.py
mic/rt_util.py
mic/utils/misc.py
mic/utils/rpmmisc.py
plugins/imager/raw_plugin.py

index adadd7f..4206618 100644 (file)
@@ -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
index dd312e2..33f3b5f 100755 (executable)
@@ -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:
 
index d40fa38..9c7dd2a 100755 (executable)
@@ -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.
index 42369c5..85f206c 100755 (executable)
@@ -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.
         """
index c5f8b8e..7e1fb57 100755 (executable)
@@ -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
index a50ac23..e103d76 100755 (executable)
@@ -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.
 
index 4195a7d..0d0e71c 100755 (executable)
@@ -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.
index bb60c9d..ed8a7c9 100644 (file)
@@ -231,9 +231,9 @@ def do_auto(parser, ksfile, argv):
 
             inline_argv = m.group(1).strip()
             if ptype == 'mic':
-                m2 = re.search('(?P<format>\w+)', inline_argv)
+                m2 = re.search(r'(?P<format>\w+)', inline_argv)
             elif ptype == 'mic2':
-                m2 = re.search('(-f|--format(=)?)\s*(?P<format>\w+)',
+                m2 = re.search(r'(-f|--format(=)?)\s*(?P<format>\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')
index d24616b..0666d1f 100755 (executable)
@@ -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'):
index 5867d93..44b8dfd 100644 (file)
@@ -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)
 
index 25c6bb0..b52b617 100755 (executable)
@@ -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:
index a4c4962..210d0b3 100644 (file)
@@ -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:
index e5b35dc..66d2b8c 100644 (file)
@@ -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]