Impossible to get arch Python native package compiled with via Wheel API

Bug #2015657 reported by Botan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pkginfo
Confirmed
Undecided
Unassigned

Bug Description

pkginfo 1.9.6
Debian 11
python 3.9
pip 23.0.1

I need to get architecture of a not yet installed native Python package.
I have only *.whl file for this package (arbitrary).
I can't find any way to get architecture from metadata.

Example (python-ldap choosen randomly, but it has native code):

Do:
python3 -m pip download --no-clean --no-deps --no-binary :all: -d . -i https://pypi.python.org/simple python-ldap
tar -zxf ./python-ldap-3.4.3.tar.gz -C .
cd python-ldap-3.4.3/
python3 -m pip wheel . --python python3 --wheel-dir ../fpm-wheel --no-input --disable-pip-version-check --no-python-version-warning --exists-action w --no-cache-dir --progress-bar off --no-deps --use-pep517 --check-build-dependencies

Then in python3 console:

from pkginfo import Wheel
wf = Wheel("python_ldap-3.4.3-cp39-cp39-linux_x86_64.whl")
for key in iter(wf):
   print(key, '=', getattr(wf, key))

You;ll get something like this:
>>> for key in iter(wf):
... print(key, '=', getattr(wf, key))
...
metadata_version = 2.1
name = python-ldap
version = 3.4.3
platforms = ()
supported_platforms = ()
summary = Python modules for implementing LDAP clients
description = python-ldap:
......
keywords = None
home_page = https://www.python-ldap.org/
author = python-ldap project
author_email = <email address hidden>
license = Python style
classifiers = [.......]
download_url = https://pypi.org/project/python-ldap/
requires = ()
provides = ()
obsoletes = ()
maintainer = None
maintainer_email = None
requires_python = >=3.6
requires_external = ()
requires_dist = ['pyasn1 (>=0.3.7)', 'pyasn1-modules (>=0.1.5)']
provides_dist = ()
obsoletes_dist = ()
project_urls = ()
provides_extras = ()
description_content_type = None

And there is no architecture...

Previously, on pre-project.toml era, it was possible to get required data via distutils with something like this:

self.distribution.has_ext_modules() or self.distribution.has_c_libraries()

(https://github.com/microsoft/botbuilder-python/blob/main/libraries/botframework-connector/azure_bdist_wheel.py#L151)

Now, when almost all popular packages use project.toml instead of setup.py, is it possible to get package architecture (or just to tell if it native or pure) by looking on it's *.whl file?

Revision history for this message
Botan (amdei) wrote :

BTW: required information IS available in result *.whl:

python_ldap-3.4.3.dist-info/WHEEL:

Wheel-Version: 1.0
Generator: bdist_wheel (0.40.0)
Root-Is-Purelib: false
Tag: cp39-cp39-linux_x86_64

Root-Is-Purelib: false is what is needed.
Is it possible to get it from code, not by eyeballing?

Revision history for this message
Tres Seaver (tseaver) wrote :

I can confirm this as a feature request. At present, 'pkginfo' exposes *nothing* from the 'WHEEL' file: is uses only the 'METADATA' file. I don't really have any obvious implementation in mind, though.

Changed in pkginfo:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.