config.read(os.path.join(current_directory, config_filename))
# third argument of get: interpolation(0) or raw mode(1)
cmake_archive=config.get('Prerequisites', 'cmake_archive', 0)
-python_archive=config.get('Prerequisites', 'python_archive', 0)
+cmake_url=config.get('Prerequisites', 'cmake_url', 0)
hdf5_archive=config.get('Prerequisites', 'hdf5_archive', 0)
+hdf5_url=config.get('Prerequisites', 'hdf5_url', 0)
swig_archive=config.get('Prerequisites', 'swig_archive', 0)
+swig_url=config.get('Prerequisites', 'swig_url', 0)
qt_archive=config.get('Prerequisites', 'qt_archive', 0)
+qt_url=config.get('Prerequisites', 'qt_url', 0)
med_archive=config.get('Prerequisites', 'med_archive', 0)
+med_url=config.get('Prerequisites', 'med_url', 0)
+python_archive=config.get('Prerequisites', 'python_archive', 0)
+python_url=config.get('Prerequisites', 'python_url', 0)
python_version_short=config.get('Prerequisites', 'python_version_short', 0)
python_version_long=config.get('Prerequisites', 'python_version_long', 0)
swig_version=config.get('Prerequisites', 'swig_version', 0)
+swig_url=config.get('Prerequisites', 'swig_url', 0)
paraview_git_repo=config.get('ParaView', 'paraview_git_repo', 0)
paraview_git_version=config.get('ParaView', 'paraview_git_version', 0)
paraview_version=config.get('ParaView', 'paraview_version', 0)
gui_version=config.get('SALOME', 'gui_version', 0)
paravis_version=config.get('SALOME', 'paravis_version', 0)
make_nb_jobs=config.get('Build options', 'make_nb_jobs', 0)
+do_archive_download=config.getboolean('Build options', 'do_archive_download')
-
-# Prepare build
+# Download archives
local_archives_path=os.path.join(current_directory,"archives")
+if not os.path.exists(local_archives_path):
+ os.makedirs(local_archives_path)
+ do_archive_download=True
+ pass
+
+import urllib2
+def download(url, outfile):
+ print "Downloading",outfile,"..."
+ if os.path.exists(outfile):
+ print "Already downloaded" # :TODO: should include MD5 check
+ return
+ try:
+ remotefile=urllib2.urlopen(url)
+ except urllib2.HTTPError:
+ print "Unable to fetch url:", url
+ sys.exit(1)
+ pass
+ with open(outfile,'w') as localfile:
+ buf = remotefile.read(65536)
+ while buf != "":
+ localfile.write(buf)
+ buf = remotefile.read(65536)
+ pass
+ pass
+ remotefile.close()
+ pass
cmakeLoc=os.path.join(local_archives_path,cmake_archive)
pythonLoc=os.path.join(local_archives_path,python_archive)
qtLoc=os.path.join(local_archives_path,qt_archive)
medLoc=os.path.join(local_archives_path,med_archive)
+if not os.path.exists(cmakeLoc) \
+ or not os.path.exists(pythonLoc) \
+ or not os.path.exists(hdf5Loc) \
+ or not os.path.exists(swigLoc) \
+ or not os.path.exists(qtLoc) \
+ or not os.path.exists(medLoc):
+ do_archive_download=True
+ pass
+
+if do_archive_download:
+ download(cmake_url, cmakeLoc)
+ download(med_url, medLoc)
+ download(hdf5_url, hdf5Loc)
+ download(swig_url, swigLoc)
+ download(qt_url, qtLoc)
+ download(python_url, pythonLoc)
+ pass
+
+
+# Prepare build
paraviewLoc=(paraview_git_repo,paraview_git_version)
medcouplingLoc=(os.path.join(salome_git_repo,"tools","medcoupling.git"),medcoupling_version)
compErr="compile_err.log"
okFlag=".install_ok"
+
+# Manage environment
+
def cmake_Environ(installDir,envAcc):
pathAdd=[os.path.join(installDir,"bin")]
addEnv(envAcc,"PATH",pathAdd)