linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Kent Gibson <warthog618@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Joerg Faschingbauer <jf@faschingbauer.co.at>
Cc: linux-gpio@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [libgpiod][PATCH] Revert "bindings: python: fix out-of-tree build"
Date: Mon, 17 Apr 2023 16:45:07 +0200	[thread overview]
Message-ID: <20230417144507.404968-1-brgl@bgdev.pl> (raw)

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

This reverts commit addf968c7321132a8c659e06cc06c76534ec31f5.

We're moving towards being compatible with PEP 517 for building and
currently the following error happens when running setup.py build_py:

running build_py
error: Error: setup script specifies an absolute path:

    <snip>/libgpiod/bindings/python/./gpiod/ext/chip.c

setup() arguments must *always* be /-separated paths relative to the
setup.py directory, *never* absolute paths.

As the Makefile build should only be used for development purposes, I
think we can safely drop support for out-of-tree build. Python bindings
have no been spun out into their own tarball and are available to install
from pip.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 bindings/python/Makefile.am |  5 +++--
 bindings/python/setup.py    | 23 ++++++++++-------------
 2 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/bindings/python/Makefile.am b/bindings/python/Makefile.am
index 7fed629..d04ec6d 100644
--- a/bindings/python/Makefile.am
+++ b/bindings/python/Makefile.am
@@ -11,12 +11,13 @@ endif
 
 all-local:
 	GPIOD_WITH_TESTS=$(BUILD_TESTS) \
-	$(PYTHON) $(srcdir)/setup.py build_ext --inplace \
+	$(PYTHON) setup.py build_ext --inplace \
 		--include-dirs=$(top_srcdir)/include/:$(top_srcdir)/tests/gpiosim/ \
 		--library-dirs=$(top_builddir)/lib/.libs/:$(top_srcdir)/tests/gpiosim/.libs/
 
 install-exec-local:
-	$(PYTHON) $(srcdir)/setup.py install --prefix=$(DESTDIR)$(prefix)
+	GPIOD_WITH_TESTS= \
+	$(PYTHON) setup.py install --prefix=$(DESTDIR)$(prefix)
 
 SUBDIRS = gpiod
 
diff --git a/bindings/python/setup.py b/bindings/python/setup.py
index 5ddd5e0..a53d55f 100644
--- a/bindings/python/setup.py
+++ b/bindings/python/setup.py
@@ -1,21 +1,18 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 # SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl>
 
-from os import environ, path
+from os import environ
 from setuptools import setup, Extension, find_packages
 
-def src(filename):
-    return path.join(path.dirname(__file__), filename)
-
 gpiod_ext = Extension(
     "gpiod._ext",
     sources=[
-        src("gpiod/ext/chip.c"),
-        src("gpiod/ext/common.c"),
-        src("gpiod/ext/line-config.c"),
-        src("gpiod/ext/line-settings.c"),
-        src("gpiod/ext/module.c"),
-        src("gpiod/ext/request.c"),
+        "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",
     ],
     define_macros=[("_GNU_SOURCE", "1")],
     libraries=["gpiod"],
@@ -24,7 +21,7 @@ gpiod_ext = Extension(
 
 gpiosim_ext = Extension(
     "tests.gpiosim._ext",
-    sources=[src("tests/gpiosim/ext.c")],
+    sources=["tests/gpiosim/ext.c"],
     define_macros=[("_GNU_SOURCE", "1")],
     libraries=["gpiosim"],
     extra_compile_args=["-Wall", "-Wextra"],
@@ -32,7 +29,7 @@ gpiosim_ext = Extension(
 
 procname_ext = Extension(
     "tests.procname._ext",
-    sources=[src("tests/procname/ext.c")],
+    sources=["tests/procname/ext.c"],
     define_macros=[("_GNU_SOURCE", "1")],
     extra_compile_args=["-Wall", "-Wextra"],
 )
@@ -42,7 +39,7 @@ if "GPIOD_WITH_TESTS" in environ and environ["GPIOD_WITH_TESTS"] == "1":
     extensions.append(gpiosim_ext)
     extensions.append(procname_ext)
 
-with open(src("gpiod/version.py"), "r") as fd:
+with open("gpiod/version.py", "r") as fd:
     exec(fd.read())
 
 setup(
-- 
2.37.2


                 reply	other threads:[~2023-04-17 14:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230417144507.404968-1-brgl@bgdev.pl \
    --to=brgl@bgdev.pl \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=jf@faschingbauer.co.at \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=warthog618@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).