Fix brew style
This commit is contained in:
parent
828eb0b690
commit
3923d331de
@ -194,6 +194,11 @@ Lint/AmbiguousRegexpLiteral:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'Taps/*/*/{Formula/,}*.rb'
|
- 'Taps/*/*/{Formula/,}*.rb'
|
||||||
|
|
||||||
|
# useful for metaprogramming in RSpec
|
||||||
|
Lint/ConstantDefinitionInBlock:
|
||||||
|
Exclude:
|
||||||
|
- '**/*_spec.rb'
|
||||||
|
|
||||||
# so many of these in formulae and can't be autocorrected
|
# so many of these in formulae and can't be autocorrected
|
||||||
Lint/ParenthesesAsGroupedExpression:
|
Lint/ParenthesesAsGroupedExpression:
|
||||||
Exclude:
|
Exclude:
|
||||||
|
@ -276,7 +276,7 @@ module Cask
|
|||||||
|
|
||||||
def x11_dependencies
|
def x11_dependencies
|
||||||
return unless @cask.depends_on.x11
|
return unless @cask.depends_on.x11
|
||||||
raise CaskX11DependencyError, @cask.token unless MacOS::X11.installed?
|
raise CaskX11DependencyError, @cask.token unless MacOS::XQuartz.installed?
|
||||||
end
|
end
|
||||||
|
|
||||||
def graph_dependencies(cask_or_formula, acc = TopologicalHash.new)
|
def graph_dependencies(cask_or_formula, acc = TopologicalHash.new)
|
||||||
|
@ -915,11 +915,11 @@ module Homebrew
|
|||||||
none_string
|
none_string
|
||||||
else
|
else
|
||||||
cask_count = begin
|
cask_count = begin
|
||||||
tap.cask_files.count
|
tap.cask_files.count
|
||||||
rescue
|
rescue
|
||||||
error_tap_paths << tap.path
|
error_tap_paths << tap.path
|
||||||
0
|
0
|
||||||
end
|
end
|
||||||
|
|
||||||
"#{tap.path} (#{cask_count} #{"cask".pluralize(cask_count)})"
|
"#{tap.path} (#{cask_count} #{"cask".pluralize(cask_count)})"
|
||||||
end
|
end
|
||||||
|
@ -11,25 +11,25 @@ module Stdenv
|
|||||||
|
|
||||||
def x11
|
def x11
|
||||||
# There are some config scripts here that should go in the PATH
|
# There are some config scripts here that should go in the PATH
|
||||||
append_path "PATH", MacOS::X11.bin.to_s
|
append_path "PATH", MacOS::XQuartz.bin.to_s
|
||||||
|
|
||||||
# Append these to PKG_CONFIG_LIBDIR so they are searched
|
# Append these to PKG_CONFIG_LIBDIR so they are searched
|
||||||
# *after* our own pkgconfig directories, as we dupe some of the
|
# *after* our own pkgconfig directories, as we dupe some of the
|
||||||
# libs in XQuartz.
|
# libs in XQuartz.
|
||||||
append_path "PKG_CONFIG_LIBDIR", "#{MacOS::X11.lib}/pkgconfig"
|
append_path "PKG_CONFIG_LIBDIR", "#{MacOS::XQuartz.lib}/pkgconfig"
|
||||||
append_path "PKG_CONFIG_LIBDIR", "#{MacOS::X11.share}/pkgconfig"
|
append_path "PKG_CONFIG_LIBDIR", "#{MacOS::XQuartz.share}/pkgconfig"
|
||||||
|
|
||||||
append "LDFLAGS", "-L#{MacOS::X11.lib}"
|
append "LDFLAGS", "-L#{MacOS::XQuartz.lib}"
|
||||||
append_path "CMAKE_PREFIX_PATH", MacOS::X11.prefix.to_s
|
append_path "CMAKE_PREFIX_PATH", MacOS::XQuartz.prefix.to_s
|
||||||
append_path "CMAKE_INCLUDE_PATH", MacOS::X11.include.to_s
|
append_path "CMAKE_INCLUDE_PATH", MacOS::XQuartz.include.to_s
|
||||||
append_path "CMAKE_INCLUDE_PATH", "#{MacOS::X11.include}/freetype2"
|
append_path "CMAKE_INCLUDE_PATH", "#{MacOS::XQuartz.include}/freetype2"
|
||||||
|
|
||||||
append "CPPFLAGS", "-I#{MacOS::X11.include}"
|
append "CPPFLAGS", "-I#{MacOS::XQuartz.include}"
|
||||||
append "CPPFLAGS", "-I#{MacOS::X11.include}/freetype2"
|
append "CPPFLAGS", "-I#{MacOS::XQuartz.include}/freetype2"
|
||||||
|
|
||||||
append_path "ACLOCAL_PATH", "#{MacOS::X11.share}/aclocal"
|
append_path "ACLOCAL_PATH", "#{MacOS::XQuartz.share}/aclocal"
|
||||||
|
|
||||||
append "CFLAGS", "-I#{MacOS::X11.include}" unless MacOS::CLT.installed?
|
append "CFLAGS", "-I#{MacOS::XQuartz.include}" unless MacOS::CLT.installed?
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_build_environment(**options)
|
def setup_build_environment(**options)
|
||||||
|
@ -24,7 +24,7 @@ module Superenv
|
|||||||
|
|
||||||
def homebrew_extra_paths
|
def homebrew_extra_paths
|
||||||
paths = []
|
paths = []
|
||||||
paths << MacOS::X11.bin.to_s if x11?
|
paths << MacOS::XQuartz.bin.to_s if x11?
|
||||||
paths
|
paths
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -32,13 +32,13 @@ module Superenv
|
|||||||
def homebrew_extra_pkg_config_paths
|
def homebrew_extra_pkg_config_paths
|
||||||
paths = \
|
paths = \
|
||||||
["/usr/lib/pkgconfig", "#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}"]
|
["/usr/lib/pkgconfig", "#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}"]
|
||||||
paths << "#{MacOS::X11.lib}/pkgconfig" << "#{MacOS::X11.share}/pkgconfig" if x11?
|
paths << "#{MacOS::XQuartz.lib}/pkgconfig" << "#{MacOS::XQuartz.share}/pkgconfig" if x11?
|
||||||
paths
|
paths
|
||||||
end
|
end
|
||||||
|
|
||||||
def homebrew_extra_aclocal_paths
|
def homebrew_extra_aclocal_paths
|
||||||
paths = []
|
paths = []
|
||||||
paths << "#{MacOS::X11.share}/aclocal" if x11?
|
paths << "#{MacOS::XQuartz.share}/aclocal" if x11?
|
||||||
paths
|
paths
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ module Superenv
|
|||||||
paths = []
|
paths = []
|
||||||
paths << "#{self["HOMEBREW_SDKROOT"]}/usr/include/libxml2" if libxml2_include_needed?
|
paths << "#{self["HOMEBREW_SDKROOT"]}/usr/include/libxml2" if libxml2_include_needed?
|
||||||
paths << "#{self["HOMEBREW_SDKROOT"]}/usr/include/apache2" if MacOS::Xcode.without_clt?
|
paths << "#{self["HOMEBREW_SDKROOT"]}/usr/include/apache2" if MacOS::Xcode.without_clt?
|
||||||
paths << MacOS::X11.include.to_s << "#{MacOS::X11.include}/freetype2" if x11?
|
paths << MacOS::XQuartz.include.to_s << "#{MacOS::XQuartz.include}/freetype2" if x11?
|
||||||
paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers"
|
paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers"
|
||||||
paths
|
paths
|
||||||
end
|
end
|
||||||
@ -65,7 +65,7 @@ module Superenv
|
|||||||
paths << "#{self["HOMEBREW_SDKROOT"]}/usr/lib"
|
paths << "#{self["HOMEBREW_SDKROOT"]}/usr/lib"
|
||||||
paths << Formula["llvm"].opt_lib.to_s
|
paths << Formula["llvm"].opt_lib.to_s
|
||||||
end
|
end
|
||||||
paths << MacOS::X11.lib.to_s if x11?
|
paths << MacOS::XQuartz.lib.to_s if x11?
|
||||||
paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries"
|
paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries"
|
||||||
paths
|
paths
|
||||||
end
|
end
|
||||||
@ -74,14 +74,14 @@ module Superenv
|
|||||||
paths = []
|
paths = []
|
||||||
paths << "#{self["HOMEBREW_SDKROOT"]}/usr/include/libxml2" if libxml2_include_needed?
|
paths << "#{self["HOMEBREW_SDKROOT"]}/usr/include/libxml2" if libxml2_include_needed?
|
||||||
paths << "#{self["HOMEBREW_SDKROOT"]}/usr/include/apache2" if MacOS::Xcode.without_clt?
|
paths << "#{self["HOMEBREW_SDKROOT"]}/usr/include/apache2" if MacOS::Xcode.without_clt?
|
||||||
paths << MacOS::X11.include.to_s << "#{MacOS::X11.include}/freetype2" if x11?
|
paths << MacOS::XQuartz.include.to_s << "#{MacOS::XQuartz.include}/freetype2" if x11?
|
||||||
paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers"
|
paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers"
|
||||||
paths
|
paths
|
||||||
end
|
end
|
||||||
|
|
||||||
def homebrew_extra_cmake_library_paths
|
def homebrew_extra_cmake_library_paths
|
||||||
paths = []
|
paths = []
|
||||||
paths << MacOS::X11.lib.to_s if x11?
|
paths << MacOS::XQuartz.lib.to_s if x11?
|
||||||
paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries"
|
paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries"
|
||||||
paths
|
paths
|
||||||
end
|
end
|
||||||
@ -102,7 +102,7 @@ module Superenv
|
|||||||
end
|
end
|
||||||
|
|
||||||
def set_x11_env_if_installed
|
def set_x11_env_if_installed
|
||||||
ENV.x11 = MacOS::X11.installed?
|
ENV.x11 = MacOS::XQuartz.installed?
|
||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
|
@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
module OS
|
module OS
|
||||||
module Mac
|
module Mac
|
||||||
X11 = XQuartz = Module.new do # rubocop:disable Style/MutableConstant
|
# Helper module for querying XQuartz information.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
|
module XQuartz
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
DEFAULT_BUNDLE_PATH = Pathname.new("Applications/Utilities/XQuartz.app").freeze
|
DEFAULT_BUNDLE_PATH = Pathname.new("Applications/Utilities/XQuartz.app").freeze
|
||||||
@ -83,12 +86,10 @@ module OS
|
|||||||
PKGINFO_VERSION_MAP.fetch(str, str)
|
PKGINFO_VERSION_MAP.fetch(str, str)
|
||||||
end
|
end
|
||||||
|
|
||||||
# This should really be private, but for compatibility reasons it must
|
|
||||||
# remain public. New code should use `MacOS::X11.bin`, `MacOS::X11.lib` and
|
|
||||||
# `MacOS::X11.include` instead, as that accounts for Xcode-only systems.
|
|
||||||
def prefix
|
def prefix
|
||||||
@prefix ||= Pathname.new("/opt/X11") if Pathname.new("/opt/X11/lib/libpng.dylib").exist?
|
@prefix ||= Pathname.new("/opt/X11") if Pathname.new("/opt/X11/lib/libpng.dylib").exist?
|
||||||
end
|
end
|
||||||
|
private_class_method :prefix
|
||||||
|
|
||||||
def installed?
|
def installed?
|
||||||
!version.null? && !prefix.nil?
|
!version.null? && !prefix.nil?
|
||||||
|
@ -76,7 +76,7 @@ describe "Satisfy Dependencies and Requirements", :cask do
|
|||||||
|
|
||||||
describe "depends_on x11" do
|
describe "depends_on x11" do
|
||||||
before do
|
before do
|
||||||
allow(MacOS::X11).to receive(:installed?).and_return(x11_installed)
|
allow(MacOS::XQuartz).to receive(:installed?).and_return(x11_installed)
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when satisfied" do
|
context "when satisfied" do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user