source: cowsclient/trunk/cowsclient/scripts/build_cc_openlayes.py @ 6119

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cowsclient/trunk/cowsclient/scripts/build_cc_openlayes.py@6119
Revision 6119, 1.3 KB checked in by pnorton, 10 years ago (diff)

Made several changes to try and reduce the amount of data to download on the wmsviz page. Also created a single place where the js files for the wmsviz page are listed.

Line 
1'''
2Created on 10 Dec 2009
3
4@author: pnorton
5'''
6
7import pkg_resources
8import os
9import sys
10import pprint
11
12
13CONFIG_FILE_NAME = 'cc_openlayers_config'
14
15# the single file script uses this name to find its <script> tag and then uses
16# that to generate the image + theme import path, changing this name will
17# result in this code breaking and the image + theme imports being incorrect.
18OUTPUT_FILE_NAME = 'OpenLayers.js'
19
20
21
22
23
24if __name__ == '__main__':
25
26    openlayersDir = os.path.join(pkg_resources.resource_filename('cowsclient',''), 'public/js/openlayers')
27    buildDir = os.path.join(openlayersDir, 'build')
28    buildFile = os.path.join(buildDir, 'build.py')
29   
30    #add the openlayers tools directory to the path
31    #sys.path.append(os.path.join(openlayersDir, "tools"))
32   
33    os.chdir(buildDir)
34   
35    pprint.pprint(sys.path)
36    import mergejs
37    outputsDir = os.path.join(pkg_resources.resource_filename('cowsclient',''), 'public/js/cc_openlayers')
38    outputFile = os.path.join(outputsDir, OUTPUT_FILE_NAME)
39   
40   
41    scriptsDir = os.path.join(pkg_resources.resource_filename('cowsclient',''), 'scripts')
42    configFile = os.path.join(scriptsDir, CONFIG_FILE_NAME)
43   
44    cmd = 'python "%s" %s "%s"' % (buildFile, configFile, outputFile)
45    print "running ", cmd
46    ret = os.system(cmd)
47   
48    print "returned", ret   
49   
Note: See TracBrowser for help on using the repository browser.