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

Use os-release(5) for OS name detection; related changes. #40

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

LukeShu
Copy link

@LukeShu LukeShu commented Oct 11, 2016

This fixes issue #39 (which I opened).

I'd write a more detailed description, but I would just be duplicating the commit messages, so click the "…" to expand those.

Disclosure: This patchset makes archey3 suitable for use on Parabola GNU/Linux-libre, a fork of Arch Linux that I am a developer for.

Luke Shumaker added 3 commits October 10, 2016 21:01
Create a global `os_release()` function that returns a dict containing the
contents of the os-release file (use shlex to parse it).  Accompanying this
is the `OS_RELEASE` global, since I figure calling it multiple times is a
waste.  I'm not really sure that this was a good place to put it, but I
didn't have a good sense of how you were trying to organize the program.
Perhaps pass it around in the `state`?

Now, because the old code in distroCheck.render was basically hard-coding
the string "Arch Linux", but pretending to actually detect something, the
code that used it to select the logo was a bit fragile.  Instead, create
a .logo() method on the Archey object that finds the most appropriate logo
based on some logic describe below.  This is better than trying to parse
the output of the distro module.

Archey.logo() goes through the PRETTY_NAME, NAME, ID, `uname -o`, and
finally an empty string, until it finds a logo matching that string.  This
way we can be pretty robust in finding the most appropriate logo.  I
included the empty string at the end as an absolute; fallback and added a
logo that is a giant "?" for it.  This will allow, say, a "GNU/Linux" logo
to be added that will show on otherwise unknown GNU/Linux distros, while
still only showing the "?" logo on something else, like BSD.

Finally, the distroCheck.render() code was updated to try PRETTY_NAME,
NAME, then `uname -o`.
Previously, it looked for exactly one slash in a value to identify a
fraction.  This resulted in silly things like "GNU/Linux" being rendered as
a fraction (the "GNU" becomes blue, or whatever the color is set to).

Now, it inspects that there is exactly one slash, with at least one digit
on each side of it.  I didn't mandate entirely digits, because a fraction
might include units.
@LukeShu
Copy link
Author

LukeShu commented Oct 21, 2016

I should add that I wouldn't be upset if you only wanted to merge the first two commits, and reject the third.

@LukeShu
Copy link
Author

LukeShu commented Mar 9, 2021

Ping.

@HorlogeSkynet
Copy link

This project has been abandoned for a while now (see #47). I (modestly) invite you to check out HorlogeSkynet/archey4. Cheers.

HorlogeSkynet pushed a commit to HorlogeSkynet/archey4 that referenced this pull request Mar 11, 2021
> See related : lclarkmichalek/archey3#40

[skip ci]

Co-authored-by: Luke Shumaker <lukeshu@sbcglobal.net>
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.

2 participants