~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/scripts/utilities/jssize.py

  • Committer: Paul Hummer
  • Date: 2010-02-19 22:02:36 UTC
  • mto: This revision was merged to the branch mainline in revision 10352.
  • Revision ID: paul@canonical.com-20100219220236-ibla2qe43uls6c9u
Added jssize checker to make sure js doesn't get greater than 512K

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2009 Canonical Ltd.  This software is licensed under the
 
2
# GNU Affero General Public License version 3 (see the file LICENSE).
 
3
 
 
4
"""Script to check the size of the generated javascript.
 
5
 
 
6
This script tests to ensure optimized javascript never gets over a certain
 
7
size.  If it gets too big, Windmill has issues. This is a hack until we can
 
8
find out why Windmill has such issues.
 
9
"""
 
10
 
 
11
import os
 
12
 
 
13
FILE_NAME = 'lib/canonical/launchpad/icing/build/launchpad.js'
 
14
MAX_FILE_SIZE = 512000
 
15
 
 
16
def main():
 
17
    size = os.path.getsize(FILE_NAME)
 
18
    if size > MAX_FILE_SIZE:
 
19
        raise Exception(
 
20
            'launchpad.js is greater than %d bytes' % MAX_FILE_SIZE)