How do I add a distribution to Archey? - HorlogeSkynet/archey4 GitHub Wiki

Step 0: Fork the repository

This is a requirement for GitHub's contribution flow. You need to:

  • Fork this repository.
  • [OPTIONAL] Create a new branch.
  • Make the desired changes in the steps below.
  • Commit your changes to your fork.
  • Open a pull request from your fork to this repository.

See the great GitHub guides for help on doing this step.

Step 1: Determine how to detect your distribution

Archey uses the distro Python package to determine the distribution. Running python3 -m distro -j should give an output similar to the following:

{
    "codename": "focal",
    "id": "ubuntu",    // <-- Most important!
    "like": "debian",  // <-- Fallback if required
    "version": "20.04",
    "version_parts": {
        "build_number": "",
        "major": "20",
        "minor": "04"
    }
}

The key lines to look at are the id and like lines. If one (or both) of these is populated, then you can continue. Preferentially use the id line (e.g. ubuntu in this case).

If both of these lines are empty, please open an issue for help.

Step 2: Add your distribution's ID

In archey/distributions.py, add your distribution to the list in the Distributions class, with a sensible capitalized name. For example, Ubuntu is in the list as follows:

UBUNTU = 'ubuntu'

If the output from above didn't contain an id, but has a like field, then use that instead (e.g. debian in this case). If it already exists, please open an issue for help.

Step 3: Add ASCII art

We currently prefer ASCII art free of Unicode characters for backwards-compatibility. Under archey/logos/, create a new file named as your distribution id (e.g. ubuntu.py in our example) and add your logo in the same style as the other files:

# Describe which logo you're putting here in the first line
"""Ubuntu logo"""

# Import this Archey's helper to easily define logos' colors below.
from archey.colors import Colors

# Include each used color in a list as below:
COLORS = [Colors.RED_BRIGHT, Colors.WHITE_BRIGHT]

# Now it's time to include the ASCII art!
LOGO = [
    # Each line of the logo is a triple-quoted string in this list.
    # Use `{c[0]}`, `{c[1]}`, `{c[2]}`, etc., to provide color.
    # Don't use more colors than defined above!
    """{c[0]}Color 0 {c[1]}Color 1 {c[2]}Color 2""",
    """{c[3]}Color 3 {c[4]}Color 4 {c[4]}Color 4"""
    # ...
]

Congratulations, you did it! 🎉