brew/Library/Homebrew/os/linux.rb

92 lines
1.7 KiB
Ruby
Raw Normal View History

2020-10-10 14:16:11 +02:00
# typed: true
# frozen_string_literal: true
module OS
2020-08-26 03:06:19 +02:00
# Helper module for querying system information on Linux.
module Linux
module_function
def os_version
if which("lsb_release")
description = Utils.popen_read("lsb_release -d")
.chomp
.sub("Description:\t", "")
codename = Utils.popen_read("lsb_release -c")
.chomp
.sub("Codename:\t", "")
"#{description} (#{codename})"
elsif (redhat_release = Pathname.new("/etc/redhat-release")).readable?
redhat_release.read.chomp
else
"Unknown"
end
end
end
2020-08-26 03:06:19 +02:00
# rubocop:disable Style/Documentation
module Mac
module_function
2019-04-19 21:46:20 +09:00
# rubocop:disable Naming/ConstantName
# rubocop:disable Style/MutableConstant
::MacOS = OS::Mac
2019-04-19 21:46:20 +09:00
# rubocop:enable Naming/ConstantName
# rubocop:enable Style/MutableConstant
raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
def version
Version::NULL
end
def full_version
Version::NULL
end
def languages
2020-07-13 22:48:53 +10:00
@languages ||= Array(ENV["LANG"]&.slice(/[a-z]+/)).uniq
end
def language
languages.first
end
def sdk_root_needed?
false
end
2020-03-10 14:59:22 +01:00
def sdk_path_if_needed(_v = nil)
nil
end
def sdk_path
nil
end
module Xcode
module_function
def version
Version::NULL
end
def installed?
false
end
end
module CLT
module_function
def version
Version::NULL
end
def installed?
false
end
end
end
2020-08-26 03:06:19 +02:00
# rubocop:enable Style/Documentation
end