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 ): |
---|
13 | return [ os.sep.join( [directory, XXX+'.dll'] ) for XXX in list ] |
---|
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'] ) |
---|
31 | localfiles = [ os.sep.join( [localbindir, XXX] ) for XXX in \ |
---|
32 | ['swollen.exe', # the executable |
---|
33 | 'sky_small.jpg', # sky texture |
---|
34 | 'envmap.jpg', # water surface environment map |
---|
35 | 'bedslope.jpg', # surface texture |
---|
36 | 'laminar.sww']] # sample sww file for testing |
---|
37 | |
---|
38 | |
---|
39 | |
---|
40 | #----- NETCDF DEPENDENCIES -------------------------------------------- |
---|
41 | |
---|
42 | # netcdf directory |
---|
43 | netcdfdir = os.environ['NETCDF_DIR'] |
---|
44 | |
---|
45 | # netcdf DLL |
---|
46 | netcdfdll = os.sep.join( [netcdfdir, 'bin', 'netcdf.dll'] ) |
---|
47 | |
---|
48 | |
---|
49 | |
---|
50 | #----- OSG DEPENDENCIES ----------------------------------------------- |
---|
51 | |
---|
52 | # OSG directories |
---|
53 | osgrootdir = os.environ['OSG_ROOT'] |
---|
54 | osgdir = os.sep.join( [osgrootdir,'OpenSceneGraph','bin'] ) |
---|
55 | producerdir = os.sep.join( [osgrootdir,'Producer','bin'] ) |
---|
56 | openthreadsdir = os.sep.join( [osgrootdir,'OpenThreads','bin','win32'] ) |
---|
57 | |
---|
58 | # OSG/Producer/OpenThreads DLLs |
---|
59 | producerdll = DLLFiles( producerdir, ['Producer'] ) |
---|
60 | openthreadsdll = DLLFiles( openthreadsdir, ['OpenThreadsWin32'] ) |
---|
61 | osgdlls = DLLFiles( osgdir, ['osg', 'osgdb', 'osgGA', 'osgProducer', 'osgText', 'osgUtil'] ) |
---|
62 | |
---|
63 | # supported database loaders (osgdb_XXX.dll) |
---|
64 | osgimgformats = [ 'osgdb_'+XXX for XXX in ['jpeg', 'png', 'tiff', 'freetype'] ] |
---|
65 | osgimgdlls = DLLFiles( osgdir, osgimgformats ) |
---|
66 | |
---|
67 | # All OSG DLLs |
---|
68 | osgdlls = producerdll + openthreadsdll + osgdlls + osgimgdlls |
---|
69 | |
---|
70 | |
---|
71 | |
---|
72 | #------ VISUAL STUDIO DEPENDENCIES ------------------------------------ |
---|
73 | |
---|
74 | # Visual Studio runtime directory |
---|
75 | vsdir = os.environ['SYSTEMROOT'] + os.sep + 'system32' |
---|
76 | |
---|
77 | # DLLs |
---|
78 | vsdlls = DLLFiles( vsdir, ['msvcp71', 'msvcr71'] ) |
---|
79 | |
---|
80 | |
---|
81 | |
---|
82 | #------ ARCHIVE ------------------------------------------------------- |
---|
83 | |
---|
84 | # all files above |
---|
85 | files = localfiles + localdlls + osgdlls + [netcdfdll] + vsdlls |
---|
86 | files.sort() |
---|
87 | |
---|
88 | import tarfile |
---|
89 | import os.path |
---|
90 | print "creating tgz archive %s" % distro |
---|
91 | t = tarfile.open( distro, 'w:gz' ) |
---|
92 | for f in files: |
---|
93 | basename = os.path.basename(f) |
---|
94 | print "\tadding %s" % basename |
---|
95 | t.add( f, basename ) |
---|
96 | t.close() |
---|
97 | |
---|