diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 18af768b47..c1921c9756 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -42,7 +42,7 @@ class Checks ############# HELPERS def paths - @paths ||= ENV['PATH'].split(':').collect do |p| + @paths ||= ENV['PATH'].split(File::PATH_SEPARATOR).collect do |p| begin File.expand_path(p).chomp('/') rescue ArgumentError @@ -68,7 +68,7 @@ class Checks # Sorry for the lack of an indent here, the diff would have been unreadable. # See https://github.com/mxcl/homebrew/pull/9986 def check_path_for_trailing_slashes - bad_paths = ENV['PATH'].split(':').select { |p| p[-1..-1] == '/' } + bad_paths = ENV['PATH'].split(File::PATH_SEPARATOR).select { |p| p[-1..-1] == '/' } return if bad_paths.empty? s = <<-EOS.undent Some directories in your path end in a slash. diff --git a/Library/Homebrew/cmd/sh.rb b/Library/Homebrew/cmd/sh.rb index a1ff30dfcd..82fcc968d8 100644 --- a/Library/Homebrew/cmd/sh.rb +++ b/Library/Homebrew/cmd/sh.rb @@ -12,7 +12,7 @@ module Homebrew extend self ENV.setup_build_environment if superenv? # superenv stopped adding brew's bin but generally user's will want it - ENV['PATH'] = ENV['PATH'].split(':').insert(1, "#{HOMEBREW_PREFIX}/bin").join(':') + ENV['PATH'] = ENV['PATH'].split(File::PATH_SEPARATOR).insert(1, "#{HOMEBREW_PREFIX}/bin").join(File::PATH_SEPARATOR) end ENV['PS1'] = 'brew \[\033[1;32m\]\w\[\033[0m\]$ ' ENV['VERBOSE'] = '1' diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb index 0b5fee954d..5ceecd8440 100644 --- a/Library/Homebrew/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/ENV/shared.rb @@ -36,7 +36,7 @@ module SharedEnvExtension end end def prepend_path key, path - prepend key, path, ':' if File.directory? path + prepend key, path, File::PATH_SEPARATOR if File.directory? path end def remove keys, value Array(keys).each do |key| @@ -65,9 +65,9 @@ module SharedEnvExtension def userpaths! paths = ORIGINAL_PATHS.map { |p| p.realpath.to_s rescue nil } - %w{/usr/X11/bin /opt/X11/bin} - self['PATH'] = paths.unshift(*self['PATH'].split(":")).uniq.join(":") + self['PATH'] = paths.unshift(*self['PATH'].split(PATH_SEPARATOR)).uniq.join(File::PATH_SEPARATOR) # XXX hot fix to prefer brewed stuff (e.g. python) over /usr/bin. - prepend 'PATH', HOMEBREW_PREFIX/'bin', ':' + prepend 'PATH', HOMEBREW_PREFIX/'bin', File::PATH_SEPARATOR end def fortran diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb index 24007a46d3..caf0471e86 100644 --- a/Library/Homebrew/extend/ENV/std.rb +++ b/Library/Homebrew/extend/ENV/std.rb @@ -72,9 +72,9 @@ module Stdenv # For Xcode 4.3 (*without* the "Command Line Tools for Xcode") compiler and tools inside of Xcode: if not MacOS::CLT.installed? and MacOS::Xcode.installed? and MacOS::Xcode.version >= "4.3" # Some tools (clang, etc.) are in the xctoolchain dir of Xcode - append 'PATH', "#{MacOS.xctoolchain_path}/usr/bin", ":" if MacOS.xctoolchain_path + append 'PATH', "#{MacOS.xctoolchain_path}/usr/bin", File::PATH_SEPARATOR if MacOS.xctoolchain_path # Others are now at /Applications/Xcode.app/Contents/Developer/usr/bin - append 'PATH', "#{MacOS.dev_tools_path}", ":" + append 'PATH', "#{MacOS.dev_tools_path}", File::PATH_SEPARATOR end end @@ -84,7 +84,7 @@ module Stdenv paths << HOMEBREW_PREFIX/'share/pkgconfig' paths << HOMEBREW_REPOSITORY/"Library/ENV/pkgconfig/#{MacOS.version}" paths << '/usr/lib/pkgconfig' - paths.select { |d| File.directory? d }.join(':') + paths.select { |d| File.directory? d }.join(File::PATH_SEPARATOR) end def deparallelize @@ -217,15 +217,15 @@ module Stdenv # Extra setup to support Xcode 4.3+ without CLT. self['SDKROOT'] = sdk # Tell clang/gcc where system include's are: - append 'CPATH', "#{sdk}/usr/include", ":" + append 'CPATH', "#{sdk}/usr/include", File::PATH_SEPARATOR # The -isysroot is needed, too, because of the Frameworks append_to_cflags "-isysroot #{sdk}" append 'CPPFLAGS', "-isysroot #{sdk}" # And the linker needs to find sdk/usr/lib append 'LDFLAGS', "-isysroot #{sdk}" # Needed to build cmake itself and perhaps some cmake projects: - append 'CMAKE_PREFIX_PATH', "#{sdk}/usr", ':' - append 'CMAKE_FRAMEWORK_PATH', "#{sdk}/System/Library/Frameworks", ':' + append 'CMAKE_PREFIX_PATH', "#{sdk}/usr", File::PATH_SEPARATOR + append 'CMAKE_FRAMEWORK_PATH', "#{sdk}/System/Library/Frameworks", File::PATH_SEPARATOR end end @@ -250,24 +250,24 @@ module Stdenv def x11 # There are some config scripts here that should go in the PATH - append 'PATH', MacOS::X11.bin, ':' + append 'PATH', MacOS::X11.bin, File::PATH_SEPARATOR # Append these to PKG_CONFIG_LIBDIR so they are searched # *after* our own pkgconfig directories, as we dupe some of the # libs in XQuartz. - append 'PKG_CONFIG_LIBDIR', MacOS::X11.lib/'pkgconfig', ':' - append 'PKG_CONFIG_LIBDIR', MacOS::X11.share/'pkgconfig', ':' + append 'PKG_CONFIG_LIBDIR', MacOS::X11.lib/'pkgconfig', File::PATH_SEPARATOR + append 'PKG_CONFIG_LIBDIR', MacOS::X11.share/'pkgconfig', File::PATH_SEPARATOR append 'LDFLAGS', "-L#{MacOS::X11.lib}" - append 'CMAKE_PREFIX_PATH', MacOS::X11.prefix, ':' - append 'CMAKE_INCLUDE_PATH', MacOS::X11.include, ':' + append 'CMAKE_PREFIX_PATH', MacOS::X11.prefix, File::PATH_SEPARATOR + append 'CMAKE_INCLUDE_PATH', MacOS::X11.include, File::PATH_SEPARATOR append 'CPPFLAGS', "-I#{MacOS::X11.include}" - append 'ACLOCAL_PATH', MacOS::X11.share/'aclocal', ':' + append 'ACLOCAL_PATH', MacOS::X11.share/'aclocal', File::PATH_SEPARATOR unless MacOS::CLT.installed? - append 'CMAKE_PREFIX_PATH', MacOS.sdk_path/'usr/X11', ':' + append 'CMAKE_PREFIX_PATH', MacOS.sdk_path/'usr/X11', File::PATH_SEPARATOR append 'CPPFLAGS', "-I#{MacOS::X11.include}/freetype2" append 'CFLAGS', "-I#{MacOS::X11.include}" end diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index 5bfa34437c..84247b2fdb 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -96,7 +96,7 @@ module Superenv # so xcrun may not be able to find it if self['HOMEBREW_CC'] == 'gcc-4.2' apple_gcc42 = Formula.factory('apple-gcc42') rescue nil - append('PATH', apple_gcc42.opt_prefix/'bin', ':') if apple_gcc42 + append('PATH', apple_gcc42.opt_prefix/'bin', File::PATH_SEPARATOR) if apple_gcc42 end end @@ -303,6 +303,6 @@ end class Array def to_path_s - map(&:to_s).uniq.select{|s| File.directory? s }.join(':').chuzzle + map(&:to_s).uniq.select{|s| File.directory? s }.join(File::PATH_SEPARATOR).chuzzle end end diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index dea7d25915..18934c6ca8 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -98,7 +98,7 @@ HOMEBREW_PULL_OR_COMMIT_URL_REGEX = 'https:\/\/github.com\/(\w+)\/homebrew(-\w+) require 'compat' unless ARGV.include? "--no-compat" or ENV['HOMEBREW_NO_COMPAT'] -ORIGINAL_PATHS = ENV['PATH'].split(':').map{ |p| Pathname.new(p).expand_path rescue nil }.compact.freeze +ORIGINAL_PATHS = ENV['PATH'].split(File::PATH_SEPARATOR).map{ |p| Pathname.new(p).expand_path rescue nil }.compact.freeze SUDO_BAD_ERRMSG = <<-EOS.undent You can use brew with sudo, but only if the brew executable is owned by root. diff --git a/Library/Homebrew/python_helper.rb b/Library/Homebrew/python_helper.rb index cb2e5d9896..30eddb7c07 100644 --- a/Library/Homebrew/python_helper.rb +++ b/Library/Homebrew/python_helper.rb @@ -62,11 +62,11 @@ def python_helper(options={:allowed_major_versions => [2, 3]}, &block) # so that lib points to the HOMEBREW_PREFIX/Cellar///lib puts "brew: Prepending to PYTHONPATH: #{py.site_packages}" if ARGV.verbose? mkdir_p py.site_packages - ENV.prepend 'PYTHONPATH', py.site_packages, ':' + ENV.prepend 'PYTHONPATH', py.site_packages, File::PATH_SEPARATOR ENV['PYTHON'] = py.binary - ENV.prepend 'CMAKE_INCLUDE_PATH', py.incdir, ':' - ENV.prepend 'PKG_CONFIG_PATH', py.pkg_config_path, ':' if py.pkg_config_path - ENV.prepend 'PATH', py.binary.dirname, ':' unless py.from_osx? + ENV.prepend 'CMAKE_INCLUDE_PATH', py.incdir, File::PATH_SEPARATOR + ENV.prepend 'PKG_CONFIG_PATH', py.pkg_config_path, File::PATH_SEPARATOR if py.pkg_config_path + ENV.prepend 'PATH', py.binary.dirname, File::PATH_SEPARATOR unless py.from_osx? #Note: Don't set LDFLAGS to point to the Python.framework, because # it breaks builds (for example scipy.) diff --git a/Library/Homebrew/requirements/python_dependency.rb b/Library/Homebrew/requirements/python_dependency.rb index 5eca9cf302..6a18883df8 100644 --- a/Library/Homebrew/requirements/python_dependency.rb +++ b/Library/Homebrew/requirements/python_dependency.rb @@ -122,7 +122,7 @@ class PythonInstalled < Requirement else # Using the ORIGINAL_PATHS here because in superenv, the user # installed external Python is not visible otherwise. - which(@name, ORIGINAL_PATHS.join(':')) + which(@name, ORIGINAL_PATHS.join(File::PATH_SEPARATOR)) end end end @@ -252,12 +252,12 @@ class PythonInstalled < Requirement file.write(sitecustomize) # For non-system python's we add the opt_prefix/bin of python to the path. - ENV.prepend 'PATH', binary.dirname, ':' unless from_osx? + ENV.prepend 'PATH', binary.dirname, File::PATH_SEPARATOR unless from_osx? ENV['PYTHONHOME'] = nil # to avoid fuck-ups. ENV['PYTHONPATH'] = if brewed? then nil; else global_site_packages.to_s; end - ENV.append 'CMAKE_INCLUDE_PATH', incdir, ':' - ENV.append 'PKG_CONFIG_PATH', pkg_config_path, ':' if pkg_config_path + ENV.append 'CMAKE_INCLUDE_PATH', incdir, File::PATH_SEPARATOR + ENV.append 'PKG_CONFIG_PATH', pkg_config_path, File::PATH_SEPARATOR if pkg_config_path # We don't set the -F#{framework} here, because if Python 2.x and 3.x are # used, `Python.framework` is ambiguous. However, in the `python do` block # we can set LDFLAGS+="-F#{framework}" because only one is temporarily set. diff --git a/Library/Homebrew/test/testing_env.rb b/Library/Homebrew/test/testing_env.rb index 5c2efed73a..9bc5d871fb 100644 --- a/Library/Homebrew/test/testing_env.rb +++ b/Library/Homebrew/test/testing_env.rb @@ -33,7 +33,7 @@ MACOS = true MACOS_FULL_VERSION = `/usr/bin/sw_vers -productVersion`.chomp MACOS_VERSION = ENV.fetch('MACOS_VERSION') { MACOS_FULL_VERSION[/10\.\d+/] }.to_f -ORIGINAL_PATHS = ENV['PATH'].split(':').map{ |p| Pathname.new(p).expand_path rescue nil }.compact.freeze +ORIGINAL_PATHS = ENV['PATH'].split(File::PATH_SEPARATOR).map{ |p| Pathname.new(p).expand_path rescue nil }.compact.freeze module Homebrew extend self include FileUtils diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 2224e4ed00..b10764803a 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -167,7 +167,7 @@ def puts_columns items, star_items=[] end def which cmd, path=ENV['PATH'] - dir = path.split(':').find {|p| File.executable? File.join(p, cmd)} + dir = path.split(File::PATH_SEPARATOR).find {|p| File.executable? File.join(p, cmd)} Pathname.new(File.join(dir, cmd)) unless dir.nil? end