From patchwork Fri Sep 18 15:20:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 9667 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 1291DBF01C for ; Fri, 18 Sep 2020 15:21:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 839C162FB5; Fri, 18 Sep 2020 17:20:59 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="hRP+7N1c"; dkim-atps=neutral Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B5CC662F4F for ; Fri, 18 Sep 2020 17:20:57 +0200 (CEST) Received: by mail-lj1-x229.google.com with SMTP id n25so5424133ljj.4 for ; Fri, 18 Sep 2020 08:20:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=R4nHoGZ7dAb+NAJgzodJYAQUlWgD7KAxhmX3Qd4lJ18=; b=hRP+7N1c6B9roQbmPIMIsUlzczAWatejF/zOWiwGPVbnXiShxdT2S2QJUQhb7Og8cE gL6WLMfD2eQRyiMWJBbOnIhWIU4cR1ZOHusoF317887E/SvDG3lbGgZ3aWcZ151fNfeF OYXNGpScJRkv830t2Ccs8AXzcjjidyZH2ERoC4iNZAOeXW7Q5GqRd9Cxl3oMketv0UMW RYvmC07aqyOuiQyGgDDvBt6sj78crjf3yKN03fG0vdX08h1L1ts7YwcAypkNk8BYg5gG j+iQvu1RZikkju1+so41h8Jzu1ACCmHZYvRiHTRdSaGuuRBIzGALzPe3XhmnJ1u9FJai K5VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=R4nHoGZ7dAb+NAJgzodJYAQUlWgD7KAxhmX3Qd4lJ18=; b=QSKGFNULbr5RBVi1/H7y3Mb/HIxJ4FOQw8EMkUyqDk+3bTxdEeluA98BMb5KQCy0PG 86Cz/llqr20HyLzg+2pwzz7IWRjDY1LlfOepd4zW5pVDr5XNPi4s99w0wN2mrR/4WI8K 4U82Uj8viazxE9dHyCginG2vSWzJSXsqRqkoYAGYCc+jnfQWsPZjZZHfYPN3aemAGi3w Zz8Fg3Fi73FkT0hlTG+1EFWrOmi8NGk9/uekuC2PajXKIh5yGHmnVglMKZK32XIRID3G IDBgScS/6MGiNq2JBVh/AVea/y+9AjlpTeajN0Q7CZswI+Cnq0SKX+aYxBDhQ2lZES6G ClVw== X-Gm-Message-State: AOAM5338XDqxiOwEYFQUUHlyXl65TLq9aOgcGbAdX3BG3XjlsCrmTZIP juIeoHQt+1Yq06AWtKnzPwZqG6k1lIIABA== X-Google-Smtp-Source: ABdhPJwSsRWVugo0V9i2KQM/Cd1IF1NHt8pm632Ug8NwI33LKpid9rCo+lqJ8NsMYrEWEHuteaScAg== X-Received: by 2002:a05:651c:514:: with SMTP id o20mr12804612ljp.312.1600442456686; Fri, 18 Sep 2020 08:20:56 -0700 (PDT) Received: from deskari.ti.com (91-152-83-50.elisa-laajakaista.fi. [91.152.83.50]) by smtp.gmail.com with ESMTPSA id i63sm666472lji.66.2020.09.18.08.20.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 08:20:56 -0700 (PDT) From: Tomi Valkeinen To: libcamera-devel@lists.libcamera.org Date: Fri, 18 Sep 2020 18:20:15 +0300 Message-Id: <20200918152019.784315-1-tomi.valkeinen@iki.fi> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [RFC 0/4] prototype python bindings 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: , Cc: Tomi Valkeinen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hi, Laurent asked me to send these to get discussions about the challenges on the list (rather than in private chats...). This is a prototype, RFC, hack, whatever you want to call it, but it works for me for the small subset of features used in test.py. The main patch "libcamera python bindings" has some questions/issues listed in the description, and I've added comments to the code where I'm not sure where to go. There were no submodules in libcamera, so I used the same convention I've used in kms++: ext/. pybind11 could be added as something that comes from the system (at least Ubuntu 20.04 has it), but as it's header only, I think having it as a submodule is the easiest and most manageable way to add it. Tomi Tomi Valkeinen (4): Add pybind11 submodule Add BoundMethodFunction hack: Camera public destructor libcamera python bindings .gitmodules | 3 + ext/pybind11 | 1 + include/libcamera/bound_method.h | 25 +++++ include/libcamera/camera.h | 2 +- include/libcamera/signal.h | 6 ++ meson.build | 1 + meson_options.txt | 2 + py/meson.build | 1 + py/pycamera/__init__.py | 29 +++++ py/pycamera/meson.build | 35 ++++++ py/pycamera/pymain.cpp | 169 +++++++++++++++++++++++++++++ py/test/run-valgrind.sh | 3 + py/test/run.sh | 3 + py/test/test.py | 177 +++++++++++++++++++++++++++++++ py/test/valgrind-pycamera.supp | 17 +++ 15 files changed, 473 insertions(+), 1 deletion(-) create mode 100644 .gitmodules create mode 160000 ext/pybind11 create mode 100644 py/meson.build create mode 100644 py/pycamera/__init__.py create mode 100644 py/pycamera/meson.build create mode 100644 py/pycamera/pymain.cpp create mode 100755 py/test/run-valgrind.sh create mode 100755 py/test/run.sh create mode 100755 py/test/test.py create mode 100644 py/test/valgrind-pycamera.supp