From 679b1ba8afca96508d6449a691fef470f0dbdaa6 Mon Sep 17 00:00:00 2001
From: Mohcine Chraibi <m.chraibi@fz-juelich.de>
Date: Thu, 28 Mar 2019 19:12:00 +0100
Subject: [PATCH] update deplot script

---
 checkDependencies.py | 21 ++++++++-------
 deployAPPLE.sh       | 63 +++-----------------------------------------
 2 files changed, 15 insertions(+), 69 deletions(-)

diff --git a/checkDependencies.py b/checkDependencies.py
index 4ce44a0..b26ebc1 100644
--- a/checkDependencies.py
+++ b/checkDependencies.py
@@ -1,6 +1,6 @@
 # some vtk libs depend on python.
 # correct this dependency and make it point to local python.
-import glob2
+import glob
 import subprocess
 import shlex
 import os
@@ -16,13 +16,14 @@ PATH = sys.argv[1] + "/Contents/Frameworks"
 CMD = "jpsvis"
 # PATH = "./bin/%s.app/Contents/Frameworks"  % CMD
 # PATH = "/Volumes/jpsvis\ 0.7.0/jpsvis.app/Contents/Frameworks/"
-dependencies = glob2.glob("%s/**/*.dylib"%PATH)
+dependencies = glob.glob("%s/**/*.dylib"%PATH)
 
+print("VTK dependencies: ", len(dependencies))
 
 #VTK_LIBS
 for vtklib in dependencies:
-    
-    print "lib: <%s>" % vtklib
+
+    print("lib: <%s>" % vtklib)
 
     cmd = "otool -L %s" % vtklib
     f = open("blah.txt", "w")
@@ -36,13 +37,13 @@ for vtklib in dependencies:
            and not line.startswith("/System") \
            and not line.startswith("@executable_path"):
 
-            print "%s >> <%s> %s" % (RED, line.split()[0], NC)
+            print("%s >> <%s> %s" %(RED, line.split()[0], NC))
             change = "install_name_tool -change %s @executable_path/../Frameworks/Python.framework/Versions/3.5/Python %s"%(line.split()[0], vtklib)
-            print "<%s>" % change
+            print("<%s>" % change)
             res = subprocess.call(shlex.split(change))
-            raw_input("pause ...")
-            
+            input("pause ...")
+
     f.close()
 
-if os.path.exists ("blah.txt"):
-    os.remove("blah.txt")    
+if os.path.exists("blah.txt"):
+    os.remove("blah.txt")
diff --git a/deployAPPLE.sh b/deployAPPLE.sh
index 2069f0c..efc8bb0 100755
--- a/deployAPPLE.sh
+++ b/deployAPPLE.sh
@@ -1,67 +1,12 @@
-
 RED='\033[0;31m'
 NC='\033[0m' # No Color
 
 CMD="jpsvis"
+VERSION=0.8.4
 
 
-if [ -d build ];then
-    echo "INFO: found build directory"
-    echo "INFO:${RED} rm build ${NC}"
-    rm -rf build
-    echo "INFO: mkdir build"
-    mkdir build
-fi
-
-echo "INFO: cd build"
-cd build
-
-echo "INFO: actual directory: ${PWD}"
-
-if [ -d ../bin ]; then
-    echo "INFO: found bin directory"
-    echo "INFO:${RED} remove ./bin directory ${NC}"
-    rm -rf ../bin
-fi
-
-echo "INFO: cmake .."
-cmake ..
-
-echo "INFO: make .."
-make -j4
-
-
-echo "INFO: running  <dylibbundler -od -b -x ../bin/${CMD}.app/Contents/MacOS/${CMD} -d ../bin/${CMD}.app/Contents/libs/>"
-dylibbundler -od -b -x ../bin/${CMD}.app/Contents/MacOS/${CMD} -d ../bin/${CMD}.app/Contents/libs/
-
-
-# dylibbundler has a problem linking to local python framework. So this quick fix..
-isPythonDependencyGlobal=`otool -L ../bin/${CMD}.app/Contents/MacOS/${CMD} | grep Python.framework`
-
-echo "isPythonDependencyGlobal: <$isPythonDependencyGlobal>"
-
-if [[ -n $isPythonDependencyGlobal ]];then
-    if [[ ! $isPythonSWDependencyGlobal == *"@executable_path"* ]]; then
-        #install_name_tool -change /usr/local/opt/python3/Frameworks/Python.framework/Versions/3.5/Python
-        #                           @executable_path/../Frameworks/Python.framework/Versions/3.5/Python
-        #                           ./bin/jpsvis.app/Contents/MacOS/jpsvis
-        
-        Python=`echo ${isPythonDependencyGlobal} | xargs | awk '{print $1}'`
-        echo "WARNING: ${RED} <$Python> is not relative to ${CMD} ${NC}."
-        
-        Frameworks=`echo ${Python} |  awk -F Frameworks '{ print "Frameworks"$2 }'`
-        echo "WARNING: ${RED} change <$Python> to <@executable_path/../$Frameworks> ${CMD} ${NC}."
-
-        install_name_tool -change $Python @executable_path/../$Frameworks ../bin/${CMD}.app/Contents/MacOS/${CMD}
-
-        echo "INFO: Check again"
-        otool -L ../bin/${CMD}.app/Contents/MacOS/${CMD} | grep Python.framework
-        echo "-----------------"
-
-    fi
-fi
-
+#cd ..
 # check if dependencies to libs are local to .app
-python checkDependencies.py 
+python checkDependencies.py bin/jpsvis.app/
 
-appdmg Resources/dmg.json {CMD}-0.8.1.dmg
+appdmg Resources/dmg.json ${CMD}-${VERSION}.dmg
-- 
GitLab