I have been trying to modernize Linux GPIB Support / git / [0fc6e3] /linux-gpib-user/language/python to pyproject.toml with setuptools as build backend. However, it fails to build since it expects a header that is above the project root:
{ /usr/bin/python3 -m build && touch build; } || { rm -f -r build; exit 1; }
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools)
* Getting build dependencies for sdist...
/tmp/build-env-a11cqjed/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py:72: _ExperimentalConfiguration: `[tool.setuptools.ext-modules]` in `pyproject.toml` is still *experimental* and likely to change in future releases.
config = read_configuration(filepath, True, ignore_option_errors, dist)
running egg_info
creating gpib.egg-info
writing gpib.egg-info/PKG-INFO
writing dependency_links to gpib.egg-info/dependency_links.txt
writing top-level names to gpib.egg-info/top_level.txt
writing manifest file 'gpib.egg-info/SOURCES.txt'
reading manifest file 'gpib.egg-info/SOURCES.txt'
writing manifest file 'gpib.egg-info/SOURCES.txt'
* Building sdist...
/tmp/build-env-a11cqjed/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py:72: _ExperimentalConfiguration: `[tool.setuptools.ext-modules]` in `pyproject.toml` is still *experimental* and likely to change in future releases.
config = read_configuration(filepath, True, ignore_option_errors, dist)
running sdist
running egg_info
writing gpib.egg-info/PKG-INFO
writing dependency_links to gpib.egg-info/dependency_links.txt
writing top-level names to gpib.egg-info/top_level.txt
reading manifest file 'gpib.egg-info/SOURCES.txt'
writing manifest file 'gpib.egg-info/SOURCES.txt'
running check
creating gpib-1.0
creating gpib-1.0/gpib.egg-info
copying files to gpib-1.0...
copying Gpib.py -> gpib-1.0
copying README -> gpib-1.0
copying gpibinter.c -> gpib-1.0
copying pyproject.toml -> gpib-1.0
copying gpib.egg-info/PKG-INFO -> gpib-1.0/gpib.egg-info
copying gpib.egg-info/SOURCES.txt -> gpib-1.0/gpib.egg-info
copying gpib.egg-info/dependency_links.txt -> gpib-1.0/gpib.egg-info
copying gpib.egg-info/top_level.txt -> gpib-1.0/gpib.egg-info
copying gpib.egg-info/SOURCES.txt -> gpib-1.0/gpib.egg-info
Writing gpib-1.0/setup.cfg
Creating tar archive
removing 'gpib-1.0' (and everything under it)
* Building wheel from sdist
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools)
* Getting build dependencies for wheel...
/tmp/build-env-fv8woooz/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py:72: _ExperimentalConfiguration: `[tool.setuptools.ext-modules]` in `pyproject.toml` is still *experimental* and likely to change in future releases.
config = read_configuration(filepath, True, ignore_option_errors, dist)
running egg_info
writing gpib.egg-info/PKG-INFO
writing dependency_links to gpib.egg-info/dependency_links.txt
writing top-level names to gpib.egg-info/top_level.txt
reading manifest file 'gpib.egg-info/SOURCES.txt'
writing manifest file 'gpib.egg-info/SOURCES.txt'
* Building wheel...
/tmp/build-env-fv8woooz/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py:72: _ExperimentalConfiguration: `[tool.setuptools.ext-modules]` in `pyproject.toml` is still *experimental* and likely to change in future releases.
config = read_configuration(filepath, True, ignore_option_errors, dist)
running bdist_wheel
running build
running build_py
creating build/lib.linux-x86_64-cpython-312
copying Gpib.py -> build/lib.linux-x86_64-cpython-312
running egg_info
writing gpib.egg-info/PKG-INFO
writing dependency_links to gpib.egg-info/dependency_links.txt
writing top-level names to gpib.egg-info/top_level.txt
reading manifest file 'gpib.egg-info/SOURCES.txt'
writing manifest file 'gpib.egg-info/SOURCES.txt'
running build_ext
building 'gpib' extension
creating build/temp.linux-x86_64-cpython-312
x86_64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/tmp/build-env-fv8woooz/include -I/usr/include/python3.12 -c gpibinter.c -o build/temp.linux-x86_64-cpython-312/gpibinter.o
gpibinter.c:12:10: fatal error: gpib/ib.h: Datei oder Verzeichnis nicht gefunden
12 | #include <gpib/ib.h>
| ^~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
ERROR Backend subprocess exited when trying to invoke build_wheel
make: [Makefile:496: build] Fehler 1 (ignoriert)
Is there a way I can point it to this header ? I searched far and wide and consulted the docs but I couldn’t find any way to do this.
This is my patch to switch to pyproject.toml:
commit 20e3bc6425960fc4d38eece1efd193a54e00dbd8
Author: Matthias Geiger <werdahias@debian.org>
Date: Fri Aug 8 16:45:20 2025 +0200
Switch build to pyproject.toml
diff --git a/linux-gpib-user/language/python/Makefile.am b/linux-gpib-user/language/python/Makefile.am
index 758f3aac..dbed010b 100644
--- a/linux-gpib-user/language/python/Makefile.am
+++ b/linux-gpib-user/language/python/Makefile.am
@@ -7,12 +7,12 @@
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-EXTRA_DIST = gpibtest.py setup.py Gpib.py gpibinter.c srq_board.py srq_device.py
+EXTRA_DIST = gpibtest.py Gpib.py gpibinter.c srq_board.py srq_device.py
all-local: build
build: gpibinter.c
- -{ $(PYTHON) setup.py build && touch build; } || { $(RM) -r build; exit 1; }
+ -{ $(PYTHON) -m build && touch build; } || { $(RM) -r build; exit 1; }
install-data-local:
-$(PYTHON) -m pip install . --prefix=$(DESTDIR)$(prefix) --root-user-action=ignore
diff --git a/linux-gpib-user/language/python/pyproject.toml b/linux-gpib-user/language/python/pyproject.toml
new file mode 100644
index 00000000..7dcd576b
--- /dev/null
+++ b/linux-gpib-user/language/python/pyproject.toml
@@ -0,0 +1,16 @@
+[build-system]
+requires = ["setuptools>=61"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "gpib"
+version = "1.0"
+description = "Linux GPIB Python Bindings"
+
+[tool.setuptools]
+py-modules = ["Gpib"]
+ext-modules = [
+{name = "gpib", sources = ["gpibinter.c"], include-dirs = ["lib"], py-limited-api = true}
+]
+
diff --git a/linux-gpib-user/language/python/setup.py b/linux-gpib-user/language/python/setup.py
deleted file mode 100644
index 7df5d175..00000000
--- a/linux-gpib-user/language/python/setup.py
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/env python
-import sys
-if sys.version_info < (3,10):
- from distutils.core import setup,Extension
-else:
- from setuptools import setup, Extension
-setup(name="gpib",
- version="1.0",
- description="Linux GPIB Python Bindings",
- py_modules = ['Gpib'],
- ext_modules=[
- Extension("gpib",
- ["gpibinter.c"],
- include_dirs=["../../include"],
- library_dirs = ['../../lib/.libs'],
- libraries=["gpib", "pthread"]
- )]
-)
Python version: 3.12
OS: Ubuntu 24.04
Worst case I’d just symlink something, but I’d rather have a cleaner solution.