/
build.sahana.py
executable file
·731 lines (631 loc) · 22.9 KB
/
build.sahana.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# run as:
# python web2py.py -S eden -M -R applications/eden/static/scripts/tools/build.sahana.py
# or
# python web2py.py -S eden -M -R applications/eden/static/scripts/tools/build.sahana.py -A gis
#
#
# Built with code/inspiration from MapFish, OpenLayers & Michael Crute
#
try:
theme = settings.get_theme()
except:
print "ERROR: File now needs to be run in the web2py environment in order to pick up which theme to build"
exit()
import os
import sys
import shutil
SCRIPTPATH = os.path.join(request.folder, "static", "scripts", "tools")
os.chdir(SCRIPTPATH)
sys.path.append("./")
# For JS
import getopt
import jsmin, mergejs
# For CSS
import re
def mergeCSS(inputFilenames, outputFilename):
output = ""
for inputFilename in inputFilenames:
output += open(inputFilename, "r").read()
open(outputFilename, "w").write(output)
return outputFilename
def cleanline(theLine):
""" Kills line breaks, tabs, and double spaces """
p = re.compile("(\n|\r|\t|\f|\v)+")
m = p.sub("", theLine)
# Kills double spaces
p = re.compile("( )+")
m = p.sub(" ", m)
# Removes last semicolon before }
p = re.compile("(; }|;})+")
m = p.sub("}", m)
# Removes space before {
p = re.compile("({ )+")
m = p.sub("{", m)
# Removes all comments
p = re.compile("/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/")
m = p.sub("", m)
# Strip off the Charset
p = re.compile("@CHARSET .*;")
m = p.sub("", m)
# Strip spaces before the {
p = re.compile(" {")
m = p.sub("{", m)
# Strip space after :
p = re.compile(": ")
m = p.sub(":", m)
# Strip space after ,
p = re.compile(", ")
m = p.sub(",", m)
# Strip space after ;
p = re.compile("; ")
m = p.sub(";", m)
return m
def compressCSS(inputFilename, outputFilename):
theFile = open(inputFilename, "r").read()
output = ""
for line in theFile:
output = output + cleanline(line)
# Once more, clean the entire file string
_output = cleanline(output)
open(outputFilename, "w").write(_output)
return
def dojs(dogis = False, warnings = True):
""" Minifies the JavaScript """
# Do we have local version of the Closure Compiler available?
use_compressor = "jsmin" # Fallback
try:
import closure
use_compressor = "closure"
print "using local Closure Compiler"
except Exception, E:
print "No closure (%s)" % E
print "Download from http://closure-compiler.googlecode.com/files/compiler-latest.zip"
try:
import closure_ws
use_compressor = "closure_ws"
print "Using Closure via Web Service - limited to files < 1Mb!"
except ImportError:
print "No closure_ws"
if use_compressor == "closure":
if not warnings:
closure.extra_params = "--warning_level QUIET"
minimize = closure.minimize
elif use_compressor == "closure_ws":
minimize = closure_ws.minimize
elif use_compressor == "jsmin":
minimize = jsmin.jsmin
sourceDirectory = ".."
configFilename = "sahana.js.cfg"
outputFilename = "S3.min.js"
# Merge JS files
print "Merging Core libraries."
merged = mergejs.run(sourceDirectory, None, configFilename)
# Compress JS files
print "Compressing - JS"
minimized = minimize(merged)
# Add license
print "Adding license file."
minimized = open("license.txt").read() + minimized
# Print to output files
print "Writing to %s." % outputFilename
open(outputFilename, "w").write(minimized)
# Remove old JS files
print "Deleting %s." % outputFilename
try:
os.remove("../S3/%s" % outputFilename)
except:
pass
# Move new JS files
print "Moving new JS files"
shutil.move(outputFilename, "../S3")
# Bootstrap
# print "Compressing Bootstrap"
# sourceDirectoryBootstrap = ".."
# configFilenameBootstrap = "sahana.js.bootstrap.cfg"
# outputFilenameBootstrap = "bootstrap.min.js"
# mergedBootstrap = mergejs.run(sourceDirectoryBootstrap,
# None,
# configFilenameBootstrap)
# minimizedBootstrap = minimize(mergedBootstrap)
# open(outputFilenameBootstrap, "w").write(minimizedBootstrap)
# try:
# os.remove("../%s" % outputFilenameBootstrap)
# except:
# pass
# shutil.move(outputFilenameBootstrap, "..")
# dataLists
print "Compressing dataLists"
sourceDirectory = ".."
configFilename = "sahana.js.dataLists.cfg"
outputFilename = "s3.dataLists.min.js"
merged = mergejs.run(sourceDirectory,
None,
configFilename)
minimized = minimize(merged)
open(outputFilename, "w").write(minimized)
try:
os.remove("../S3/%s" % outputFilename)
except:
pass
shutil.move(outputFilename, "../S3")
# dataTables
print "Compressing dataTables"
sourceDirectory = ".."
configFilename = "sahana.js.dataTables.cfg"
outputFilename = "s3.dataTables.min.js"
merged = mergejs.run(sourceDirectory,
None,
configFilename)
minimized = minimize(merged)
open(outputFilename, "w").write(minimized)
try:
os.remove("../S3/%s" % outputFilename)
except:
pass
shutil.move(outputFilename, "../S3")
configFilename = "sahana.js.dataTables_multi.cfg"
outputFilename = "s3.dataTables.multi.min.js"
merged = mergejs.run(sourceDirectory,
None,
configFilename)
minimized = minimize(merged)
open(outputFilename, "w").write(minimized)
try:
os.remove("../S3/%s" % outputFilename)
except:
pass
shutil.move(outputFilename, "../S3")
# pivotTables
print "Compressing pivotTables"
sourceDirectory = ".."
configFilename = "sahana.js.pivotTables.cfg"
outputFilename = "s3.pivotTables.min.js"
merged = mergejs.run(sourceDirectory,
None,
configFilename)
minimized = minimize(merged)
open(outputFilename, "w").write(minimized)
try:
os.remove("../S3/%s" % outputFilename)
except:
pass
shutil.move(outputFilename, "../S3")
# ImageCrop
print "Compressing ImageCrop"
sourceDirectory = ".."
configFilename = "sahana.js.imageCrop.cfg"
outputFilename = "s3.imagecrop.widget.min.js"
merged = mergejs.run(sourceDirectory,
None,
configFilename)
minimized = minimize(merged)
open(outputFilename, "w").write(minimized)
try:
os.remove("../S3/%s" % outputFilename)
except:
pass
shutil.move(outputFilename, "../S3")
# JSTree
print "Compressing JSTree"
sourceDirectory = ".."
configFilename = "sahana.js.jstree.cfg"
outputFilename = "s3.jstree.min.js"
merged = mergejs.run(sourceDirectory,
None,
configFilename)
minimized = minimize(merged)
open(outputFilename, "w").write(minimized)
try:
os.remove("../S3/%s" % outputFilename)
except:
pass
shutil.move(outputFilename, "../S3")
# Chat
print "Compressing Chat"
sourceDirectory = ".."
configFilename = "sahana.chat.js.cfg"
outputFilename = "s3.chat.min.js"
merged = mergejs.run(sourceDirectory,
None,
configFilename)
minimized = minimize(merged)
open(outputFilename, "w").write(minimized)
try:
os.remove("../S3/%s" % outputFilename)
except:
pass
shutil.move(outputFilename, "../S3")
# Guided Tour
print "Compressing Guided Tour"
sourceDirectory = ".."
configFilename = "sahana.js.guidedTour.cfg"
outputFilename = "s3.guidedtour.min.js"
merged = mergejs.run(sourceDirectory,
None,
configFilename)
minimized = minimize(merged)
open(outputFilename, "w").write(minimized)
try:
os.remove("../S3/%s" % outputFilename)
except:
pass
shutil.move(outputFilename, "../S3")
# Vulnerability
print "Compressing Vulnerability"
sourceDirectory = "../.."
configFilename = "sahana.js.vulnerability.cfg"
outputFilename = "s3.vulnerability.min.js"
merged = mergejs.run(sourceDirectory,
None,
configFilename)
minimized = minimize(merged)
open(outputFilename, "w").write(minimized)
try:
os.remove("../../themes/Vulnerability/js/%s" % outputFilename)
except:
pass
shutil.move(outputFilename, "../../themes/Vulnerability/js")
print "Compressing Vulnerability GIS"
sourceDirectory = "../../themes/Vulnerability/js"
configFilename = "sahana.js.vulnerability_gis.cfg"
outputFilename = "OpenLayers.js"
merged = mergejs.run(sourceDirectory,
None,
configFilename)
minimized = minimize(merged)
open(outputFilename, "w").write(minimized)
try:
os.remove("../../themes/Vulnerability/js/%s" % outputFilename)
except:
pass
shutil.move(outputFilename, "../../themes/Vulnerability/js")
# Single scripts
for filename in ["add_person",
"cap",
"contacts",
"embed_component",
"gis",
"gis.feature_crud",
"gis.fullscreen",
"gis.latlon",
"gis.pois",
"locationselector.widget",
"locationselector.widget2",
"msg",
"popup",
"register_validation",
"select_person",
"timeline",
]:
print "Compressing s3.%s.js" % filename
inputFilename = os.path.join("..", "S3", "s3.%s.js" % filename)
outputFilename = "s3.%s.min.js" % filename
input = open(inputFilename, "r").read()
minimized = minimize(input)
open(outputFilename, "w").write(minimized)
try:
os.remove("../S3/%s" % outputFilename)
except:
pass
shutil.move(outputFilename, "../S3")
#for filename in ("spectrum",
# "tag-it",
# ):
# print "Compressing %s.js" % filename
# in_f = os.path.join("..", filename + ".js")
# out_f = os.path.join("..", filename + ".min.js")
# with open(in_f, "r") as inp:
# with open(out_f, "w") as out:
# out.write(minimize(inp.read()))
if dogis:
sourceDirectoryOpenLayers = "../gis/openlayers/lib"
sourceDirectoryOpenLayersExten = "../gis"
sourceDirectoryMGRS = "../gis"
sourceDirectoryGeoExt = "../gis/GeoExt/lib"
sourceDirectoryGxp = "../gis/gxp"
configFilenameOpenLayers = "sahana.js.ol.cfg"
configFilenameMGRS = "sahana.js.mgrs.cfg"
configFilenameGeoExt = "sahana.js.geoext.cfg"
configFilenameGxpMin = "sahana.js.gxp.cfg"
configFilenameGxp2 = "sahana.js.gxp2.cfg"
configFilenameGxpFull = "sahana.js.gxpfull.cfg"
outputFilenameOpenLayers = "OpenLayers.js"
outputFilenameMGRS = "MGRS.min.js"
outputFilenameGeoExt = "GeoExt.js"
outputFilenameGxp = "gxp.js"
outputFilenameGxp2 = "gxp_upload.js"
# Merge GIS JS Files
print "Merging OpenLayers libraries."
mergedOpenLayers = mergejs.run(sourceDirectoryOpenLayers,
None,
configFilenameOpenLayers)
print "Merging MGRS libraries."
mergedMGRS = mergejs.run(sourceDirectoryMGRS,
None,
configFilenameMGRS)
print "Merging GeoExt libraries."
mergedGeoExt = mergejs.run(sourceDirectoryGeoExt,
None,
configFilenameGeoExt)
print "Merging gxp libraries."
mergedGxpMin = mergejs.run(sourceDirectoryGxp,
None,
configFilenameGxpMin)
mergedGxp2 = mergejs.run(sourceDirectoryGxp,
None,
configFilenameGxp2)
mergedGxpFull = mergejs.run(sourceDirectoryGxp,
None,
configFilenameGxpFull)
# Compress JS files
print "Compressing - OpenLayers JS"
if use_compressor == "closure_ws":
# Limited to files < 1Mb!
minimizedOpenLayers = jsmin.jsmin(mergedOpenLayers)
#minimizedOpenLayers = jsmin.jsmin("%s\n%s" % (mergedOpenLayers,
# mergedOpenLayersExten))
else:
minimizedOpenLayers = minimize(mergedOpenLayers)
#minimizedOpenLayers = minimize("%s\n%s" % (mergedOpenLayers,
# mergedOpenLayersExten))
# OpenLayers extensions
for filename in ["cdauth",
"OWM.OpenLayers",
]:
inputFilename = os.path.join("..", "gis", "%s.js" % filename)
outputFilename = "%s.min.js" % filename
input = open(inputFilename, "r").read()
minimized = minimize(input)
open(outputFilename, "w").write(minimized)
try:
os.remove("../gis/%s" % outputFilename)
except:
pass
shutil.move(outputFilename, "../gis")
print "Compressing - MGRS JS"
minimizedMGRS = minimize(mergedMGRS)
print "Compressing - GeoExt JS"
minimizedGeoExt = minimize("%s\n%s" % (mergedGeoExt,
#mergedGeoExtux,
mergedGxpMin))
# GeoNamesSearchCombo
inputFilename = os.path.join("..", "gis", "GeoExt", "ux", "GeoNamesSearchCombo.js")
outputFilename = "GeoNamesSearchCombo.min.js"
input = open(inputFilename, "r").read()
minimized = minimize(input)
open(outputFilename, "w").write(minimized)
try:
os.remove("../gis/GeoExt/ux/%s" % outputFilename)
except:
pass
shutil.move(outputFilename, "../gis/GeoExt/ux")
print "Compressing - gxp JS"
minimizedGxp = minimize(mergedGxpFull)
minimizedGxp2 = minimize(mergedGxp2)
for filename in ["WMSGetFeatureInfo",
]:
inputFilename = os.path.join("..", "gis", "gxp", "plugins", "%s.js" % filename)
outputFilename = "%s.min.js" % filename
input = open(inputFilename, "r").read()
minimized = minimize(input)
open(outputFilename, "w").write(minimized)
try:
os.remove("../gis/gxp/plugins/%s" % outputFilename)
except:
pass
shutil.move(outputFilename, "../gis/gxp/plugins")
for filename in ["GoogleEarthPanel",
"GoogleStreetViewPanel",
]:
inputFilename = os.path.join("..", "gis", "gxp", "widgets", "%s.js" % filename)
outputFilename = "%s.min.js" % filename
input = open(inputFilename, "r").read()
minimized = minimize(input)
open(outputFilename, "w").write(minimized)
try:
os.remove("../gis/gxp/widgets/%s" % outputFilename)
except:
pass
shutil.move(outputFilename, "../gis/gxp/widgets")
# Add license
#minimizedGIS = open("license.gis.txt").read() + minimizedGIS
# Print to output files
print "Writing to %s." % outputFilenameOpenLayers
open(outputFilenameOpenLayers, "w").write(minimizedOpenLayers)
print "Writing to %s." % outputFilenameMGRS
open(outputFilenameMGRS, "w").write(minimizedMGRS)
print "Writing to %s." % outputFilenameGeoExt
open(outputFilenameGeoExt, "w").write(minimizedGeoExt)
print "Writing to %s." % outputFilenameGxp
open(outputFilenameGxp, "w").write(minimizedGxp)
print "Writing to %s." % outputFilenameGxp2
open(outputFilenameGxp2, "w").write(minimizedGxp2)
# Move new JS files
print "Deleting %s." % outputFilenameOpenLayers
try:
os.remove("../gis/%s" % outputFilenameOpenLayers)
except:
pass
print "Moving new OpenLayers JS files"
shutil.move(outputFilenameOpenLayers, "../gis")
print "Deleting %s." % outputFilenameMGRS
try:
os.remove("../gis/%s" % outputFilenameMGRS)
except:
pass
print "Moving new MGRS JS files"
shutil.move(outputFilenameMGRS, "../gis")
print "Deleting %s." % outputFilenameGeoExt
try:
os.remove("../gis/%s" % outputFilenameGeoExt)
except:
pass
print "Moving new GeoExt JS files"
shutil.move(outputFilenameGeoExt, "../gis")
print "Deleting %s." % outputFilenameGxp
try:
os.remove("../gis/%s" % outputFilenameGxp)
except:
pass
print "Moving new gxp JS files"
shutil.move(outputFilenameGxp, "../gis")
print "Deleting %s." % outputFilenameGxp2
try:
os.remove("../gis/%s" % outputFilenameGxp2)
except:
pass
print "Moving new gxp2 JS files"
shutil.move(outputFilenameGxp2, "../gis")
def docss():
""" Compresses the CSS files """
listCSS = []
theme = settings.get_theme()
print "Using theme %s" % theme
css_cfg = os.path.join("..", "..", "..", "private", "templates", theme, "css.cfg")
f = open(css_cfg, "r")
files = f.readlines()
f.close()
for file in files[:-1]:
p = re.compile("(\n|\r|\t|\f|\v)+")
file = p.sub("", file)
listCSS.append("../../styles/%s" % file)
outputFilenameCSS = "eden.min.css"
# Merge CSS files
print "Merging Core styles."
mergedCSS = mergeCSS(listCSS, outputFilenameCSS)
# Compress CSS files
print "Writing to %s." % outputFilenameCSS
compressCSS(mergedCSS, outputFilenameCSS)
# Move files to correct locations
print "Deleting %s." % outputFilenameCSS
try:
os.remove("../../themes/%s/%s" % (theme, outputFilenameCSS))
except:
pass
print "Moving new %s." % outputFilenameCSS
shutil.move(outputFilenameCSS, "../../themes/%s" % theme)
# Guided tour stylesheet
listCSS = ["../../styles/plugins/joyride.css"]
outputFilenameCSS = "guidedtour.min.css"
# Merge CSS files
print "Merging guided tour styles."
mergedCSS = mergeCSS(listCSS, outputFilenameCSS)
# Compress CSS files
print "Writing to %s." % outputFilenameCSS
compressCSS(mergedCSS, outputFilenameCSS)
# Move files to correct locations
print "Deleting %s." % outputFilenameCSS
try:
os.remove("../../styles/plugins/%s" % outputFilenameCSS)
except:
pass
print "Moving new %s." % outputFilenameCSS
shutil.move(outputFilenameCSS, "../../styles/plugins")
# Bootstrap
# - enable as-needed
bootstrap = False
if bootstrap:
print "Bootstrap CSS"
listCSS = []
for file in ["bootstrap.css",
"bootstrap-responsive.css",
"font-awesome.css",
#"bootstrap-multiselect.css",
]:
listCSS.append("../../styles/bootstrap/%s" % file)
outputFilenameCSS = "bootstrap-combined.min.css"
# Merge CSS files
print "Merging Bootstrap styles."
mergedCSS = mergeCSS(listCSS, outputFilenameCSS)
# Compress CSS files
print "Writing to %s." % outputFilenameCSS
compressCSS(mergedCSS, outputFilenameCSS)
# Move files to correct locations
print "Deleting %s." % outputFilenameCSS
try:
os.remove("../../styles/bootstrap/%s" % outputFilenameCSS)
except:
pass
print "Moving new %s." % outputFilenameCSS
shutil.move(outputFilenameCSS, "../../styles/bootstrap")
# Ext
# - enable as-needed
ext = False
if ext:
print "Ext Gray CSS"
listCSS = []
for file in ["ext-all-notheme.css",
"xtheme-gray.css",
]:
listCSS.append("../ext/resources/css/%s" % file)
outputFilenameCSS = "ext-gray.min.css"
# Merge CSS files
print "Merging Ext styles."
mergedCSS = mergeCSS(listCSS, outputFilenameCSS)
# Compress CSS file
print "Writing to %s." % outputFilenameCSS
compressCSS(mergedCSS, outputFilenameCSS)
# Move files to correct locations
print "Deleting %s." % outputFilenameCSS
try:
os.remove("../ext/resources/css/%s" % outputFilenameCSS)
except:
pass
print "Moving new %s." % outputFilenameCSS
shutil.move(outputFilenameCSS, "../ext/resources/css")
print "Ext no-Theme CSS"
outputFilenameCSS = "ext-notheme.min.css"
# Compress CSS file
print "Writing to %s." % outputFilenameCSS
compressCSS("../ext/resources/css/ext-all-notheme.css", outputFilenameCSS)
# Move files to correct locations
print "Deleting %s." % outputFilenameCSS
try:
os.remove("../ext/resources/css/%s" % outputFilenameCSS)
except:
pass
print "Moving new %s." % outputFilenameCSS
shutil.move(outputFilenameCSS, "../ext/resources/css")
print "Ext Themes CSS"
outputFilenameCSS = "xtheme-ifrc.min.css"
# Compress CSS file
print "Writing to %s." % outputFilenameCSS
compressCSS("../../themes/IFRC/xtheme-ifrc.css", outputFilenameCSS)
# Move files to correct locations
print "Deleting %s." % outputFilenameCSS
try:
os.remove("../../themes/IFRC/%s" % outputFilenameCSS)
except:
pass
print "Moving new %s." % outputFilenameCSS
shutil.move(outputFilenameCSS, "../../themes/IFRC")
def main(argv):
try:
parameter1 = argv[0]
except:
parameter1 = "ALL"
try:
if(argv[1] == "DOGIS"):
parameter2 = True
else:
parameter2 = False
except:
parameter2 = True
closure_warnings = True
if "NOWARN" in argv:
closure_warnings = False
if parameter1 in ("ALL", "NOWARN"):
dojs(warnings=closure_warnings)
docss()
else:
if parameter1 in ("CSS", "css"):
docss()
else:
dojs(parameter2, warnings=closure_warnings)
docss()
print "Done."
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))