aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend
diff options
context:
space:
mode:
authorAmos Wenger2013-08-15 21:50:13 +0200
committerJack Nagel2013-08-19 13:35:44 -0500
commit52ace99f14a9390f5bf71370d616f2ed6b98c034 (patch)
tree48580569d443ddbebf2a06f99efb3a0ebe94208a /Library/Homebrew/extend
parent809a52a6a3e8b0899aa2697f767b8dcc22210bd8 (diff)
downloadbrew-52ace99f14a9390f5bf71370d616f2ed6b98c034.tar.bz2
Use File::PATH_SEPARATOR globally instead of ':'
On Unix, the path separator is ':', whereas on Windows, it is ';'. This is the first of a series of patch to bring macbrew's and winbrew's codebases closer together. The main places the magic constant ':' was being used were: - the $PATH environment variable - CMAKE-related environment variables - pkg-config related environment variables Closes Homebrew/homebrew#21921. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Homebrew/extend')
-rw-r--r--Library/Homebrew/extend/ENV/shared.rb6
-rw-r--r--Library/Homebrew/extend/ENV/std.rb26
-rw-r--r--Library/Homebrew/extend/ENV/super.rb4
3 files changed, 18 insertions, 18 deletions
diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb
index 0b5fee954..5ceecd844 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 24007a46d..caf0471e8 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 5bfa34437..84247b2fd 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