# # Python script to create a windows distribution, # currently a gzipped tar file. I had a # fancy installer but (i) it required a separate # 23Mb download for the .NET framework and (ii) it # probably wouldn't have run at GA anyway. # # convenience function for building file list import os def DLLFiles( directory, list ): return [ os.sep.join( [directory, name+'.dll'] ) for name in list ] #---- NAME ------------------------------------------------------------ from datetime import datetime distro = datetime.today().strftime('distro%Y%m%d.tgz') #---- LOCAL DEPENDENCIES ---------------------------------------------- # local directories localrootdir = '..' localbindir = localrootdir + os.sep + 'bin' # local files localdlls = DLLFiles( localbindir, ['swwreader'] ) localfiles = [ os.sep.join( [localbindir, f] ) for f in \ ['swollen.exe', # the executable 'sky_small.jpg', # sky texture 'envmap.jpg', # water surface environment map 'bedslope.jpg']] # surface texture # sample sww file for testing localtestdir = localrootdir + os.sep + 'tests' localfiles.append(localtestdir + os.sep + 'cylinders2.sww') localfiles.append(localtestdir + os.sep + 'cylinders2.tif') #----- NETCDF DEPENDENCIES -------------------------------------------- # netcdf directory netcdfdir = os.environ['NETCDF_DIR'] # netcdf DLL netcdfdll = os.sep.join( [netcdfdir, 'bin', 'netcdf.dll'] ) #----- OSG DEPENDENCIES ----------------------------------------------- # OSG directories osgrootdir = os.environ['OSG_ROOT'] osgdir = os.sep.join( [osgrootdir,'OpenSceneGraph','bin'] ) producerdir = os.sep.join( [osgrootdir,'Producer','bin'] ) openthreadsdir = os.sep.join( [osgrootdir,'OpenThreads','bin','win32'] ) # OSG/Producer/OpenThreads DLLs producerdll = DLLFiles( producerdir, ['Producer'] ) openthreadsdll = DLLFiles( openthreadsdir, ['OpenThreadsWin32'] ) osgdlls = DLLFiles( osgdir, ['osg', 'osgdb', 'osgGA', 'osgProducer', 'osgText', 'osgUtil'] ) # supported database loaders (osgdb_XXX.dll) osgimgformats = [ 'osgdb_'+f for f in ['jpeg', 'png', 'tiff', 'freetype'] ] osgimgdlls = DLLFiles( osgdir, osgimgformats ) # third party dlls thirdpartydir = os.sep.join( [osgrootdir,'3rdparty','bin'] ) thirdpartydlls = DLLFiles( thirdpartydir, ['gdal12', 'glut32', 'msvcp71', 'msvcr71'] ) # All OSG DLLs osgdlls = producerdll + openthreadsdll + osgdlls + osgimgdlls + thirdpartydlls #------ ARCHIVE ------------------------------------------------------- # all files above files = localfiles + localdlls + osgdlls + [netcdfdll] files.sort() import tarfile import os.path print "creating tgz archive %s" % distro t = tarfile.open( distro, 'w:gz' ) for f in files: basename = os.path.basename(f) print "\tadding %s" % basename t.add( f, basename ) t.close() cmd = "scp %s dee900@anusf.anu.edu.au:public_html/Projects/Swollen/Releases" % distro os.system(cmd)