From patchwork Wed Oct 11 12:12:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Howard X-Patchwork-Id: 732237 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C3E6CD6E60 for ; Wed, 11 Oct 2023 12:16:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235003AbjJKMQC (ORCPT ); Wed, 11 Oct 2023 08:16:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235002AbjJKMPz (ORCPT ); Wed, 11 Oct 2023 08:15:55 -0400 Received: from mail-ed1-x564.google.com (mail-ed1-x564.google.com [IPv6:2a00:1450:4864:20::564]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B85FF44BD for ; Wed, 11 Oct 2023 05:13:14 -0700 (PDT) Received: by mail-ed1-x564.google.com with SMTP id 4fb4d7f45d1cf-53d8320f0easo2785472a12.3 for ; Wed, 11 Oct 2023 05:13:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gadgetoid.com; s=google; t=1697026388; x=1697631188; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DK9dJ9jy4t0RJYplqPgZneMfZDamD+neySH+hGtkHmQ=; b=XPrNrkkWwkgxFgVu18nBppPXV6Qo9MOXRr+5FftiRHd7tSNYxOroFzbVH/yzPvoRuj 43V3KRFTIiCLL0/WpGbw2zml8HGeeDS/TGhMiJsge/N3RmP90S83sM19e5fTGTwmRDhJ fahX51/OykoFz/1VaK1zNu/+1NecJO+j1GQrJk/TR9/rZBD2iuXtKVUI3qVVe+NHxpv7 EGHbF93AkLJ9cN/+I+iOgQqZXP7vnyNRohQnUDynFm6kAzIA13B+0M2ZNwGaInnJMxLQ moz27lr1EsNmVl96F6rG3s1zNjjWlG/ay51oB25DwovlcwWJtVAmfeSSD5eggR2H83SA oANQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697026388; x=1697631188; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DK9dJ9jy4t0RJYplqPgZneMfZDamD+neySH+hGtkHmQ=; b=p2HGbO1hLP7XtgjMlyxsKdVJMM7AY1y9F198OTWaWVlBTlh2oQEwHgCqpYyW3EcAnB BmodlZI9BhQbXoTmTocGsExvSgeeWyzbiOBbF1fEyEiX6IiwvFcFCugVuNCmKwxB64Gs aENbRyTmDwSmpX14GHwTwt5BrczWHm3C9N25heFxxOs7K8MpM2QNKQ9pi8k5SvV2ZhtC ncNGdH/2v/mnnlzC+tCbKKzHZ5NMeh4aadBX8erHrYm4yfZoy2o8tlR7tq7CVLTLTiqm gcvzZaLWBtnf4PLGVshWQpBR8tbYnD6PvDBkDp/W/YgRJM+nfgHOqSJKuSRhuN06tij2 6bcg== X-Gm-Message-State: AOJu0Yw8srBokCZ0ox0V2Qg8dqyUzYfx5ZoRYYx6DJPjmRMVbnlUlLHG udjwbcOcgZXLE+Rr5KPK14+f8wuO0ZxoDfK6xVsTmaqWOaUrMQ== X-Google-Smtp-Source: AGHT+IHfRZFqBWV/ehzxisvbzkImR34N23PDJ53Drl6a1NeBHPEiouT8K970Ueu2wusTv7NaMTPSmuNfLYYB X-Received: by 2002:a17:906:9c1:b0:9ae:5aa4:9fa with SMTP id r1-20020a17090609c100b009ae5aa409famr18581064eje.42.1697026387700; Wed, 11 Oct 2023 05:13:07 -0700 (PDT) Received: from pop-os.. (cpc91242-cmbg18-2-0-cust972.5-4.cable.virginm.net. [82.8.131.205]) by smtp-relay.gmail.com with ESMTPS id x6-20020a170906134600b009b9720a85dcsm1582049ejb.44.2023.10.11.05.13.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 05:13:07 -0700 (PDT) X-Relaying-Domain: gadgetoid.com From: Phil Howard To: Linus Walleij , Andy Shevchenko , Kent Gibson , Bartosz Golaszewski Cc: linux-gpio@vger.kernel.org, Phil Howard Subject: [libgpiod][PATCH 1/3] bindings: python: optionally include module in sdist Date: Wed, 11 Oct 2023 13:12:44 +0100 Message-Id: <20231011121246.9467-2-phil@gadgetoid.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011121246.9467-1-phil@gadgetoid.com> References: <20231011121246.9467-1-phil@gadgetoid.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Build gpiod into Python module. Optional environment var USE_SYSTEM_GPIO=1 to generate a module that depends upon system gpiod. Signed-off-by: Phil Howard --- bindings/python/MANIFEST.in | 4 +++ bindings/python/include | 1 + bindings/python/lib | 1 + bindings/python/setup.py | 57 ++++++++++++++++++++++++++++--------- 4 files changed, 50 insertions(+), 13 deletions(-) create mode 120000 bindings/python/include create mode 120000 bindings/python/lib diff --git a/bindings/python/MANIFEST.in b/bindings/python/MANIFEST.in index c7124d4..eff8977 100644 --- a/bindings/python/MANIFEST.in +++ b/bindings/python/MANIFEST.in @@ -11,3 +11,7 @@ recursive-include gpiod/ext *.h recursive-include tests/gpiosim *.c recursive-include tests/procname *.c + +recursive-include lib *.c +recursive-include lib *.h +recursive-include include *.h diff --git a/bindings/python/include b/bindings/python/include new file mode 120000 index 0000000..fcffffb --- /dev/null +++ b/bindings/python/include @@ -0,0 +1 @@ +../../include \ No newline at end of file diff --git a/bindings/python/lib b/bindings/python/lib new file mode 120000 index 0000000..58677dd --- /dev/null +++ b/bindings/python/lib @@ -0,0 +1 @@ +../../lib \ No newline at end of file diff --git a/bindings/python/setup.py b/bindings/python/setup.py index 66b7908..2e25981 100644 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -19,19 +19,53 @@ class build_ext(orig_build_ext): rmtree(path.join(self.build_lib, "tests"), ignore_errors=True) +with open("gpiod/version.py", "r") as fd: + exec(fd.read()) + + +sources = [ + # gpiod Python bindings + "gpiod/ext/chip.c", + "gpiod/ext/common.c", + "gpiod/ext/line-config.c", + "gpiod/ext/line-settings.c", + "gpiod/ext/module.c", + "gpiod/ext/request.c", +] + +if "USE_SYSTEM_GPIOD" in environ and environ["USE_SYSTEM_GPIOD"] == "1": + libraries = ["gpiod"] + include_dirs = ["gpiod"] +else: + sources += [ + # gpiod library + "lib/chip.c", + "lib/chip-info.c", + "lib/edge-event.c", + "lib/info-event.c", + "lib/internal.c", + "lib/line-config.c", + "lib/line-info.c", + "lib/line-request.c", + "lib/line-settings.c", + "lib/misc.c", + "lib/request-config.c", + ] + libraries = [] + include_dirs = ["include", "lib", "gpiod/ext"] + + gpiod_ext = Extension( "gpiod._ext", - sources=[ - "gpiod/ext/chip.c", - "gpiod/ext/common.c", - "gpiod/ext/line-config.c", - "gpiod/ext/line-settings.c", - "gpiod/ext/module.c", - "gpiod/ext/request.c", - ], + libraries=libraries, + sources=sources, define_macros=[("_GNU_SOURCE", "1")], - libraries=["gpiod"], - extra_compile_args=["-Wall", "-Wextra"], + include_dirs=include_dirs, + extra_compile_args=[ + "-Wall", + "-Wextra", + '-DGPIOD_VERSION_STR="{}"'.format(__version__), + ], ) gpiosim_ext = Extension( @@ -54,9 +88,6 @@ if "GPIOD_WITH_TESTS" in environ and environ["GPIOD_WITH_TESTS"] == "1": extensions.append(gpiosim_ext) extensions.append(procname_ext) -with open("gpiod/version.py", "r") as fd: - exec(fd.read()) - setup( name="libgpiod", packages=find_packages(exclude=["tests", "tests.*"]), From patchwork Wed Oct 11 12:12:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Howard X-Patchwork-Id: 732966 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7D1FCD6E62 for ; Wed, 11 Oct 2023 12:14:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346817AbjJKMO6 (ORCPT ); Wed, 11 Oct 2023 08:14:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346767AbjJKMOw (ORCPT ); Wed, 11 Oct 2023 08:14:52 -0400 Received: from mail-lf1-x164.google.com (mail-lf1-x164.google.com [IPv6:2a00:1450:4864:20::164]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54E314681 for ; Wed, 11 Oct 2023 05:13:14 -0700 (PDT) Received: by mail-lf1-x164.google.com with SMTP id 2adb3069b0e04-50308217223so8559417e87.3 for ; Wed, 11 Oct 2023 05:13:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gadgetoid.com; s=google; t=1697026389; x=1697631189; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5t6GIee90pO3Wbr53RuwASc/+xC7LgMcWfutPVzZ424=; b=eT8zHO64jqS+NeCJrPtw9ydJ+wGXX9tD+G4M8C3YPRSFdm7ZQ6k2PU5mK5HC4MibBr IWaSY84kZavFgrKKA6wfRlZT4B9DmPMJBENNCLa6psOQu+I6bvskqMD3p28BHslagRuo PkQ6q3aF5JwIwCVKzKhuzu9juU6va04dkHKE3bXZocaVZavcqySm+h/A4Z3xG4gQN/2L 8xvte+FZL7v76obWiVCg6/iEnKKVtDXrmIWrZMvDgOdMLd1Zq/K0tuAZtVZfcFWnTyae gcobYHk1ToTAO1Xtg38XIOeeQ/aCP5NrK9w76f+ulqgipiP6MyixiNJEvMDZXY+0dwDu tQjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697026389; x=1697631189; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5t6GIee90pO3Wbr53RuwASc/+xC7LgMcWfutPVzZ424=; b=Vf4D7K8fCb7uTrMgGB3FUiRaQ24Hnq3F3vklvfHwfBNaCcsSRneZv60//4kb4s7BF/ 8DFsauEBPp5witW0f6+7MakEwJ29HB3L7gPRDXcipktC0ZRO5ze7ydfiz9AnVLZXVcBp pcTyOjGTBcVLQ6GyAyT1kXZ0FfW51rirWmTWDs/Za0Nhmnm78m9BZh6vGSwN90Lg8UnU Y0/IFtut30umbrm84rgAH835lEp3f6FNNv8v5NbX4gCGq0Jl1HFun6l4DWBz1WFSIzem 8YqSX4KRptBkjbYTcIBLjEEngoO6hohGYENrl8B1urDd3G1Yi6Kpqob35mAo2t+wjWSY 6mRQ== X-Gm-Message-State: AOJu0YxnpW/S0yIeeiLYAjuqiXF0Y8JgP9QaAgMa8Vt5RZtGhKrZuGWI wzpv0o5opBfhYxXhoKb+AD9fnK78E6OQ70VMNA9K51ql+aNHCA== X-Google-Smtp-Source: AGHT+IGwkIUqFYmsCoWtVON4qkyDe6/1lO9UtwI6jsPoZK5/4BZMj3Z8lCIV25eDdADVaXkLcPzcFoa4908H X-Received: by 2002:a05:6512:3a83:b0:503:2deb:bbc1 with SMTP id q3-20020a0565123a8300b005032debbbc1mr20886665lfu.22.1697026388396; Wed, 11 Oct 2023 05:13:08 -0700 (PDT) Received: from pop-os.. (cpc91242-cmbg18-2-0-cust972.5-4.cable.virginm.net. [82.8.131.205]) by smtp-relay.gmail.com with ESMTPS id x6-20020a170906134600b009b9720a85dcsm1582049ejb.44.2023.10.11.05.13.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 05:13:08 -0700 (PDT) X-Relaying-Domain: gadgetoid.com From: Phil Howard To: Linus Walleij , Andy Shevchenko , Kent Gibson , Bartosz Golaszewski Cc: linux-gpio@vger.kernel.org, Phil Howard Subject: [libgpiod][PATCH 2/3] bindings: python: add pyproject.toml, pep 518 Date: Wed, 11 Oct 2023 13:12:45 +0100 Message-Id: <20231011121246.9467-3-phil@gadgetoid.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011121246.9467-1-phil@gadgetoid.com> References: <20231011121246.9467-1-phil@gadgetoid.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Add pyproject.toml to prevent spurious deprecation warnings from pip. Signed-off-by: Phil Howard --- bindings/python/pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 bindings/python/pyproject.toml diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml new file mode 100644 index 0000000..d1e6ae6 --- /dev/null +++ b/bindings/python/pyproject.toml @@ -0,0 +1,2 @@ +[build-system] +requires = ["setuptools", "wheel"] From patchwork Wed Oct 11 12:12:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Howard X-Patchwork-Id: 732238 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0091BCD6E61 for ; Wed, 11 Oct 2023 12:14:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346779AbjJKMO6 (ORCPT ); Wed, 11 Oct 2023 08:14:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346755AbjJKMOv (ORCPT ); Wed, 11 Oct 2023 08:14:51 -0400 Received: from mail-ej1-x661.google.com (mail-ej1-x661.google.com [IPv6:2a00:1450:4864:20::661]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40E5744BF for ; Wed, 11 Oct 2023 05:13:14 -0700 (PDT) Received: by mail-ej1-x661.google.com with SMTP id a640c23a62f3a-9ae2cc4d17eso1210243766b.1 for ; Wed, 11 Oct 2023 05:13:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gadgetoid.com; s=google; t=1697026389; x=1697631189; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VRjotP9QoGWnwkXudYzS47Q00KaDX7My9mJg0lPIxUk=; b=HzVTcZqTakEDiAdIxxbAJ823K73ek0hnE3Hf1VfdZHHt5WBm/oqNg3G/f+C3Ahg56H 9fTZJAu/skFobUlzEWeNaqh7U6uwOgBf9GVCkJTMgMXdRlCstJBOSB+oVNHNDpCt2aqD ZOZMivrmxuxi2Fn5MviqXvOsFy5jomlBgseuIMZTb/DIkLravUOWHzBuiJlfv2j2pU7x 1QuzS2gT+EDbAw+1AajnV1pzwB1iHVjcWgAspvHi3tKpfoT3ZO904koJ4A8PmjdoBEWD 7PRxB5DVub/3r+L8dpHWG/h1KTdiQdKQ+dAzGXISbxvCi4NhPMMgMM/jVUfnVUhVR0uo 5/dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697026389; x=1697631189; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VRjotP9QoGWnwkXudYzS47Q00KaDX7My9mJg0lPIxUk=; b=BVLrdS3q3AqKqW+ot9GcvU1SYZzLvObt7TSTgrxNeI65EY4k7R52G0ZXeNzREjeDi3 rKP9VMn5iDULJjjuiGMonmRKer/QkuY091gRoGm4znIe80d356l3EKqQyltuARrS2j5j 2kH+vQXsSOjm8Bxi6lC4rv3zejAYFyBjCPl7W5wq5HKVAHMdd75CPmwzPsSRh0DZ/ZaH Fxkx7xzyB+p3w/iALqC4CDY7necRYC3HDFev8jb9R4Q6EsK21WG0i6nnvjrG3LrGhEm6 DAKd6FR+KSEnQxYNHUjj4MlYSMUvarvUYhpLjNe9D4lsKvJNZWSG7HpADby1pVrIu9/C d78A== X-Gm-Message-State: AOJu0YzPgyGCOPGyf7ctAvdhI0bcwUjyx+KrzeNcrDiA49Z5Z5gX2dgy SqCtywOIWH/BFZbloCqoKFD/zHdcMCaXHwtnWlQcH4WOYyQ/8Q== X-Google-Smtp-Source: AGHT+IE59mRYsF1f91YS9q1O4IsAAVWocqH8poX9opeDpNbvLkpWq1kCF78rWo5I0PnZXqx8EVcNDmJRtDYc X-Received: by 2002:a17:906:308c:b0:9ae:829e:d930 with SMTP id 12-20020a170906308c00b009ae829ed930mr19849758ejv.9.1697026389204; Wed, 11 Oct 2023 05:13:09 -0700 (PDT) Received: from pop-os.. (cpc91242-cmbg18-2-0-cust972.5-4.cable.virginm.net. [82.8.131.205]) by smtp-relay.gmail.com with ESMTPS id x6-20020a170906134600b009b9720a85dcsm1582049ejb.44.2023.10.11.05.13.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 05:13:09 -0700 (PDT) X-Relaying-Domain: gadgetoid.com From: Phil Howard To: Linus Walleij , Andy Shevchenko , Kent Gibson , Bartosz Golaszewski Cc: linux-gpio@vger.kernel.org, Phil Howard Subject: [libgpiod][PATCH 3/3] bindings: python: require python 3.9.0 Date: Wed, 11 Oct 2023 13:12:46 +0100 Message-Id: <20231011121246.9467-4-phil@gadgetoid.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011121246.9467-1-phil@gadgetoid.com> References: <20231011121246.9467-1-phil@gadgetoid.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Required minimum version for PyModule_AddType helper. Signed-off-by: Phil Howard --- bindings/python/setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/python/setup.py b/bindings/python/setup.py index 2e25981..fbba7ab 100644 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -91,6 +91,7 @@ if "GPIOD_WITH_TESTS" in environ and environ["GPIOD_WITH_TESTS"] == "1": setup( name="libgpiod", packages=find_packages(exclude=["tests", "tests.*"]), + python_requires=">=3.9.0", ext_modules=extensions, cmdclass={"build_ext": build_ext}, version=__version__,