From patchwork Tue May 30 12:01:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 18663 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 154A8C31E9 for ; Tue, 30 May 2023 12:01:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CE8E9627D3; Tue, 30 May 2023 14:01:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1685448110; bh=MojXN5LsK1M08AUQsQRtnbnFG2cVSxHBamwtr1V7GrE=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=x9YWbrp/AxDX1lIfEMDLrxdNJk60fw0qrFeVccRB88dZ+IcVawKn2HmyV0hGvfRru +bG4AC4KtYShw86JkoZRe+NzWauKhVMArHATGSpCAUaleIN2O3iJqiCpF0NrTR5f9g amVYaie0xfiy8d9FDrIKluuE6SKD3LX5AW3gRAWdnPLxbT2SkTrEe2Em4KugZQ57T4 tqcpgiQ4rVzXpOUTR0/wYiU8hTYLmmMuQx6NY8ZGCZfmEbxyVJCBQqR6+zp5T4QSxa sbylkXbK9dwrmnKzkXDv29TxCBWofdIMniAXEnRWB8iKPy9ZlG6jQPhrigZwMepgRB AwJbHYuyO4Mhw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E9B5D60599 for ; Tue, 30 May 2023 14:01:47 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="weL0xyHR"; dkim-atps=neutral Received: from desky.lan (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0C9A37F3; Tue, 30 May 2023 14:01:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1685448087; bh=MojXN5LsK1M08AUQsQRtnbnFG2cVSxHBamwtr1V7GrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=weL0xyHR91mR6w7yyttaozCPfEXgdzRrOT7113s5b19FBU5gmMdhhZr0589i3HbRe z846ABJ0WbBjy4TloyQAie9sbnxcgnNCU0YlJLdyYhguXaT91tWGfQFPtta4K4y3gt QJicsCZm5hN8Mm2IYu4rpDOaum/6m2hSSbwgsEq8= To: libcamera-devel@lists.libcamera.org Date: Tue, 30 May 2023 15:01:29 +0300 Message-Id: <20230530120133.99033-2-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230530120133.99033-1-tomi.valkeinen@ideasonboard.com> References: <20230530120133.99033-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/5] py: Fix CameraManager.version property 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: Tomi Valkeinen via libcamera-devel From: Tomi Valkeinen Reply-To: Tomi Valkeinen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The current CameraManager.version doesn't work at all (raises a TypeError), as that's not how you use expose C++ static methods as Python class methods. Fix it. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- src/py/libcamera/py_main.cpp | 2 +- test/py/unittests.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp index d14e18e2..c55495cc 100644 --- a/src/py/libcamera/py_main.cpp +++ b/src/py/libcamera/py_main.cpp @@ -105,7 +105,7 @@ PYBIND11_MODULE(_libcamera, m) return cm; }) - .def_property_readonly("version", &PyCameraManager::version) + .def_property_readonly_static("version", [](py::object /* self */) { return PyCameraManager::version(); }) .def("get", &PyCameraManager::get, py::keep_alive<0, 1>()) .def_property_readonly("cameras", &PyCameraManager::cameras) diff --git a/test/py/unittests.py b/test/py/unittests.py index 6dea80fc..90b04330 100755 --- a/test/py/unittests.py +++ b/test/py/unittests.py @@ -68,6 +68,10 @@ class SimpleTestMethods(BaseTestCase): # I expected EBUSY, but looks like double release works fine self.assertZero(ret) + def test_version(self): + cm = libcam.CameraManager.singleton() + self.assertIsInstance(cm.version, str) + class CameraTesterBase(BaseTestCase): cm: typing.Any