[O] Normalize distro package name

This commit is contained in:
Azalea 2024-05-16 21:32:03 +08:00
parent cff0fdf6d8
commit 1a3e6a8e29
6 changed files with 90 additions and 4 deletions

View file

@ -2,7 +2,7 @@
from . import AsciiArt 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} ,-^-___ ${c1} ${c3} ,-^-___
${c3} /\\\/// ${c3} /\\\///
${c2}refined.${c1} /\\\\// ${c2}refined.${c1} /\\\\//

View file

@ -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
""")

View file

@ -9,8 +9,8 @@ def detect(name: str) -> AsciiArt | None:
return None return None
name = name.lower() name = name.lower()
if name.startswith('adélie') or name.startswith('adelie'): if name.startswith('adélie') or name.startswith('adelie'):
from .adélie import adélie from .adelie import adelie
return adélie return adelie
if name.startswith('aix'): if name.startswith('aix'):
from .aix import aix from .aix import aix
@ -304,6 +304,10 @@ def detect(name: str) -> AsciiArt | None:
from .chapeau import chapeau from .chapeau import chapeau
return chapeau return chapeau
if name.startswith('chimera'):
from .chimera import chimera
return chimera
if name.startswith('chonkysealos'): if name.startswith('chonkysealos'):
from .chonkysealos import chonkysealos from .chonkysealos import chonkysealos
return chonkysealos return chonkysealos
@ -476,6 +480,10 @@ def detect(name: str) -> AsciiArt | None:
from .evolutionos import evolutionos from .evolutionos import evolutionos
return evolutionos return evolutionos
if name.startswith('eweos'):
from .eweos import eweos
return eweos
if name.startswith('exherbo'): if name.startswith('exherbo'):
from .exherbo import exherbo from .exherbo import exherbo
return exherbo return exherbo
@ -1472,6 +1480,10 @@ def detect(name: str) -> AsciiArt | None:
from .xenia import xenia from .xenia import xenia
return xenia return xenia
if name.startswith('tatra'):
from .tatra import tatra
return tatra
if name.startswith('zorin'): if name.startswith('zorin'):
from .zorin import zorin from .zorin import zorin
return zorin return zorin

22
hyfetch/distros/eweos.py Normal file
View file

@ -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
hyfetch/distros/tatra.py Normal file
View file

@ -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?!.
.^^:..::::::::.....:::::::::::..:.
""")

View file

@ -10,6 +10,7 @@ import textwrap
from pathlib import Path from pathlib import Path
import regex import regex
import unicodedata
from hypy_utils import write from hypy_utils import write
from hyfetch.distros import AsciiArt from hyfetch.distros import AsciiArt
@ -34,7 +35,7 @@ def parse_ascii_distros() -> list[AsciiArt]:
""" """
Parse ascii distros from neofetch script 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 # Get the content of "get_distro_ascii" function
nf = nf[nf.index('get_distro_ascii() {\n'):] nf = nf[nf.index('get_distro_ascii() {\n'):]
@ -139,6 +140,9 @@ def export_distro(d: AsciiArt) -> str:
for s in string.punctuation + ' ': for s in string.punctuation + ' ':
varname = varname.replace(s, '_') varname = varname.replace(s, '_')
# Remove accents
varname = unicodedata.normalize('NFKD', varname).encode('ascii', 'ignore').decode('utf-8')
# Escape/unescape ascii # Escape/unescape ascii
ascii = d.ascii.replace("\\\\", "\\") ascii = d.ascii.replace("\\\\", "\\")