From patchwork Sat Dec 30 19:02:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 19359 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id CC0E3BDB1D for ; Sat, 30 Dec 2023 19:02:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 15EF762B41; Sat, 30 Dec 2023 20:02:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1703962948; bh=8jcJiyqMTW3jAZnUKkRxllrOwPVw1stGiYSrJRVgVog=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=bV4CeIUqumihi/8ybzhF8Oxsu5yyM/zYvkYG2hAG6cTd1JYFn/c4BQ8bvRwsR9Uw8 QF7fZg7wVuz6hxwhenxOR8ENrDOQPye7etw5OGJfP8crAs7K1JJpIuhSI4KaBaXyis voRbUyWMj0uQudc8xlBs/5GJ3GFQElMWHFuBVZ0Om8nPPTfy8ugqk1QGT/HjgWj7dL +8L/+uC4y+26Vzv3rWU9kkBlouYKyiVzwJiBCyOuHwkF16U0mbhn4GwBaDjlv9wY5z mOcdDF3+7MgQzWIIUgdpYRLv6mYys+G93bEMwAPh7JCaLH7isVbKIn4/Bb0GJHZRqF OR45ttblY6skQ== Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 31FE261D89 for ; Sat, 30 Dec 2023 20:02:26 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Zknz3ePO"; dkim-atps=neutral Received: by mail-il1-x12e.google.com with SMTP id e9e14a558f8ab-35fa08df8afso37681785ab.3 for ; Sat, 30 Dec 2023 11:02:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703962944; x=1704567744; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=7kOXYplDyxPg23b86YMo7/rooB2e/sz9pfxmQhihMgo=; b=Zknz3ePOzgvq0YzvVjfK1/+R6PWNCS2TOcMJxC8Lm+sxt6Rdpse0hlZcugbbDHG/5T LV8MOM93rkkPdKOAI6FBZTA1y+dWewsJRAasC2mpDdoc6KZgy1/UX70ZdLu+iTYvo9KS YsTUsAhdr8aq2OjR9L9EqEnC2QG1zympW9fM4fTYPrPrGOwkILFRRMI0HsrHLs3vdeN9 Ze9KhSfg2OMKWN4NsqkWBexAJrV8VhkeWnzNjzjEqqGk1prd7P6DUqeqfi78RVnniEeN eyzOcHXb+PNv6ZEsdJ53Y8cetcqBtAzpBDSpKDmoxx6W+I0lmmfUvWNX3SbaGMld/tn9 0iLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703962944; x=1704567744; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7kOXYplDyxPg23b86YMo7/rooB2e/sz9pfxmQhihMgo=; b=K1Un47SEjcX6owJU2T2PCLqKfSZqQYquIjiFjPDYC8kK0a6FMEbDMUj2WmaHS2kO4Y oXofUmH3NEm4fdMW2v+rgnnRvFv5gx8RVfyUFn8KOoNRg5EaZwmRVGCX6oq1F7lWDa9/ 8aZiAq948a/qM+EweIut/cFjMGdxbrJ52AaVqq5no4dKLJJ5gu6mToDk1AfpUQeAK7P+ O9O++W1Pk1eos2ET5Gcm8z3xljVn7xK1mDRX0PXTCP4VbIZV5qgerNLaCLJ4q2Hf7zDj RgecQ+szviUvP41nxOcEHb5HWX9jAo39Kb9UgTnT1Fl8LABEjPLRhLqERqmFd93r2p7R UtHg== X-Gm-Message-State: AOJu0YzEW2zWa8DuvQ9m04PpHqYrlUlbomfGKoczoKhM8GwNRaGoGEuQ 4ICyEDeQtj9D8MRgAVmn/4ttQq9rWnM= X-Google-Smtp-Source: AGHT+IFqvvucryj5+nzyy7a3a4QBuJOgYsQhdF9bwGK06QWQWAtjnSyI4YfpCka0qWYuaDR527nyaQ== X-Received: by 2002:a92:ca4c:0:b0:35f:efdc:f067 with SMTP id q12-20020a92ca4c000000b0035fefdcf067mr20644833ilo.11.1703962944362; Sat, 30 Dec 2023 11:02:24 -0800 (PST) Received: from apollo.hsd1.ca.comcast.net ([2601:646:9d80:4380::4b6f]) by smtp.gmail.com with ESMTPSA id 12-20020a170902c24c00b001d4af4aedeasm473968plg.208.2023.12.30.11.02.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 11:02:23 -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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Khem Raj via libcamera-devel From: Khem Raj Reply-To: Khem Raj Cc: Khem Raj Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This module is gone in python 3.12 onwards, in most places it is unused so remove from those places, in some places where its still is needed replace it with importlib.util Fixes [1] [1] https://bugs.libcamera.org/show_bug.cgi?id=206 Signed-off-by: Khem Raj Acked-by: Kieran Bingham --- utils/ipc/mojo/public/tools/mojom/mojom/fileutil.py | 1 - .../ipc/mojo/public/tools/mojom/mojom/fileutil_unittest.py | 1 - .../tools/mojom/mojom/generate/generator_unittest.py | 7 ++----- .../tools/mojom/mojom/generate/translate_unittest.py | 1 - .../mojo/public/tools/mojom/mojom/parse/ast_unittest.py | 1 - .../mojom/mojom/parse/conditional_features_unittest.py | 7 ++----- utils/ipc/mojo/public/tools/mojom/mojom/parse/lexer.py | 1 - .../mojo/public/tools/mojom/mojom/parse/lexer_unittest.py | 6 ++---- .../mojo/public/tools/mojom/mojom/parse/parser_unittest.py | 1 - 9 files changed, 6 insertions(+), 20 deletions(-) diff --git a/utils/ipc/mojo/public/tools/mojom/mojom/fileutil.py b/utils/ipc/mojo/public/tools/mojom/mojom/fileutil.py index bf626f54..e1c823da 100644 --- a/utils/ipc/mojo/public/tools/mojom/mojom/fileutil.py +++ b/utils/ipc/mojo/public/tools/mojom/mojom/fileutil.py @@ -3,7 +3,6 @@ # found in the LICENSE file. import errno -import imp import os.path import sys diff --git a/utils/ipc/mojo/public/tools/mojom/mojom/fileutil_unittest.py b/utils/ipc/mojo/public/tools/mojom/mojom/fileutil_unittest.py index ff5753a2..e754151f 100644 --- a/utils/ipc/mojo/public/tools/mojom/mojom/fileutil_unittest.py +++ b/utils/ipc/mojo/public/tools/mojom/mojom/fileutil_unittest.py @@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import imp import os.path import shutil import sys diff --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 index 32c884a8..6cae6092 100644 --- a/utils/ipc/mojo/public/tools/mojom/mojom/generate/generator_unittest.py +++ b/utils/ipc/mojo/public/tools/mojom/mojom/generate/generator_unittest.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import imp +import importlib.util import os.path import sys import unittest @@ -18,10 +18,7 @@ def _GetDirAbove(dirname): if tail == dirname: return path - -try: - imp.find_module("mojom") -except ImportError: +if importlib.util.find_spec("mojom") is None: sys.path.append(os.path.join(_GetDirAbove("pylib"), "pylib")) from mojom.generate import generator diff --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 index 19905c8a..09724d88 100644 --- a/utils/ipc/mojo/public/tools/mojom/mojom/generate/translate_unittest.py +++ b/utils/ipc/mojo/public/tools/mojom/mojom/generate/translate_unittest.py @@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import imp import os.path import sys import unittest diff --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 index 62798631..4ab51033 100644 --- a/utils/ipc/mojo/public/tools/mojom/mojom/parse/ast_unittest.py +++ b/utils/ipc/mojo/public/tools/mojom/mojom/parse/ast_unittest.py @@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import imp import os.path import sys import unittest diff --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 index aa609be7..f3c2c95f 100644 --- 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 @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import imp +import importlib.util import os import sys import unittest @@ -18,10 +18,7 @@ def _GetDirAbove(dirname): if tail == dirname: return path - -try: - imp.find_module('mojom') -except ImportError: +if importlib.util.find_spec("mojom") is None: sys.path.append(os.path.join(_GetDirAbove('pylib'), 'pylib')) import mojom.parse.ast as ast import mojom.parse.conditional_features as conditional_features diff --git a/utils/ipc/mojo/public/tools/mojom/mojom/parse/lexer.py b/utils/ipc/mojo/public/tools/mojom/mojom/parse/lexer.py index 3e084bbf..1e8b49f2 100644 --- a/utils/ipc/mojo/public/tools/mojom/mojom/parse/lexer.py +++ b/utils/ipc/mojo/public/tools/mojom/mojom/parse/lexer.py @@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import imp import os.path import sys diff --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 index eadc6587..77976507 100644 --- a/utils/ipc/mojo/public/tools/mojom/mojom/parse/lexer_unittest.py +++ b/utils/ipc/mojo/public/tools/mojom/mojom/parse/lexer_unittest.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import imp +import importlib.util import os.path import sys import unittest @@ -22,9 +22,7 @@ def _GetDirAbove(dirname): sys.path.insert(1, os.path.join(_GetDirAbove("mojo"), "third_party")) from ply import lex -try: - imp.find_module("mojom") -except ImportError: +if importlib.util.find_spec("mojom") is None: sys.path.append(os.path.join(_GetDirAbove("pylib"), "pylib")) import mojom.parse.lexer diff --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 index 6d6b7153..7e8acf43 100644 --- a/utils/ipc/mojo/public/tools/mojom/mojom/parse/parser_unittest.py +++ b/utils/ipc/mojo/public/tools/mojom/mojom/parse/parser_unittest.py @@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import imp import os.path import sys import unittest