[6] | 1 | # |
---|
| 2 | # Python script to create a windows distribution, |
---|
| 3 | # currently a gzipped tar file. I had a |
---|
| 4 | # fancy installer but (i) it required a separate |
---|
| 5 | # 23Mb download for the .NET framework and (ii) it |
---|
| 6 | # probably wouldn't have run at GA anyway. |
---|
| 7 | # |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | # convenience function for building file list |
---|
| 11 | import os |
---|
| 12 | def DLLFiles( directory, list ): |
---|
[96] | 13 | return [ os.sep.join( [directory, name+'.dll'] ) for name in list ] |
---|
[6] | 14 | |
---|
| 15 | |
---|
| 16 | #---- NAME ------------------------------------------------------------ |
---|
| 17 | |
---|
| 18 | from datetime import datetime |
---|
| 19 | distro = datetime.today().strftime('distro%Y%m%d.tgz') |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | #---- LOCAL DEPENDENCIES ---------------------------------------------- |
---|
| 24 | |
---|
| 25 | # local directories |
---|
| 26 | localrootdir = '..' |
---|
| 27 | localbindir = localrootdir + os.sep + 'bin' |
---|
| 28 | |
---|
| 29 | # local files |
---|
| 30 | localdlls = DLLFiles( localbindir, ['swwreader'] ) |
---|
[96] | 31 | localfiles = [ os.sep.join( [localbindir, f] ) for f in \ |
---|
[6] | 32 | ['swollen.exe', # the executable |
---|
| 33 | 'sky_small.jpg', # sky texture |
---|
| 34 | 'envmap.jpg', # water surface environment map |
---|
[52] | 35 | 'bedslope.jpg']] # surface texture |
---|
[6] | 36 | |
---|
[96] | 37 | # sample sww file for testing |
---|
| 38 | localtestdir = localrootdir + os.sep + 'tests' |
---|
[116] | 39 | #localfiles.append(localtestdir + os.sep + 'cylinders.sww') |
---|
| 40 | #localfiles.append(localtestdir + os.sep + 'cylinders.tif') |
---|
[6] | 41 | |
---|
| 42 | |
---|
| 43 | #----- NETCDF DEPENDENCIES -------------------------------------------- |
---|
| 44 | |
---|
| 45 | # netcdf directory |
---|
| 46 | netcdfdir = os.environ['NETCDF_DIR'] |
---|
| 47 | |
---|
| 48 | # netcdf DLL |
---|
| 49 | netcdfdll = os.sep.join( [netcdfdir, 'bin', 'netcdf.dll'] ) |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | #----- OSG DEPENDENCIES ----------------------------------------------- |
---|
| 54 | |
---|
| 55 | # OSG directories |
---|
| 56 | osgrootdir = os.environ['OSG_ROOT'] |
---|
| 57 | osgdir = os.sep.join( [osgrootdir,'OpenSceneGraph','bin'] ) |
---|
| 58 | producerdir = os.sep.join( [osgrootdir,'Producer','bin'] ) |
---|
| 59 | openthreadsdir = os.sep.join( [osgrootdir,'OpenThreads','bin','win32'] ) |
---|
| 60 | |
---|
| 61 | # OSG/Producer/OpenThreads DLLs |
---|
| 62 | producerdll = DLLFiles( producerdir, ['Producer'] ) |
---|
| 63 | openthreadsdll = DLLFiles( openthreadsdir, ['OpenThreadsWin32'] ) |
---|
| 64 | osgdlls = DLLFiles( osgdir, ['osg', 'osgdb', 'osgGA', 'osgProducer', 'osgText', 'osgUtil'] ) |
---|
| 65 | |
---|
| 66 | # supported database loaders (osgdb_XXX.dll) |
---|
[96] | 67 | osgimgformats = [ 'osgdb_'+f for f in ['jpeg', 'png', 'tiff', 'freetype'] ] |
---|
[6] | 68 | osgimgdlls = DLLFiles( osgdir, osgimgformats ) |
---|
| 69 | |
---|
[96] | 70 | # third party dlls |
---|
| 71 | thirdpartydir = os.sep.join( [osgrootdir,'3rdparty','bin'] ) |
---|
| 72 | thirdpartydlls = DLLFiles( thirdpartydir, ['gdal12', 'glut32', 'msvcp71', 'msvcr71'] ) |
---|
| 73 | |
---|
[6] | 74 | # All OSG DLLs |
---|
[96] | 75 | osgdlls = producerdll + openthreadsdll + osgdlls + osgimgdlls + thirdpartydlls |
---|
[6] | 76 | |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | #------ ARCHIVE ------------------------------------------------------- |
---|
| 80 | |
---|
| 81 | # all files above |
---|
[96] | 82 | files = localfiles + localdlls + osgdlls + [netcdfdll] |
---|
[6] | 83 | files.sort() |
---|
| 84 | |
---|
| 85 | import tarfile |
---|
| 86 | import os.path |
---|
| 87 | print "creating tgz archive %s" % distro |
---|
| 88 | t = tarfile.open( distro, 'w:gz' ) |
---|
| 89 | for f in files: |
---|
| 90 | basename = os.path.basename(f) |
---|
| 91 | print "\tadding %s" % basename |
---|
| 92 | t.add( f, basename ) |
---|
| 93 | t.close() |
---|
| 94 | |
---|
[96] | 95 | cmd = "scp %s dee900@anusf.anu.edu.au:public_html/Projects/Swollen/Releases" % distro |
---|
| 96 | os.system(cmd) |
---|