Skip to content

Commit

Permalink
[O] Normalize distro package name
Browse files Browse the repository at this point in the history
  • Loading branch information
hykilpikonna committed May 16, 2024
1 parent cff0fdf commit 1a3e6a8
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 4 deletions.
2 changes: 1 addition & 1 deletion hyfetch/distros/adélie.py → hyfetch/distros/adelie.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from . import AsciiArt

adélie = AsciiArt(match=r'''"Adélie"* | "Adelie"*''', color='4 7 6', ascii=r"""
adelie = AsciiArt(match=r'''"Adélie"* | "Adelie"*''', color='4 7 6', ascii=r"""
${c1} ${c3} ,-^-___
${c3} /\\\///
${c2}refined.${c1} /\\\\//
Expand Down
25 changes: 25 additions & 0 deletions hyfetch/distros/chimera.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file is automatically generated. Please do not modify.

from . import AsciiArt

chimera = AsciiArt(match=r'''"Chimera"*''', color='1 5 4 1', ascii=r"""
${c3}ddddddddddddddc ${c1},cc:
${c3}ddddddddddddddc ${c1},cc:
${c3}ddddddddddddddd ${c1},cc:
${c3}ddddddddddddl:' ${c1},cc:
${c3}dddddddddl' ${c1}..;cc:
${c3}dddddddo. ${c1},:cccccc:
${c3}ddddddl ${c1},ccc:'''''
${c3}dddddo. ${c1};ccc. ............
.ccc. cccccccccccc
${c2}...... ${c1}.ccc. .ccc'''''''''
${c2}OOOOOk. ${c1};ccc. .ccc; ......
${c2}OOOOOOd ${c1}'ccc:,....,:ccc' ${c4}coooooo
${c2}OOOOOOOx. ${c1}':cccccccc:' ${c4}.looooooo
${c2}OOOOOOOOOd, ${c1}`'''` ${c4}.coooooooo
${c2}OOOOOOOOOOOOdc,. ${c4}..,coooooooooooo
${c2}OOOOOOOOOOOOOOOO' ${c4}.oooooooooooooooo
${c2}OOOOOOOOOOOOOOOO' ${c4}.oooooooooooooooo
${c2}OOOOOOOOOOOOOOOO' ${c4}.oooooooooooooooo
""")

16 changes: 14 additions & 2 deletions hyfetch/distros/distro_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ def detect(name: str) -> AsciiArt | None:
return None
name = name.lower()
if name.startswith('adélie') or name.startswith('adelie'):
from .adélie import adélie
return adélie
from .adelie import adelie
return adelie

if name.startswith('aix'):
from .aix import aix
Expand Down Expand Up @@ -304,6 +304,10 @@ def detect(name: str) -> AsciiArt | None:
from .chapeau import chapeau
return chapeau

if name.startswith('chimera'):
from .chimera import chimera
return chimera

if name.startswith('chonkysealos'):
from .chonkysealos import chonkysealos
return chonkysealos
Expand Down Expand Up @@ -476,6 +480,10 @@ def detect(name: str) -> AsciiArt | None:
from .evolutionos import evolutionos
return evolutionos

if name.startswith('eweos'):
from .eweos import eweos
return eweos

if name.startswith('exherbo'):
from .exherbo import exherbo
return exherbo
Expand Down Expand Up @@ -1472,6 +1480,10 @@ def detect(name: str) -> AsciiArt | None:
from .xenia import xenia
return xenia

if name.startswith('tatra'):
from .tatra import tatra
return tatra

if name.startswith('zorin'):
from .zorin import zorin
return zorin
Expand Down
22 changes: 22 additions & 0 deletions hyfetch/distros/eweos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This file is automatically generated. Please do not modify.

from . import AsciiArt

eweos = AsciiArt(match=r'''"eweOS"*''', color='7 11 9 8 1', ascii=r"""
${c2} #####%%%
${c2} ##%%${c3}////${c2}%%%%%${c3}///
${c2} #%%%%${c3}////((((////${c2}%
${c1} *@@@@@@@${c3}/${c5},,,${c3}/////${c5},,,${c2}%${c1}@@@@@@@
${c1} .@@@@@@@@@@@${c3}////////${c2}%%%${c1}@@@@@@@@@@@@
${c1} @@@${c4}...${c1}@@@@@@${c3}////${c2}%%${c3}////${c1}@@@@@@@@@@@@@@@@
${c1} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
${c1} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
${c1} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
${c1} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
${c1} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@
${c1} @@@@@@@@@@@@@@@@@@@@@@@@@@@
${c1} @@@@@@@@@@@@@@@@@@@@@@@
${c1} @@@@@@ @@@@@@
${c1} @@@ @@@
""")

23 changes: 23 additions & 0 deletions hyfetch/distros/tatra.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This file is automatically generated. Please do not modify.

from . import AsciiArt

tatra = AsciiArt(match=r'''"Tatra"*''', color='4 7', ascii=r"""
${c1}
. .:. . .:.
.^^.!.:::. .^!?J?^
.:^.^!!!~:~^. .7??77!~~^.
.~^.!??77?!.^~: ..:^^7JJJ7~~^.
.^~.^7???7~.~~. .7??????????!
.:^:^^~^^:!^ ^: .......^!:...
.!7~.::.!.::. ~BG~ :^ ^~:
:!!~ ~. ?BBBB! ^?J!. .!~.
:!. .JBY. .Y#BBBY?~!???J7. :^^.
.. :5#B#P~P#BBP?7?55J?J7:
^P#BBBBBBBB5?7J5555J!.....
!BBBBBBGBBGJ77::Y555J?77777^
?BBBBG5JJ5PJ?!: .?Y??????77?~.
.YBGPYJ??????Y?^^^^~7?????????7?!.
.^^:..::::::::.....:::::::::::..:.
""")

6 changes: 5 additions & 1 deletion tools/list_distros.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from pathlib import Path

import regex
import unicodedata
from hypy_utils import write

from hyfetch.distros import AsciiArt
Expand All @@ -34,7 +35,7 @@ def parse_ascii_distros() -> list[AsciiArt]:
"""
Parse ascii distros from neofetch script
"""
nf = (Path(__file__).parent.parent / 'neofetch').read_text().replace('\t', ' ' * 4)
nf = (Path(__file__).parent.parent / 'neofetch').read_text('utf-8').replace('\t', ' ' * 4)

# Get the content of "get_distro_ascii" function
nf = nf[nf.index('get_distro_ascii() {\n'):]
Expand Down Expand Up @@ -139,6 +140,9 @@ def export_distro(d: AsciiArt) -> str:
for s in string.punctuation + ' ':
varname = varname.replace(s, '_')

# Remove accents
varname = unicodedata.normalize('NFKD', varname).encode('ascii', 'ignore').decode('utf-8')

# Escape/unescape ascii
ascii = d.ascii.replace("\\\\", "\\")

Expand Down

0 comments on commit 1a3e6a8

Please sign in to comment.