Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix distro identification #74

Merged
merged 1 commit into from
Sep 12, 2021

Conversation

xfgusta
Copy link
Contributor

@xfgusta xfgusta commented Sep 11, 2021

The NAME field will be "Fedora Linux" instead of "Fedora" on Fedora Linux 35. The NAME field is not suitable for processing by scripts.

This field is meant for display use. The field ID is meant for scripted use, and will remain fedora. Please check your scripts to make sure they are using the proper field.

image

@gridhead gridhead self-requested a review September 12, 2021 15:27
@gridhead
Copy link
Owner

@xfgusta, thanks for your pull request!

@thunderbirdtr, could you please take this for a spin and review this PR?

@gridhead
Copy link
Owner

LGTM from my end.

[t0xic0der@fedorable Projects]$ mkdir test
[t0xic0der@fedorable Projects]$ lc
bash: lc: command not found...
Similar command is: 'ls'
[t0xic0der@fedorable Projects]$ cd test
[t0xic0der@fedorable test]$ virtualenv venv
created virtual environment CPython3.9.7.final.0-64 in 209ms
  creator CPython3Posix(dest=/home/t0xic0der/Projects/test/venv, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(extra_search_dir=/usr/share/python-wheels,download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/t0xic0der/.local/share/virtualenv)
    added seed packages: pip==21.2.4, setuptools==57.4.0, wheel==0.37.0
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
[t0xic0der@fedorable test]$ source venv/bin/activate
(venv) [t0xic0der@fedorable test]$ pip3 install distro
Collecting distro
  Downloading distro-1.6.0-py2.py3-none-any.whl (19 kB)
Installing collected packages: distro
Successfully installed distro-1.6.0
(venv) [t0xic0der@fedorable test]$ python3 
Python 3.9.7 (default, Aug 30 2021, 00:00:00) 
[GCC 11.2.1 20210728 (Red Hat 11.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from distro import id
>>> id
<function id at 0x7efd24e3d040>
>>> id()
'fedora'
>>> from distro import os_release_info
>>> os_release_info()
{'name': 'Fedora', 'version': '34 (Workstation Edition)', 'id': 'fedora', 'version_id': '34', 'version_codename': '', 'platform_id': 'platform:f34', 'pretty_name': 'Fedora 34 (Workstation Edition)', 'ansi_color': '0;38;2;60;110;180', 'logo': 'fedora-logo-icon', 'cpe_name': 'cpe:/o:fedoraproject:fedora:34', 'home_url': 'https://fedoraproject.org/', 'documentation_url': 'https://docs.fedoraproject.org/en-US/fedora/f34/system-administrators-guide/', 'support_url': 'https://fedoraproject.org/wiki/Communicating_and_getting_help', 'bug_report_url': 'https://bugzilla.redhat.com/', 'redhat_bugzilla_product': 'Fedora', 'redhat_bugzilla_product_version': '34', 'redhat_support_product': 'Fedora', 'redhat_support_product_version': '34', 'privacy_policy_url': 'https://fedoraproject.org/wiki/Legal:PrivacyPolicy', 'variant': 'Workstation Edition', 'variant_id': 'workstation', 'codename': ''}
>>> os_release_info()["name"]
'Fedora'
>>> os_release_info()["version_id"]
'34'
>>> 
(venv) [t0xic0der@fedorable test]$ deactivate
[t0xic0der@fedorable test]$ 

Thank you for responsibly providing the context behind the change.

@onuralpszr
Copy link
Collaborator

LGTM @t0xic0der merge it.

@onuralpszr
Copy link
Collaborator

image

@gridhead
Copy link
Owner

Thanks for the review, @thunderbirdtr.

@gridhead gridhead merged commit 84727b4 into gridhead:master Sep 12, 2021
@xfgusta xfgusta deleted the fix-distro-identification branch September 12, 2021 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants