{"id":19359,"url":"https://patchwork.libcamera.org/api/1.1/patches/19359/?format=json","web_url":"https://patchwork.libcamera.org/patch/19359/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20231230190219.375528-1-raj.khem@gmail.com>","date":"2023-12-30T19:02:19","name":"[libcamera-devel] mojom: Drop using imp module.","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"920650ecf59ba960a79eb76a012c9046b32508a2","submitter":{"id":62,"url":"https://patchwork.libcamera.org/api/1.1/people/62/?format=json","name":"Khem Raj","email":"raj.khem@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19359/mbox/","series":[{"id":4130,"url":"https://patchwork.libcamera.org/api/1.1/series/4130/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4130","date":"2023-12-30T19:02:19","name":"[libcamera-devel] mojom: Drop using imp module.","version":1,"mbox":"https://patchwork.libcamera.org/series/4130/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19359/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19359/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id CC0E3BDB1D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 30 Dec 2023 19:02:28 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 15EF762B41;\n\tSat, 30 Dec 2023 20:02:28 +0100 (CET)","from mail-il1-x12e.google.com (mail-il1-x12e.google.com\n\t[IPv6:2607:f8b0:4864:20::12e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 31FE261D89\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 30 Dec 2023 20:02:26 +0100 (CET)","by mail-il1-x12e.google.com with SMTP id\n\te9e14a558f8ab-35fa08df8afso37681785ab.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 30 Dec 2023 11:02:26 -0800 (PST)","from apollo.hsd1.ca.comcast.net ([2601:646:9d80:4380::4b6f])\n\tby smtp.gmail.com with ESMTPSA id\n\t12-20020a170902c24c00b001d4af4aedeasm473968plg.208.2023.12.30.11.02.23\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSat, 30 Dec 2023 11:02:23 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1703962948;\n\tbh=8jcJiyqMTW3jAZnUKkRxllrOwPVw1stGiYSrJRVgVog=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:Cc:From;\n\tb=bV4CeIUqumihi/8ybzhF8Oxsu5yyM/zYvkYG2hAG6cTd1JYFn/c4BQ8bvRwsR9Uw8\n\tQF7fZg7wVuz6hxwhenxOR8ENrDOQPye7etw5OGJfP8crAs7K1JJpIuhSI4KaBaXyis\n\tvoRbUyWMj0uQudc8xlBs/5GJ3GFQElMWHFuBVZ0Om8nPPTfy8ugqk1QGT/HjgWj7dL\n\t+8L/+uC4y+26Vzv3rWU9kkBlouYKyiVzwJiBCyOuHwkF16U0mbhn4GwBaDjlv9wY5z\n\tmOcdDF3+7MgQzWIIUgdpYRLv6mYys+G93bEMwAPh7JCaLH7isVbKIn4/Bb0GJHZRqF\n\tOR45ttblY6skQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20230601; t=1703962944; x=1704567744;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=7kOXYplDyxPg23b86YMo7/rooB2e/sz9pfxmQhihMgo=;\n\tb=Zknz3ePOzgvq0YzvVjfK1/+R6PWNCS2TOcMJxC8Lm+sxt6Rdpse0hlZcugbbDHG/5T\n\tLV8MOM93rkkPdKOAI6FBZTA1y+dWewsJRAasC2mpDdoc6KZgy1/UX70ZdLu+iTYvo9KS\n\tYsTUsAhdr8aq2OjR9L9EqEnC2QG1zympW9fM4fTYPrPrGOwkILFRRMI0HsrHLs3vdeN9\n\tZe9KhSfg2OMKWN4NsqkWBexAJrV8VhkeWnzNjzjEqqGk1prd7P6DUqeqfi78RVnniEeN\n\teyzOcHXb+PNv6ZEsdJ53Y8cetcqBtAzpBDSpKDmoxx6W+I0lmmfUvWNX3SbaGMld/tn9\n\t0iLg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"Zknz3ePO\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1703962944; x=1704567744;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=7kOXYplDyxPg23b86YMo7/rooB2e/sz9pfxmQhihMgo=;\n\tb=K1Un47SEjcX6owJU2T2PCLqKfSZqQYquIjiFjPDYC8kK0a6FMEbDMUj2WmaHS2kO4Y\n\toXofUmH3NEm4fdMW2v+rgnnRvFv5gx8RVfyUFn8KOoNRg5EaZwmRVGCX6oq1F7lWDa9/\n\t8aZiAq948a/qM+EweIut/cFjMGdxbrJ52AaVqq5no4dKLJJ5gu6mToDk1AfpUQeAK7P+\n\tO9O++W1Pk1eos2ET5Gcm8z3xljVn7xK1mDRX0PXTCP4VbIZV5qgerNLaCLJ4q2Hf7zDj\n\tRgecQ+szviUvP41nxOcEHb5HWX9jAo39Kb9UgTnT1Fl8LABEjPLRhLqERqmFd93r2p7R\n\tUtHg==","X-Gm-Message-State":"AOJu0YzEW2zWa8DuvQ9m04PpHqYrlUlbomfGKoczoKhM8GwNRaGoGEuQ\n\t4ICyEDeQtj9D8MRgAVmn/4ttQq9rWnM=","X-Google-Smtp-Source":"AGHT+IFqvvucryj5+nzyy7a3a4QBuJOgYsQhdF9bwGK06QWQWAtjnSyI4YfpCka0qWYuaDR527nyaQ==","X-Received":"by 2002:a92:ca4c:0:b0:35f:efdc:f067 with SMTP id\n\tq12-20020a92ca4c000000b0035fefdcf067mr20644833ilo.11.1703962944362; \n\tSat, 30 Dec 2023 11:02:24 -0800 (PST)","To":"libcamera-devel@lists.libcamera.org","Date":"Sat, 30 Dec 2023 11:02:19 -0800","Message-ID":"<20231230190219.375528-1-raj.khem@gmail.com>","X-Mailer":"git-send-email 2.43.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] mojom: Drop using imp module.","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Khem Raj via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Khem Raj <raj.khem@gmail.com>","Cc":"Khem Raj <raj.khem@gmail.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"This module is gone in python 3.12 onwards, in most places it is unused\nso remove from those places, in some places where its still is needed\nreplace it with importlib.util\n\nFixes [1]\n\n[1] https://bugs.libcamera.org/show_bug.cgi?id=206\n\nSigned-off-by: Khem Raj <raj.khem@gmail.com>\n---\n utils/ipc/mojo/public/tools/mojom/mojom/fileutil.py        | 1 -\n .../ipc/mojo/public/tools/mojom/mojom/fileutil_unittest.py | 1 -\n .../tools/mojom/mojom/generate/generator_unittest.py       | 7 ++-----\n .../tools/mojom/mojom/generate/translate_unittest.py       | 1 -\n .../mojo/public/tools/mojom/mojom/parse/ast_unittest.py    | 1 -\n .../mojom/mojom/parse/conditional_features_unittest.py     | 7 ++-----\n utils/ipc/mojo/public/tools/mojom/mojom/parse/lexer.py     | 1 -\n .../mojo/public/tools/mojom/mojom/parse/lexer_unittest.py  | 6 ++----\n .../mojo/public/tools/mojom/mojom/parse/parser_unittest.py | 1 -\n 9 files changed, 6 insertions(+), 20 deletions(-)","diff":"diff --git a/utils/ipc/mojo/public/tools/mojom/mojom/fileutil.py b/utils/ipc/mojo/public/tools/mojom/mojom/fileutil.py\nindex bf626f54..e1c823da 100644\n--- a/utils/ipc/mojo/public/tools/mojom/mojom/fileutil.py\n+++ b/utils/ipc/mojo/public/tools/mojom/mojom/fileutil.py\n@@ -3,7 +3,6 @@\n # found in the LICENSE file.\n \n import errno\n-import imp\n import os.path\n import sys\n \ndiff --git a/utils/ipc/mojo/public/tools/mojom/mojom/fileutil_unittest.py b/utils/ipc/mojo/public/tools/mojom/mojom/fileutil_unittest.py\nindex ff5753a2..e754151f 100644\n--- a/utils/ipc/mojo/public/tools/mojom/mojom/fileutil_unittest.py\n+++ b/utils/ipc/mojo/public/tools/mojom/mojom/fileutil_unittest.py\n@@ -2,7 +2,6 @@\n # Use of this source code is governed by a BSD-style license that can be\n # found in the LICENSE file.\n \n-import imp\n import os.path\n import shutil\n import sys\ndiff --git a/utils/ipc/mojo/public/tools/mojom/mojom/generate/generator_unittest.py b/utils/ipc/mojo/public/tools/mojom/mojom/generate/generator_unittest.py\nindex 32c884a8..6cae6092 100644\n--- a/utils/ipc/mojo/public/tools/mojom/mojom/generate/generator_unittest.py\n+++ b/utils/ipc/mojo/public/tools/mojom/mojom/generate/generator_unittest.py\n@@ -2,7 +2,7 @@\n # Use of this source code is governed by a BSD-style license that can be\n # found in the LICENSE file.\n \n-import imp\n+import importlib.util\n import os.path\n import sys\n import unittest\n@@ -18,10 +18,7 @@ def _GetDirAbove(dirname):\n     if tail == dirname:\n       return path\n \n-\n-try:\n-  imp.find_module(\"mojom\")\n-except ImportError:\n+if importlib.util.find_spec(\"mojom\") is None:\n   sys.path.append(os.path.join(_GetDirAbove(\"pylib\"), \"pylib\"))\n from mojom.generate import generator\n \ndiff --git a/utils/ipc/mojo/public/tools/mojom/mojom/generate/translate_unittest.py b/utils/ipc/mojo/public/tools/mojom/mojom/generate/translate_unittest.py\nindex 19905c8a..09724d88 100644\n--- a/utils/ipc/mojo/public/tools/mojom/mojom/generate/translate_unittest.py\n+++ b/utils/ipc/mojo/public/tools/mojom/mojom/generate/translate_unittest.py\n@@ -2,7 +2,6 @@\n # Use of this source code is governed by a BSD-style license that can be\n # found in the LICENSE file.\n \n-import imp\n import os.path\n import sys\n import unittest\ndiff --git a/utils/ipc/mojo/public/tools/mojom/mojom/parse/ast_unittest.py b/utils/ipc/mojo/public/tools/mojom/mojom/parse/ast_unittest.py\nindex 62798631..4ab51033 100644\n--- a/utils/ipc/mojo/public/tools/mojom/mojom/parse/ast_unittest.py\n+++ b/utils/ipc/mojo/public/tools/mojom/mojom/parse/ast_unittest.py\n@@ -2,7 +2,6 @@\n # Use of this source code is governed by a BSD-style license that can be\n # found in the LICENSE file.\n \n-import imp\n import os.path\n import sys\n import unittest\ndiff --git a/utils/ipc/mojo/public/tools/mojom/mojom/parse/conditional_features_unittest.py b/utils/ipc/mojo/public/tools/mojom/mojom/parse/conditional_features_unittest.py\nindex aa609be7..f3c2c95f 100644\n--- a/utils/ipc/mojo/public/tools/mojom/mojom/parse/conditional_features_unittest.py\n+++ b/utils/ipc/mojo/public/tools/mojom/mojom/parse/conditional_features_unittest.py\n@@ -2,7 +2,7 @@\n # Use of this source code is governed by a BSD-style license that can be\n # found in the LICENSE file.\n \n-import imp\n+import importlib.util\n import os\n import sys\n import unittest\n@@ -18,10 +18,7 @@ def _GetDirAbove(dirname):\n     if tail == dirname:\n       return path\n \n-\n-try:\n-  imp.find_module('mojom')\n-except ImportError:\n+if importlib.util.find_spec(\"mojom\") is None:\n   sys.path.append(os.path.join(_GetDirAbove('pylib'), 'pylib'))\n import mojom.parse.ast as ast\n import mojom.parse.conditional_features as conditional_features\ndiff --git a/utils/ipc/mojo/public/tools/mojom/mojom/parse/lexer.py b/utils/ipc/mojo/public/tools/mojom/mojom/parse/lexer.py\nindex 3e084bbf..1e8b49f2 100644\n--- a/utils/ipc/mojo/public/tools/mojom/mojom/parse/lexer.py\n+++ b/utils/ipc/mojo/public/tools/mojom/mojom/parse/lexer.py\n@@ -2,7 +2,6 @@\n # Use of this source code is governed by a BSD-style license that can be\n # found in the LICENSE file.\n \n-import imp\n import os.path\n import sys\n \ndiff --git a/utils/ipc/mojo/public/tools/mojom/mojom/parse/lexer_unittest.py b/utils/ipc/mojo/public/tools/mojom/mojom/parse/lexer_unittest.py\nindex eadc6587..77976507 100644\n--- a/utils/ipc/mojo/public/tools/mojom/mojom/parse/lexer_unittest.py\n+++ b/utils/ipc/mojo/public/tools/mojom/mojom/parse/lexer_unittest.py\n@@ -2,7 +2,7 @@\n # Use of this source code is governed by a BSD-style license that can be\n # found in the LICENSE file.\n \n-import imp\n+import importlib.util\n import os.path\n import sys\n import unittest\n@@ -22,9 +22,7 @@ def _GetDirAbove(dirname):\n sys.path.insert(1, os.path.join(_GetDirAbove(\"mojo\"), \"third_party\"))\n from ply import lex\n \n-try:\n-  imp.find_module(\"mojom\")\n-except ImportError:\n+if importlib.util.find_spec(\"mojom\") is None:\n   sys.path.append(os.path.join(_GetDirAbove(\"pylib\"), \"pylib\"))\n import mojom.parse.lexer\n \ndiff --git a/utils/ipc/mojo/public/tools/mojom/mojom/parse/parser_unittest.py b/utils/ipc/mojo/public/tools/mojom/mojom/parse/parser_unittest.py\nindex 6d6b7153..7e8acf43 100644\n--- a/utils/ipc/mojo/public/tools/mojom/mojom/parse/parser_unittest.py\n+++ b/utils/ipc/mojo/public/tools/mojom/mojom/parse/parser_unittest.py\n@@ -2,7 +2,6 @@\n # Use of this source code is governed by a BSD-style license that can be\n # found in the LICENSE file.\n \n-import imp\n import os.path\n import sys\n import unittest\n","prefixes":["libcamera-devel"]}