diff options
| author | Samuel John | 2012-12-04 15:13:13 +0100 |
|---|---|---|
| committer | Adam Vandenberg | 2012-12-04 09:57:57 -0800 |
| commit | e09d6239ee9bb20130b766bb70a23d9ba7c79c38 (patch) | |
| tree | e26230e3a54bd1a2008216270d345db69f132feb /Library | |
| parent | fb393c06b91fc00947f05ce64516b282c382c87b (diff) | |
| download | homebrew-e09d6239ee9bb20130b766bb70a23d9ba7c79c38.tar.bz2 | |
vtk: random fixes
- Patch to fix Wrapping/Python/setup_install_paths.py of vtk.
- Now using --single-version-externally-managed instead of
manually moving around the Python egg.
- Simplified and reordered the Python-related args because
Apple and Homebrew both only build frameworked Pythons.
Fixes #16254.
Closes #16397.
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/vtk.rb | 68 |
1 files changed, 33 insertions, 35 deletions
diff --git a/Library/Formula/vtk.rb b/Library/Formula/vtk.rb index 385ecb16f..c55de372e 100644 --- a/Library/Formula/vtk.rb +++ b/Library/Formula/vtk.rb @@ -22,6 +22,11 @@ class Vtk < Formula option 'tcl', 'Enable Tcl wrapping of VTK classes' option 'x11', 'Enable X11 extension rather than OSX native Aqua' + def patches + # Fix bug in Wrapping/Python/setup_install_paths.py: http://vtk.org/Bug/view.php?id=13699 + DATA + end + def install args = std_cmake_args + %W[ -DVTK_REQUIRED_OBJCXX_FLAGS='' @@ -35,34 +40,24 @@ class Vtk < Formula args << '-DBUILD_EXAMPLES=' + ((build.include? 'examples') ? 'ON' : 'OFF') if build.include? 'python' + args << '-DVTK_WRAP_PYTHON=ON' + + # Cmake picks up the system's python dylib, even if we have a brewed one. python_prefix = `python-config --prefix`.strip + args << "-DPYTHON_LIBRARY='#{python_prefix}/Python'" + # Install to lib and let installer symlink to global python site-packages. # The path in lib needs to exist first and be listed in PYTHONPATH. pydir = lib/which_python/'site-packages' pydir.mkpath - ENV.prepend 'PYTHONPATH', pydir, ':' - args << "-DVTK_PYTHON_SETUP_ARGS='--prefix=#{prefix}'" - # Python is actually a library. The libpythonX.Y.dylib points to this lib, too. - if File.exist? "#{python_prefix}/Python" - # Python was compiled with --framework: - args << "-DPYTHON_LIBRARY='#{python_prefix}/Python'" - if !MacOS::CLT.installed? and python_prefix.start_with? '/System/Library' - # For Xcode-only systems, the headers of system's python are inside of Xcode - args << "-DPYTHON_INCLUDE_DIR='#{MacOS.sdk_path}/System/Library/Frameworks/Python.framework/Versions/2.7/Headers'" - else - args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/Headers'" - end - else - python_version = `python-config --libs`.match('-lpython(\d+\.\d+)').captures.at(0) - python_lib = "#{python_prefix}/lib/libpython#{python_version}" - if File.exists? "#{python_lib}.a" - args << "-DPYTHON_LIBRARY='#{python_lib}.a'" - else - args << "-DPYTHON_LIBRARY='#{python_lib}.dylib'" - end - args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/include/#{which_python}'" + ENV['PYTHONPATH'] = pydir + args << "-DVTK_PYTHON_SETUP_ARGS:STRING='--prefix=#{prefix} --install-lib=#{pydir} --single-version-externally-managed --record=installed-files.txt'" + + # For Xcode-only systems, the headers of system's python are inside of Xcode + if !MacOS::CLT.installed? and python_prefix.start_with? '/System/Library' + args << "-DPYTHON_INCLUDE_DIR='#{MacOS.sdk_path}/System/Library/Frameworks/Python.framework/Versions/2.7/Headers'" end - args << '-DVTK_WRAP_PYTHON=ON' + if build.include? 'pyqt' args << '-DVTK_WRAP_PYTHON_SIP=ON' args << "-DSIP_PYQT_DIR='#{HOMEBREW_PREFIX}/share/sip'" @@ -77,7 +72,7 @@ class Vtk < Formula args << '-DVTK_WRAP_TCL=ON' if build.include? 'tcl' - # default to cocoa for everything except x11 + # Cocoa for everything except x11 if build.include? 'x11' args << '-DVTK_USE_COCOA=OFF' args << '-DVTK_USE_X=ON' @@ -101,18 +96,6 @@ class Vtk < Formula end (share+'vtk').install 'Examples' if build.include? 'examples' - - # Finalize a couple of Python issues due to our installing into the cellar. - if build.include? 'python' - # Avoid the .egg and use the python module right away, because - # system python does not read .pth files from our site-packages. - mv pydir/'VTK-5.10.0-py2.7.egg/vtk', pydir/'vtk' - - # Remove files with duplicates in /usr/local/lib/python2.7/site-packages - %w(site.py site.pyc easy-install.pth VTK-5.10.0-py2.7.egg).each do |f| - rmtree pydir/f - end - end end def caveats @@ -144,3 +127,18 @@ class Vtk < Formula "python" + `python -c 'import sys;print(sys.version[:3])'`.strip end end + +__END__ +diff --git a/Wrapping/Python/setup_install_paths.py b/Wrapping/Python/setup_install_paths.py +index 00f48c8..014b906 100755 +--- a/Wrapping/Python/setup_install_paths.py ++++ b/Wrapping/Python/setup_install_paths.py +@@ -35,7 +35,7 @@ def get_install_path(command, *args): + option, value = string.split(arg,"=") + options[option] = value + except ValueError: +- options[option] = 1 ++ options[arg] = 1 + + # check for the prefix and exec_prefix + try: |
