Re: Packaging optional, arch-dependent, pre-built libraries
Filipe LaĆns <[email protected]> Wed, 14 Apr 2021 13:59:00 +0100
| Newsgroups | gmane.comp.python.distutils.devel |
|---|---|
| Organization | Archlinux |
| Message-ID | <[email protected]> |
--===============0449254842417660013== Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-b0fFafz9G8Jdnoh62RO3" --=-b0fFafz9G8Jdnoh62RO3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, 2021-04-11 at 00:59 +0000, Vincent Pelletier wrote: > Hello, >=20 > On Tue, 6 Apr 2021 00:17:32 +0800, Tzu-ping Chung <[email protected]> wr= ote: > > If a file is not built or linked against, a dll in your wheel is essent= ially > > a plain data file from Python packaging=E2=80=99s perspective, no diffe= rent from > > e.g. a text file. >=20 > Thanks, I somehow did not get this until I saw it spelled out. >=20 > There seems to be one catch, though: once I list the dll in > package_data, it gets copied over to build/lib*, and the same dll gets > used for all distributions, so if I build the win32 wheel first: > - plat=3Dwin_amd64 gets a 32bits dll > - plat=3Dany gets a windows 32bits dll > so I now have to clean --all between each. >=20 > For a text file it could make no difference (although there are the EOL > shenanigans which would arguably be platform-specific). So while I now > agree the dll should be treated by my setup.py as a "plain data file", > there is this annoying extra complication layer. >=20 > > I believe the issue PyInstaller has with your package is that, since > > PyInstaller compiles a program into an executable, > > ctypes.util.find_library() won=E2=80=99t work (since there is no actual= dll to > > find). If you know for sure the dll will be available, you can copy the > > binary to a temporary location (the =E2=80=9Cofficial=E2=80=9D way to d= o this is through > > importlib.resources.path[1]), and use the path to load the dll directly > > instead. >=20 > Thanks for the pointer, I would love to use it. Unfortunately, this > fails to install on 2.7: > with > =C2=A0=C2=A0=C2=A0 install_requires=3D( > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "importlib_resources<=3D4.0.0;= python_version<'3.0'", > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "importlib_resources;python_ve= rsion>=3D'3.0' and python_version<'3.7'", > =C2=A0=C2=A0=C2=A0 ), > I get > =C2=A0 $ ./vpy2/bin/python setup.py install > =C2=A0 [...] > =C2=A0 Installed /home/vincent/git/python-libusb1/vpy2/lib/python2.7/site= - > packages/libusb1-1.9.2+4.g5aeb636.dirty-py2.7.egg > =C2=A0 Processing dependencies for libusb1=3D=3D1.9.2+4.g5aeb636.dirty > =C2=A0 Searching for zipp>=3D0.4 > =C2=A0 Reading https://pypi.org/simple/zipp/ > =C2=A0 Downloading=20 > https://files.pythonhosted.org/packages/38/f9/4fa6df2753ded1bcc1ce2fdd804= 6f78bd240ff7647f5c9bcf547c0df77e3/zipp-3.4.1.tar.gz#sha256=3D3607921face881= ba3e026887d8150cca609d517579abe052ac81fc5aeffdbd76 > =C2=A0 Best match: zipp 3.4.1 > =C2=A0 Processing zipp-3.4.1.tar.gz > =C2=A0 Writing /tmp/easy_install-ZDtgKM/zipp-3.4.1/setup.cfg > =C2=A0 Running zipp-3.4.1/setup.py -q bdist_egg --dist-dir /tmp/easy_inst= all- > ZDtgKM/zipp-3.4.1/egg-dist-tmp-GmefKD > =C2=A0 DEPRECATION: Python 2.7 reached the end of its life on January 1st= , 2020. > Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.= 0 > will drop support for Python 2.7 in January 2021. More details about Pyth= on 2 > support in pip can be found at=20 > https://pip.pypa.io/en/latest/development/release-process/#python-2-suppo= rt=C2=A0pi > p 21.0 will remove support for this functionality. > =C2=A0 DEPRECATION: Python 2.7 reached the end of its life on January 1st= , 2020. > Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.= 0 > will drop support for Python 2.7 in January 2021. More details about Pyth= on 2 > support in pip can be found at=20 > https://pip.pypa.io/en/latest/development/release-process/#python-2-suppo= rt=C2=A0pi > p 21.0 will remove support for this functionality. > =C2=A0 error: find_namespace: directive is unsupported on Python < 3.3 >=20 > The contributor who requested pyinstaller support somehow got this to > work with my archaic and unfortunately very zip-hostile > =C2=A0 os.path.join(dirname(__file__), 'libusb-1.0.dll') > so I will be continuing with this until I finally drop 2.7 support. >=20 > Regards, > --=20 > Vincent Pelletier > GPG fingerprint 983A E8B7 3B91 1598 7A92 3845 CAC9 3691 4257 B0C1 > -- > Distutils-SIG mailing list -- [email protected] > To unsubscribe send an email to [email protected] > https://mail.python.org/mailman3/lists/distutils-sig.python.org/ > Message archived at=20 > https://mail.python.org/archives/list/[email protected]/message/QG= ADIRT27SW7B3WXTI4X2VB5EC6EYHUE/ Can you share in more detail how find_namespace is being used? Python 2.7 d= oes not support namespace packages, I'd say you probably don't really to use th= em anyway, putting a __init__.py in the target package folder and using the fi= nd directive instead should solve the issue. Cheers, Filipe La=C3=ADns --=-b0fFafz9G8Jdnoh62RO3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE0jW0leqs33gyftiw+JPGdIFqqV0FAmB25w4ACgkQ+JPGdIFq qV3bRw//Q6vPECPvU7HDVAuJYFC7AttY0cFZS8YiqLzDya1fZAQt/kU8n3slZZp0 O27i99RnxRVFTi1yrv9q4jBym+CZnT4jT0XbOVEUAu0HQBs+i8LozV2XAKpl+aLc aGUpd7YTzFFpWcRf5fpWdWdJk+Z6J0wjl8yPP4eUC3YgtESXpeCt9kfxBuARzyTy xBLmo9Q6LsW+BCEZ3ZGQsMMIrN73nmMJtqXlWqrGUYXodNFm3Q2Xs935ao1DzGCL IE0UR3nmrQRvKYSh9lshFTIbLQykMXxur/aoMVOBkoRS0bUwMfPKFcR1sgj2rU4g X83Xc4aqoLiRi4SRuO4sM2FlqTq+eFAYvuFdEoiIHm1xefFOaLm8+lMePdq1quVD UhynuYtCwa63C5TBhZxGEuFsCsnh3PS0eW2fymESnmq/nNZtvjmHK5NUDX4dfPB+ /stWmBrFqDzhiTqR4ZqPnnn6Bl/tpHo0RAJCJ3b3jIDZ9u3pdBtPkI+/gbOg8oMN +svRaTsHZD66nxC77JHkew5FVcbhRcHQGPKXTR8ZaVin2JfDx+tI+IR7PVrT0BTE RB321NPjBMDMR6JwJLmmQgkDx1/erq6pMp2s698O6I+tj4npZwvWUeI3ciLnw09d tzt6ipejDWFb3WZcmK048HJcWH3Ca7wetxgO72B6tvwCcXEsXBU= =32gn -----END PGP SIGNATURE----- --=-b0fFafz9G8Jdnoh62RO3-- --===============0449254842417660013== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- Distutils-SIG mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/distutils-sig.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/FQXAR63ZQMCBKGP7EIRATSSVWWE7W6DT/ --===============0449254842417660013==--