Nim pretty and add void (#18652)

* pretty and add void

* distro fixup

* Update lib/pure/distros.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

* tab to space

* requested change to be cleaner

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
This commit is contained in:
Kyle Brown
2021-08-08 10:30:51 -07:00
committed by GitHub
parent 24445d31b3
commit eb19db6595

View File

@@ -109,7 +109,7 @@ type
Clonezilla
SteamOS
Absolute
NixOS ## NixOS or a Nix build environment
NixOS ## NixOS or a Nix build environment
AUSTRUMI
Arya
Porteus
@@ -124,6 +124,7 @@ type
ExTiX
Rockstor
GoboLinux
Void
BSD
FreeBSD
@@ -134,7 +135,9 @@ type
const
LacksDevPackages* = {Distribution.Gentoo, Distribution.Slackware, Distribution.ArchLinux, Distribution.Artix}
LacksDevPackages* = {Distribution.Gentoo, Distribution.Slackware,
Distribution.ArchLinux, Distribution.Artix, Distribution.Antergos,
Distribution.BlackArch, Distribution.ArchBang}
# we cache the result of the 'cmdRelease'
# execution for faster platform detections.
@@ -153,7 +156,8 @@ template hostnamectl(): untyped = cmdRelease("hostnamectl", hostnamectlRes)
proc detectOsWithAllCmd(d: Distribution): bool =
let dd = toLowerAscii($d)
result = dd in toLowerAscii(osReleaseID()) or dd in toLowerAscii(release()) or
dd in toLowerAscii(uname()) or ("operating system: " & dd) in toLowerAscii(hostnamectl())
dd in toLowerAscii(uname()) or ("operating system: " & dd) in
toLowerAscii(hostnamectl())
proc detectOsImpl(d: Distribution): bool =
case d
@@ -173,9 +177,9 @@ proc detectOsImpl(d: Distribution): bool =
case d
of Distribution.Gentoo:
result = ("-" & $d & " ") in uname()
of Distribution.Elementary, Distribution.Ubuntu, Distribution.Debian, Distribution.Fedora,
Distribution.OpenMandriva, Distribution.CentOS, Distribution.Alpine,
Distribution.Mageia, Distribution.Zorin:
of Distribution.Elementary, Distribution.Ubuntu, Distribution.Debian,
Distribution.Fedora, Distribution.OpenMandriva, Distribution.CentOS,
Distribution.Alpine, Distribution.Mageia, Distribution.Zorin, Distribution.Void:
result = toLowerAscii($d) in osReleaseID()
of Distribution.RedHat:
result = "rhel" in osReleaseID()
@@ -254,6 +258,8 @@ proc foreignDepInstallCmd*(foreignPackageName: string): (string, bool) =
result = ("rpm -ivh " & p, true)
elif detectOs(ArchLinux) or detectOs(Manjaro) or detectOs(Artix):
result = ("pacman -S " & p, true)
elif detectOs(Void):
result = ("xbps-install " & p, true)
else:
result = ("<your package manager here> install " & p, true)
elif defined(haiku):