diff --git a/Code/Mantid/MantidPlot/FixMavericksBundle.cmake.in b/Code/Mantid/MantidPlot/FixMavericksBundle.cmake.in index 6abe55b6806c..572443874d5a 100644 --- a/Code/Mantid/MantidPlot/FixMavericksBundle.cmake.in +++ b/Code/Mantid/MantidPlot/FixMavericksBundle.cmake.in @@ -1,3 +1,6 @@ set ( bundle ${CMAKE_INSTALL_PREFIX}/MantidPlot.app ) execute_process(COMMAND chmod +x make_package.rb WORKING_DIRECTORY ${bundle}) -execute_process(COMMAND ./make_package.rb WORKING_DIRECTORY ${bundle}) +execute_process(COMMAND ./make_package.rb WORKING_DIRECTORY ${bundle} RESULT_VARIABLE install_name_tool_result) +if(NOT install_name_tool_result EQUAL 0) + message(FATAL_ERROR "Package script failed!!!\n") +endif() diff --git a/Code/Mantid/MantidPlot/make_package.rb b/Code/Mantid/MantidPlot/make_package.rb index 78a57d600b65..3a3b635251b3 100755 --- a/Code/Mantid/MantidPlot/make_package.rb +++ b/Code/Mantid/MantidPlot/make_package.rb @@ -3,6 +3,22 @@ require 'pathname' +def copyFile(file) + p "copying file #{file}" + output = system("cp #{file} Contents/MacOS/") + if output != true + exit 1 + end +end + +def addPythonLibrary(directory) + p "copying directory #{directory}" + output = system("rsync -a --exclude=.pyc #{directory} Contents/MacOS/") + if output != true + exit 1 + end +end + lib_dir = Pathname.new("/usr/local/lib") openssl_dir = Pathname.new("/usr/local/opt/openssl/lib") @@ -51,11 +67,11 @@ #This copies the libraries over, then changes permissions and the id from /usr/local/lib to @rpath library_filenames.each do |filename| if filename.include? "libssl.dylib" - `cp #{openssl_dir+filename} Contents/MacOS/` + copyFile(openssl_dir+filename) elsif filename.include? "libcrypto.dylib" - `cp #{openssl_dir+filename} Contents/MacOS/` + copyFile(openssl_dir+filename) else - `cp #{lib_dir+filename} Contents/MacOS/` + copyFile(lib_dir+filename) end `chmod +w Contents/MacOS/#{filename}` `install_name_tool -id @rpath/#{filename} Contents/MacOS/#{filename}` @@ -151,33 +167,21 @@ `install_name_tool -change /usr/local/lib/QtCore.framework/Versions/4/QtCore @loader_path/../../Frameworks/QtCore.framework/Versions/4/QtCore Contents/MacOS/PyQt4/QtXml.so` #Copy over python libraries not included with OSX. -`cp -r /Library/Python/2.7/site-packages/sphinx Contents/MacOS/` -`cp -r /Library/Python/2.7/site-packages/sphinx_bootstrap_theme Contents/MacOS/` -`cp -r /Library/Python/2.7/site-packages/IPython Contents/MacOS/` -`cp -r /Library/Python/2.7/site-packages/zmq Contents/MacOS/` -`cp -r /Library/Python/2.7/site-packages/pygments Contents/MacOS/` - -#add other dependencies found in current package #currently missing epics -`cp /Library/Python/2.7/site-packages/gnureadline.so Contents/MacOS/` -`cp /Library/Python/2.7/site-packages/readline.py Contents/MacOS/` -`cp /Library/Python/2.7/site-packages/readline.pyc Contents/MacOS/` -`cp /Library/Python/2.7/site-packages/pyparsing.py Contents/MacOS/` -`cp /Library/Python/2.7/site-packages/pyparsing.pyc Contents/MacOS/` -`cp -r /Library/Python/2.7/site-packages/_markerlib/ Contents/MacOS/` -`cp -r /Library/Python/2.7/site-packages/backports Contents/MacOS/` -`cp -r /Library/Python/2.7/site-packages/certifi Contents/MacOS/` -`cp -r /Library/Python/2.7/site-packages/tornado Contents/MacOS/` -`cp -r /Library/Python/2.7/site-packages/markupsafe Contents/MacOS/` -`cp -r /Library/Python/2.7/site-packages/jinja2 Contents/MacOS/` -`cp -r /usr/local/lib/python2.7/site-packages/nxs Contents/MacOS/` -`cp -r /Library/Python/2.7/site-packages/psutil Contents/MacOS/` +path = "/Library/Python/2.7/site-packages" +directories = ["sphinx","sphinx_bootstrap_theme","IPython","zmq","pygments","backports","certifi","tornado","markupsafe","jinja2","psutil"] +directories.each do |directory| + addPythonLibrary("#{path}/#{directory}") +end + +files = ["gnureadline.so","readline.py","pyparsing.py"] +files.each do |file| + copyFile("#{path}/#{file}") +end + `mkdir Contents/MacOS/bin` `cp /usr/local/bin/ipython Contents/MacOS/bin/` -# current .pyc files have permissions issues. These files are recreated by CPack. -`rm Contents/MacOS/nxs/*.pyc` - #Lastly check for any libraries in the package linking against homebrew libraries. search_patterns.each do |pattern| Dir[pattern].each do |library| @@ -185,6 +189,7 @@ dependencies.split("\n").each do |dependency| if dependency.include? "/usr/local/" p "issue with library: #{library} linked against: #{dependency}" + exit 1 end end end