kdeldycke / extra-platforms

Detect platforms and group them by family
https://kdeldycke.github.io/extra-platforms
GNU General Public License v2.0
3 stars 1 forks source link

Multiple platforms match current OS for a debian docker image #72

Closed gsemet closed 1 month ago

gsemet commented 1 month ago

Hello

We are using custom made debian linux image on our Python development environemtn (mainly derivating from the official python images on github), but extras-platforms now raises in the current_os:

RuntimeError: Multiple platforms match current OS: [Platform(id='debian', name='Debian', current=True), Platform(id='unknown_linux', name='Unknown Linux', current=True)]

It is a debian, why does it also matches with the unknown_linux ? And even if two platforms are matching, why not matching the first matching? It kind of breaking all our CI now we updated to a package that depends on extras-platforms...

gsemet commented 1 month ago

Reproduced with

$ sudo docker run -it python:3.10 bash
# from here, we are inside the docker image
$ pip install extra_platforms
$ python
>>> import extra_platforms
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/site-packages/extra_platforms/__init__.py", line 181, in <module>
    CURRENT_OS_ID: str = current_os().id
  File "/usr/local/lib/python3.10/site-packages/extra_platforms/__init__.py", line 168, in current_os
    raise RuntimeError(msg)
RuntimeError: Multiple platforms match current OS: [Platform(id='debian', name='Debian', current=True), Platform(id='unknown_linux', name='Unknown Linux', current=True)]
>>> 
mrevoir commented 1 month ago

I am getting this as well on macOS Sequoia with multiple containers based on Bitnami/Python

Python 3.9.18 (main, Jan 28 2024, 21:40:32) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from extra_platforms import UNIX, current_os
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/bitnami/python/lib/python3.9/site-packages/extra_platforms/__init__.py", line 181, in <module>
    CURRENT_OS_ID: str = current_os().id
  File "/opt/bitnami/python/lib/python3.9/site-packages/extra_platforms/__init__.py", line 168, in current_os
    raise RuntimeError(msg)
RuntimeError: Multiple platforms match current OS: [Platform(id='debian', name='Debian', current=True), Platform(id='unknown_linux', name='Unknown Linux', current=True)]
kdeldycke commented 1 month ago

Thank you all for the feedback! You're right, my heuristics to detect linux distributions are too lax and conflicting. I'll fix that right away.

kdeldycke commented 1 month ago

Issue has been fixed upstream. Give me a bit of more time to cut a release.

kdeldycke commented 1 month ago

extra-platforms 1.3.1 is now available on PyPi: https://pypi.org/project/extra-platforms

mrevoir commented 1 month ago

extra-platforms 1.3.1 is now available on PyPi: https://pypi.org/project/extra-platforms

Thanks for the quick fix!