Path: csiph.com!aioe.org!bofh.it!news.nic.it!robomod From: Uwe Steinmann Newsgroups: linux.debian.maint.python Subject: Re: Best practice on how to package a python module along with a c++ program Date: Tue, 12 May 2020 14:20:01 +0200 Message-ID: References: X-Mailbox-Line: From debian-python-request@lists.debian.org Tue May 12 12:16:27 2020 Old-Return-Path: X-Amavis-Spam-Status: No, score=-11.724 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, KHOP_HELO_FCRDNS=0.276, LDO_WHITELIST=-5, PGPSIGNATURE=-5] autolearn=ham autolearn_force=no X-Policyd-Weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 CL_IP_EQ_FROM_MX=-3.1; rate: -4.6 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qL6YN2OI1pnKQLYZ" Content-Disposition: inline X-Mailing-List: archive/latest/18274 List-ID: List-URL: List-Archive: https://lists.debian.org/msgid-search/20200512121542.GZ4188@t560.steinmann.cx Approved: robomod@news.nic.it Lines: 92 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Cc: debian-python@lists.debian.org X-Original-Date: Tue, 12 May 2020 14:15:42 +0200 X-Original-Message-ID: <20200512121542.GZ4188@t560.steinmann.cx> X-Original-References: <20200508105908.GG4188@t560.steinmann.cx> <1982840.YYs7QWACbl@sk-desktop> Xref: csiph.com linux.debian.maint.python:12579 --qL6YN2OI1pnKQLYZ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, May 09, 2020 at 11:50:33AM +0200, Gregor Riepl wrote: > >> I'm packaging a c++ program (horizon-eda) which also contains a > >> python module written in c++. Upstream's Makefile has a target 'pymodu= le' > >> and 'make pymodule' creates horizon.so in the build directory. > >> According to upstream this has to be copied =D1=96nto python's sys.path > > > > The preferred mechanism would be to install the .so file into: > >=20 > > usr/lib/python3.X/dist-packages/ (where X is the python3 version you ar= e=20 > > building with) >=20 > "horizon.so" isn't multi-arch safe, so please ensure it gets a suitable > filename on installation. >=20 > All CPython modules I can find on my system use one of these forms: > /usr/lib/python3/dist-packages/package.cpython-38-x86_64-linux-gnu.so > /usr/lib/python3/dist-packages/package/module.cpython-38-x86_64-linux-gnu= =2Eso > /usr/lib/python3.8/dist-packages/package/module.cpython-38-x86_64-linux-g= nu.so >=20 > I assume this would normally be done by distutils, or is it handled by > dh_python3 automatically? Looks like this is handled by dh_python3. I created a .pyinstall file with just a single line horizon.so 3.8- horizon.so is copied to usr/lib/python3/dist-packages/horizon.cpython-38-x8= 6_64-linux-gnu.so But there is still a problem. horizon.so is actually located in a directory named 'build' and I had to move it out of there to be found by dh_python3. If I leave it in 'build' and change the content of the pyinstall file to=20 build/horizon.so 3.8- then horizon.so will end up in usr/lib/python3/dist-packages/build/ So I tried to set the namespace as documented in the man page of dh_python3 Syntax: path/to/file [VERSION_RANGE] [NAMESPACE] Unfortunately the syntax doesn't quite match the examples in the man page: debian/*.py spam.egg 3.2 I suppose 'spam.egg' is the namespace which should be after the version range. Anyway, neither way works. horizon.so ends up in a subdirectory 'build' Do I need the pyinstall file at all? What other package could I look at, which installs a .so file? Uwe --=20 MMK GmbH, Fleyer Str. 196, 58097 Hagen Uwe.Steinmann@mmk-hagen.de Tel: 02331 840446 Fax: 02331 843920 --qL6YN2OI1pnKQLYZ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE3CvlpjXW3PCUob0wN8K0+GQhOf8FAl66k2oACgkQN8K0+GQh Of/6Zg//STm5MH+TxsHMfUTb3rDheSvW+IUedqSPIz5uGRV7LT/UeEjs4byqvV84 z0u1HbQLwkcnuUpaYKgKvTDUVvdFOlEe4V+sJ02RaSKxbWvXf0M09zC/ksXhR3Qz vGnJjSwqZ9pR5ZibZMsQwO83reqSSu9MYW870/Kgt13PfGafFSZYK11OpHv1TCvG SfbImwy0/6GoJPGyU8i8HlElqKD4KucW14uI3ooWKwZeZ9KFZ2PJzjm1KEJaWuho 1jnj0t6g177OplVt9RpokOsb2sR+twFRMQBhwJL9iUXYGE7V5Z5iC1EFEs2Pv6LP igmqIY2ZpKKmorEybhIAU1keiFSGQUj7lxgTXJAAJzFQU0+jlF/MU/drZx/lLjJI CIgXcV6MjVJ0faYH8sA32OFSVqVka2H522gpPlgJpG5zGcObHjKfKZekvfc+Y+ng 8oNvySu4gKfpLDxOQ1Gszp3O6UPD0P7iawcIrH6WkC4cLDcLm9Ne0o5i+q93g2Ja zf7ZlndCPz98WASxhP2RsX/vbngMEtwQTMSb9sGG6ggChL8XqwVB5YnRIjwxxAgM 7zE4gaWZ2GQto7DvtUU+m5vSMBEjKm4Kncqr7aVNeJHJpYt2mHLmPjLki7ZM7Idj 0lOeWYjZyjWe3ie5Yi7ztE77oD/1brw50mhFDF+BPZIcDj/XM50= =kbvE -----END PGP SIGNATURE----- --qL6YN2OI1pnKQLYZ--