Skip to content
Snippets Groups Projects
Commit 314483f7 authored by Markus Reiter's avatar Markus Reiter
Browse files

Remove `Array#to_path_s`.

parent a1674690
No related branches found
No related tags found
No related merge requests found
...@@ -3,12 +3,6 @@ require "extend/ENV/shared" ...@@ -3,12 +3,6 @@ require "extend/ENV/shared"
require "extend/ENV/std" require "extend/ENV/std"
require "extend/ENV/super" require "extend/ENV/super"
class Array
def to_path_s
map(&:to_s).uniq.select { |s| File.directory?(s) }.join(File::PATH_SEPARATOR).chuzzle
end
end
def superenv? def superenv?
ARGV.env != "std" && Superenv.bin ARGV.env != "std" && Superenv.bin
end end
......
...@@ -57,12 +57,12 @@ module Stdenv ...@@ -57,12 +57,12 @@ module Stdenv
end end
def determine_pkg_config_libdir def determine_pkg_config_libdir
paths = [] PATH.new(
paths << "#{HOMEBREW_PREFIX}/lib/pkgconfig" HOMEBREW_PREFIX/"lib/pkgconfig",
paths << "#{HOMEBREW_PREFIX}/share/pkgconfig" HOMEBREW_PREFIX/"share/pkgconfig",
paths += homebrew_extra_pkg_config_paths homebrew_extra_pkg_config_paths,
paths << "/usr/lib/pkgconfig" "/usr/lib/pkgconfig",
paths.to_path_s ).validate
end end
# Removes the MAKEFLAGS environment variable, causing make to use a single job. # Removes the MAKEFLAGS environment variable, causing make to use a single job.
......
...@@ -101,29 +101,28 @@ module Superenv ...@@ -101,29 +101,28 @@ module Superenv
end end
def determine_path def determine_path
paths = [Superenv.bin] path = PATH.new(Superenv.bin)
# Formula dependencies can override standard tools. # Formula dependencies can override standard tools.
paths += deps.map { |d| d.opt_bin.to_s } path.append(deps.map { |d| d.opt_bin.to_s })
path.append(homebrew_extra_paths)
paths += homebrew_extra_paths path.append("/usr/bin", "/bin", "/usr/sbin", "/sbin")
paths += %w[/usr/bin /bin /usr/sbin /sbin]
# Homebrew's apple-gcc42 will be outside the PATH in superenv, # Homebrew's apple-gcc42 will be outside the PATH in superenv,
# so xcrun may not be able to find it # so xcrun may not be able to find it
begin begin
case homebrew_cc case homebrew_cc
when "gcc-4.2" when "gcc-4.2"
paths << Formulary.factory("apple-gcc42").opt_bin path.append(Formulary.factory("apple-gcc42").opt_bin)
when GNU_GCC_REGEXP when GNU_GCC_REGEXP
paths << gcc_version_formula($&).opt_bin path.append(gcc_version_formula($&).opt_bin)
end end
rescue FormulaUnavailableError rescue FormulaUnavailableError
# Don't fail and don't add these formulae to the path if they don't exist. # Don't fail and don't add these formulae to the path if they don't exist.
nil nil
end end
paths.to_path_s path.validate
end end
def homebrew_extra_pkg_config_paths def homebrew_extra_pkg_config_paths
...@@ -131,15 +130,17 @@ module Superenv ...@@ -131,15 +130,17 @@ module Superenv
end end
def determine_pkg_config_path def determine_pkg_config_path
paths = deps.map { |d| "#{d.opt_lib}/pkgconfig" } PATH.new(
paths += deps.map { |d| "#{d.opt_share}/pkgconfig" } deps.map { |d| d.opt_lib/"pkgconfig" },
paths.to_path_s deps.map { |d| d.opt_share/"pkgconfig" },
).validate
end end
def determine_pkg_config_libdir def determine_pkg_config_libdir
paths = %w[/usr/lib/pkgconfig] PATH.new(
paths += homebrew_extra_pkg_config_paths "/usr/lib/pkgconfig",
paths.to_path_s homebrew_extra_pkg_config_paths,
).validate
end end
def homebrew_extra_aclocal_paths def homebrew_extra_aclocal_paths
...@@ -147,10 +148,11 @@ module Superenv ...@@ -147,10 +148,11 @@ module Superenv
end end
def determine_aclocal_path def determine_aclocal_path
paths = keg_only_deps.map { |d| "#{d.opt_share}/aclocal" } PATH.new(
paths << "#{HOMEBREW_PREFIX}/share/aclocal" keg_only_deps.map { |d| d.opt_share/"aclocal" },
paths += homebrew_extra_aclocal_paths HOMEBREW_PREFIX/"share/aclocal",
paths.to_path_s homebrew_extra_aclocal_paths,
).validate
end end
def homebrew_extra_isystem_paths def homebrew_extra_isystem_paths
...@@ -158,13 +160,14 @@ module Superenv ...@@ -158,13 +160,14 @@ module Superenv
end end
def determine_isystem_paths def determine_isystem_paths
paths = ["#{HOMEBREW_PREFIX}/include"] PATH.new(
paths += homebrew_extra_isystem_paths HOMEBREW_PREFIX/"include",
paths.to_path_s homebrew_extra_isystem_paths,
).validate
end end
def determine_include_paths def determine_include_paths
keg_only_deps.map { |d| d.opt_include.to_s }.to_path_s PATH.new(keg_only_deps.map(&:opt_include)).validate
end end
def homebrew_extra_library_paths def homebrew_extra_library_paths
...@@ -172,10 +175,11 @@ module Superenv ...@@ -172,10 +175,11 @@ module Superenv
end end
def determine_library_paths def determine_library_paths
paths = keg_only_deps.map { |d| d.opt_lib.to_s } PATH.new(
paths << "#{HOMEBREW_PREFIX}/lib" keg_only_deps.map(&:opt_lib),
paths += homebrew_extra_library_paths HOMEBREW_PREFIX/"lib",
paths.to_path_s homebrew_extra_library_paths,
).validate
end end
def determine_dependencies def determine_dependencies
...@@ -183,9 +187,10 @@ module Superenv ...@@ -183,9 +187,10 @@ module Superenv
end end
def determine_cmake_prefix_path def determine_cmake_prefix_path
paths = keg_only_deps.map { |d| d.opt_prefix.to_s } PATH.new(
paths << HOMEBREW_PREFIX.to_s keg_only_deps.map(&:opt_prefix),
paths.to_path_s HOMEBREW_PREFIX.to_s,
).validate
end end
def homebrew_extra_cmake_include_paths def homebrew_extra_cmake_include_paths
...@@ -193,9 +198,7 @@ module Superenv ...@@ -193,9 +198,7 @@ module Superenv
end end
def determine_cmake_include_path def determine_cmake_include_path
paths = [] PATH.new(homebrew_extra_cmake_include_paths).validate
paths += homebrew_extra_cmake_include_paths
paths.to_path_s
end end
def homebrew_extra_cmake_library_paths def homebrew_extra_cmake_library_paths
...@@ -203,9 +206,7 @@ module Superenv ...@@ -203,9 +206,7 @@ module Superenv
end end
def determine_cmake_library_path def determine_cmake_library_path
paths = [] PATH.new(homebrew_extra_cmake_library_paths).validate
paths += homebrew_extra_cmake_library_paths
paths.to_path_s
end end
def homebrew_extra_cmake_frameworks_paths def homebrew_extra_cmake_frameworks_paths
...@@ -213,9 +214,10 @@ module Superenv ...@@ -213,9 +214,10 @@ module Superenv
end end
def determine_cmake_frameworks_path def determine_cmake_frameworks_path
paths = deps.map { |d| d.opt_frameworks.to_s } PATH.new(
paths += homebrew_extra_cmake_frameworks_paths deps.map(&:opt_frameworks),
paths.to_path_s homebrew_extra_cmake_frameworks_paths,
).validate
end end
def determine_make_jobs def determine_make_jobs
......
...@@ -190,10 +190,10 @@ module Homebrew ...@@ -190,10 +190,10 @@ module Homebrew
Gem::Specification.reset Gem::Specification.reset
# Add Gem binary directory and (if missing) Ruby binary directory to PATH. # Add Gem binary directory and (if missing) Ruby binary directory to PATH.
paths = ENV["PATH"].split(File::PATH_SEPARATOR) path = PATH.new(ENV["PATH"])
paths.unshift(RUBY_BIN) if which("ruby") != RUBY_PATH path.prepend(RUBY_BIN) if which("ruby") != RUBY_PATH
paths.unshift(Gem.bindir) path.prepend(Gem.bindir)
ENV["PATH"] = paths.to_path_s ENV["PATH"] = path.validate
if Gem::Specification.find_all_by_name(name, version).empty? if Gem::Specification.find_all_by_name(name, version).empty?
ohai "Installing or updating '#{name}' gem" ohai "Installing or updating '#{name}' gem"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment