From patchwork Tue May 30 09:20:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 18657 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 EE908C3213 for ; Tue, 30 May 2023 09:20:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 56831627B7; Tue, 30 May 2023 11:20:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1685438457; 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=Yd+UQFCQwG+CMIEU133f/tspJEqaxLRLJXRWArPfOmPytorJysNmMlDt1vGlWrsOQ aKW8JanbuntugSS9gVg+pzQWGbIIMN2/soYi/moVZkQUnQ59swTdgFThYb7EeZtMZY Qb+mQsMYiWlfWyBQB6+NvRh3T1JFgNlgnFymccYXzOHmhls6vWHXwRho1O950ZwaOV YhFIb7nd8cwVrWIQCb93wZC8aR/BYRmnxQKeFDPtquQ1Bm/PHLSs0GDDzahr+j9oBD j3OxC2PBrE8/L1tYG7EyLudwXZX+2dJR9kGDl5bLJ6KVR5lE8Xl8a+4DxJpxYpEUbu D32Sjfl3mvkMg== 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 CFFE760388 for ; Tue, 30 May 2023 11:20:55 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="L0LJm48U"; 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 F0AE327C; Tue, 30 May 2023 11:20:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1685438435; bh=MojXN5LsK1M08AUQsQRtnbnFG2cVSxHBamwtr1V7GrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L0LJm48UCeJtu/36DAl1YeZsNk+ZAk6VMTzt6jSNx5XMPL2QBmuG+qsdVOKENRnZu UQXpRq8Vrj9O+eGred7xk0lNFf1qi7nr5GAHdScEMAb4lM3mOZ6Wc5imKLG9bVxcVB o3szmxqSAIPsD3C+egufs/0rfiPF8Zwj2GQC4cPE= To: libcamera-devel@lists.libcamera.org Date: Tue, 30 May 2023 12:20:12 +0300 Message-Id: <20230530092016.34953-2-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230530092016.34953-1-tomi.valkeinen@ideasonboard.com> References: <20230530092016.34953-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 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