Re: Python bindings
dave penkler <[email protected]> Tue, 30 Sep 2025 14:54:26 +0200
| Newsgroups | gmane.linux.hardware.gpib.general |
|---|---|
| Message-ID | <CAL=kjP3jvXL8LLJ-AbD=EoZEPMwX3qmEVGXqZeNYc305_pGdgw@mail.gmail.com> |
--===============0350906050231795195==
Content-Type: multipart/alternative; boundary="000000000000271866064004415a"
--000000000000271866064004415a
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
After applying your patch I get:
Making all in python
make[3]: Entering directory
'/home/dave/src/linux-gpib-git/linux-gpib-user/language/python'
{ /usr/bin/python -m build && touch build; } || { rm -f -r build; exit 1; }
/usr/bin/python: No module named build.__main__; 'build' is a package and
cannot be directly executed
make[3]: [Makefile:501: build] Error 1 (ignored)
make[3]: Leaving directory
'/home/dave/src/linux-gpib-git/linux-gpib-user/language/python
without your patch I get:
Making all in python
make[3]: Entering directory
'/home/dave/src/linux-gpib-git/linux-gpib-user/language/python'
{ /usr/bin/python setup.py build && touch build; } || { rm -f -r build;
exit 1; }
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
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'
running build_ext
building 'gpib' extension
creating build/temp.linux-x86_64-cpython-312
gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC
-I../../include -I/usr/include/python3.12 -c gpibinter.c -o
build/temp.linux-x86_64-cpython-312/gpibinter.o
gcc -shared build/temp.linux-x86_64-cpython-312/gpibinter.o
-L../../lib/.libs -L/usr/lib64 -lgpib -lpthread -o
build/lib.linux-x86_64-cpython-312/gpib.cpython-312-x86_64-linux-gnu.so
make[3]: Leaving directory
'/home/dave/src/linux-gpib-git/linux-gpib-user/language/python'
cheers,
-dave
On Tue, 30 Sept 2025 at 11:34, Matthias Geiger <[email protected]> wrote:
> Hi,
>
> I am finalizing my packaging of the userspace tools for Debian. The
> major blocker to get this uploaded are the python bindings.
> I ran into the following issues:
> - The install path is hardcoded to
> /usr/local/lib/python3.12/dist-packages; this should be
> /usr/lib/$(pythonversion)/distpackages
> - setuptools is deprecated:
>
> running install
> /usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py:66:
> SetuptoolsDeprecationWarning: setup.py install is deprecated.
> !!
>
>
> *************************************************************************=
*******
> Please avoid running ``setup.py`` directly.
> Instead, use pypa/build, pypa/installer or other
> standards-based tools.
>
> See
> https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for
> details.
>
> *************************************************************************=
*******
>
> !!
>
> Attached you can find a patch that converts the userspace tools to use
> pyproject.toml. This does not work (yet), since
> pyproject can't deal with a header that is not in the same directory as
> the project root:
> https://discuss.python.org/t/include-header-above-project-root/102221/3
> None of the solutions for this are nice; IMO the best would be to
> symlink/copy Gpib.h to the language/python subdirectory.
> Alternatively, the whole build process could be implemented in make,
> however that is not ideal and I'd like to avoid that.
> I'd like to ask for guidance what the project prefers; the current
> setuptools approach will break sooner or later (it's already deprecated).
>
> --
> Freundliche Gr=C3=BCsse / Best regards
>
> Matthias Geiger
> __________________________________________________________________
> Matthias Geiger
> Werkstudent
> Forschung & Entwicklung/Research & Development
>
> Phone : +49-6441-609-3004
> Email : [email protected]
> URL : www.wiwa.de
>
> WIWA Wilhelm Wagner GmbH & Co. KG
> Gewerbestrasse 1-3, 35633 Lahnau, Germany
> Besucheranschrift/visitor address:
> Georg-Ohm-Strasse 12, 35633 Lahnau, Germany
>
> AG WETZLAR HRA 3223, Komplement=C3=A4r : Wagner GmbH (AG Wetzlar HRB 363)
> UST-ID Nr: / VAT-No: DE113745802
> Gesch=C3=A4ftsf=C3=BChrer: Dipl.-Ing. (FH) Peter Turczak, Dipl.-Wirt.-Ing=
. Malte
> Weber
> _______________________________________________
> Linux-gpib-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linux-gpib-general
>
--000000000000271866064004415a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">After applying your patch I get:<div><font face=3D"monospa=
ce"><br></font></div><div><font face=3D"monospace">Making all in python</fo=
nt></div><font face=3D"monospace">make[3]: Entering directory '/home/da=
ve/src/linux-gpib-git/linux-gpib-user/language/python'<br>{ /usr/bin/py=
thon -m build && touch build; } || { rm -f -r build; exit 1; }<br>/=
usr/bin/python: No module named build.__main__; 'build' is a packag=
e and cannot be directly executed<br>make[3]: [Makefile:501: build] Error 1=
(ignored)<br>make[3]: Leaving directory '/home/dave/src/linux-gpib-git=
/linux-gpib-user/language/python</font><br><div><font face=3D"monospace"><b=
r></font></div><div><font face=3D"arial, sans-serif">without=C2=A0your patc=
h I get:</font></div><div><font face=3D"arial, sans-serif"><br></font></div=
><div>Making all in python<br>make[3]: Entering directory '/home/dave/s=
rc/linux-gpib-git/linux-gpib-user/language/python'<br>{ /usr/bin/python=
setup.py build && touch build; } || { rm -f -r build; exit 1; }<br=
>running build<br>running build_py<br>creating build/lib.linux-x86_64-cpyth=
on-312<br>copying Gpib.py -> build/lib.linux-x86_64-cpython-312<br>runni=
ng egg_info<br>creating gpib.egg-info<br>writing gpib.egg-info/PKG-INFO<br>=
writing dependency_links to gpib.egg-info/dependency_links.txt<br>writing t=
op-level names to gpib.egg-info/top_level.txt<br>writing manifest file '=
;gpib.egg-info/SOURCES.txt'<br>reading manifest file 'gpib.egg-info=
/SOURCES.txt'<br>writing manifest file 'gpib.egg-info/SOURCES.txt&#=
39;<br>running build_ext<br>building 'gpib' extension<br>creating b=
uild/temp.linux-x86_64-cpython-312<br>gcc -fno-strict-overflow -Wsign-compa=
re -DNDEBUG -g -O3 -Wall -fPIC -I../../include -I/usr/include/python3.12 -c=
gpibinter.c -o build/temp.linux-x86_64-cpython-312/gpibinter.o<br>gcc -sha=
red build/temp.linux-x86_64-cpython-312/gpibinter.o -L../../lib/.libs -L/us=
r/lib64 -lgpib -lpthread -o build/lib.linux-x86_64-cpython-312/<a href=3D"h=
ttp://gpib.cpython-312-x86_64-linux-gnu.so">gpib.cpython-312-x86_64-linux-g=
nu.so</a><br>make[3]: Leaving directory '/home/dave/src/linux-gpib-git/=
linux-gpib-user/language/python'<br></div><div><br></div><div><font fac=
e=3D"arial, sans-serif">cheers,</font></div><div><font face=3D"arial, sans-=
serif">-dave</font></div></div><br><div class=3D"gmail_quote gmail_quote_co=
ntainer"><div dir=3D"ltr" class=3D"gmail_attr">On Tue, 30 Sept 2025 at 11:3=
4, Matthias Geiger <<a href=3D"mailto:[email protected]">[email protected]=
</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:=
0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">=
Hi,<br>
<br>
I am finalizing my packaging of the userspace tools for Debian. The <br>
major blocker to get this uploaded are the python bindings.<br>
I ran into the following issues:<br>
- The install path is hardcoded to <br>
/usr/local/lib/python3.12/dist-packages; this should be <br>
/usr/lib/$(pythonversion)/distpackages<br>
- setuptools is deprecated:<br>
<br>
running install<br>
/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py:66: <br>
SetuptoolsDeprecationWarning: setup.py install is deprecated.<br>
!!<br>
<br>
***************************************************************************=
*****<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Please avoid running ``set=
up.py`` directly.<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Instead, use pypa/build, p=
ypa/installer or other<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 standards-based tools.<br>
<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 See <br>
<a href=3D"https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.htm=
l" rel=3D"noreferrer" target=3D"_blank">https://blog.ganssle.io/articles/20=
21/10/setup-py-deprecated.html</a> for <br>
details.<br>
***************************************************************************=
*****<br>
<br>
!!<br>
<br>
Attached you can find a patch that converts the userspace tools to use <br>
pyproject.toml. This does not work (yet), since<br>
pyproject can't deal with a header that is not in the same directory as=
<br>
the project root:<br>
<a href=3D"https://discuss.python.org/t/include-header-above-project-root/1=
02221/3" rel=3D"noreferrer" target=3D"_blank">https://discuss.python.org/t/=
include-header-above-project-root/102221/3</a><br>
None of the solutions for this are nice; IMO the best would be to <br>
symlink/copy Gpib.h to the language/python subdirectory.<br>
Alternatively, the whole build process could be implemented in make, <br>
however that is not ideal and I'd like to avoid that.<br>
I'd like to ask for guidance what the project prefers; the current <br>
setuptools approach will break sooner or later (it's already deprecated=
).<br>
<br>
-- <br>
Freundliche Gr=C3=BCsse / Best regards<br>
<br>
Matthias Geiger<br>
__________________________________________________________________<br>
Matthias Geiger<br>
Werkstudent<br>
Forschung & Entwicklung/Research & Development<br>
<br>
Phone : +49-6441-609-3004<br>
Email : <a href=3D"mailto:[email protected]" target=3D"_blank">m_geiger@wiwa=
.de</a><br>
URL=C2=A0 =C2=A0: <a href=3D"http://www.wiwa.de" rel=3D"noreferrer" target=
=3D"_blank">www.wiwa.de</a><br>
<br>
WIWA Wilhelm Wagner GmbH & Co. KG<br>
Gewerbestrasse 1-3, 35633 Lahnau, Germany<br>
Besucheranschrift/visitor address:<br>
Georg-Ohm-Strasse 12, 35633 Lahnau, Germany<br>
<br>
AG WETZLAR HRA 3223, Komplement=C3=A4r : Wagner GmbH (AG Wetzlar HRB 363)<b=
r>
UST-ID Nr: / VAT-No: DE113745802<br>
Gesch=C3=A4ftsf=C3=BChrer: Dipl.-Ing. (FH) Peter Turczak, Dipl.-Wirt.-Ing. =
Malte Weber<br>
_______________________________________________<br>
Linux-gpib-general mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blan=
k">[email protected]</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/linux-gpib-general"=
rel=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/l=
istinfo/linux-gpib-general</a><br>
</blockquote></div>
--000000000000271866064004415a--
--===============0350906050231795195==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--===============0350906050231795195==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Linux-gpib-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-gpib-general
--===============0350906050231795195==--