10386.5.4
by Paul Hummer
Added code to bring in the dependencies |
1 |
#!/usr/bin/python
|
2 |
#
|
|
3 |
# Copyright 2010 Canonical Ltd. This software is licensed under the
|
|
4 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
|
5 |
||
6 |
"""Print the Launchpad javascript files we are using.
|
|
7 |
||
8 |
The output of this script is meant to be given to the jsbuild script so that
|
|
9 |
they are included in the launchpad.js file.
|
|
10 |
"""
|
|
11 |
||
12 |
__metaclass__ = type |
|
13 |
||
14 |
import os |
|
10785.1.2
by Brad Crittenden
Move registry JS to lp.registry namespace |
15 |
|
10985.2.1
by Deryck Hodge
Get js minified from app-specific javascript directories. |
16 |
from lazr.js.build import Builder |
10386.5.4
by Paul Hummer
Added code to bring in the dependencies |
17 |
|
18 |
TOP = os.path.abspath( |
|
19 |
os.path.join(os.path.dirname(__file__), '..')) |
|
10386.5.5
by Paul Hummer
Symlinks FTMFW! |
20 |
# JS_DIRSET is a tuple of the dir where the code exists, and the name of the
|
21 |
# symlink it should be linked as in the icing build directory.
|
|
22 |
JS_DIRSET = [ |
|
11090.5.2
by Tim Penhey
Add an app link, and remove the duplicate bug link. |
23 |
(os.path.join('lib', 'lp', 'app', 'javascript'), 'app'), |
11009.1.2
by Edwin Grubbs
Made formoverlay appear correctly with textareas that are wider than normal. |
24 |
(os.path.join('lib', 'lp', 'bugs', 'javascript'), 'bugs'), |
10785.1.1
by Brad Crittenden
Move registry javascript |
25 |
(os.path.join('lib', 'lp', 'code', 'javascript'), 'code'), |
26 |
(os.path.join('lib', 'lp', 'registry', 'javascript'), 'registry'), |
|
10876.6.1
by Adi Roiban
Move translation jsfiles into lib/lp. |
27 |
(os.path.join('lib', 'lp', 'translations', 'javascript'), 'translations'), |
11315.5.2
by Michael Nelson
Moved soyuz javascript to app directory and updated tests/templates to ensure it still works. |
28 |
(os.path.join('lib', 'lp', 'soyuz', 'javascript'), 'soyuz'), |
10785.1.1
by Brad Crittenden
Move registry javascript |
29 |
]
|
10386.5.5
by Paul Hummer
Symlinks FTMFW! |
30 |
ICING_ROOT = os.path.join(TOP, 'lib', 'canonical', 'launchpad', 'icing') |
31 |
ICING_BUILD = os.path.join(ICING_ROOT, 'build') |
|
10386.5.4
by Paul Hummer
Added code to bring in the dependencies |
32 |
|
10985.2.3
by Deryck Hodge
Add a comment describing why the monkey patch |
33 |
# Builder has lots of logging, which might not
|
34 |
# play well with printing filenames. Monkey patch
|
|
35 |
# to disable it.
|
|
10985.2.1
by Deryck Hodge
Get js minified from app-specific javascript directories. |
36 |
def log_none(msg): |
37 |
return
|
|
38 |
||
10386.5.5
by Paul Hummer
Symlinks FTMFW! |
39 |
for DIRSET in JS_DIRSET: |
40 |
full_dir = os.path.join(TOP, DIRSET[0]) |
|
10985.2.1
by Deryck Hodge
Get js minified from app-specific javascript directories. |
41 |
module_name = DIRSET[1] |
42 |
BUILD_DIR = os.path.join(ICING_BUILD, module_name) |
|
43 |
if not os.path.exists(BUILD_DIR): |
|
44 |
os.mkdir(BUILD_DIR) |
|
45 |
builder = Builder( |
|
46 |
name=module_name, src_dir=full_dir, build_dir=ICING_BUILD) |
|
47 |
builder.log = log_none |
|
10386.5.5
by Paul Hummer
Symlinks FTMFW! |
48 |
# We don't want the tests to be included. If we want to nest the files in
|
49 |
# more folders though, this is where we change it.
|
|
10386.5.4
by Paul Hummer
Added code to bring in the dependencies |
50 |
for filename in os.listdir(full_dir): |
51 |
if filename.endswith('.js'): |
|
10985.2.1
by Deryck Hodge
Get js minified from app-specific javascript directories. |
52 |
basename, nothing = filename.split('.js') |
53 |
min_filename = basename + '-min.js' |
|
10386.5.4
by Paul Hummer
Added code to bring in the dependencies |
54 |
absolute_filename = os.path.join(full_dir, filename) |
10985.2.1
by Deryck Hodge
Get js minified from app-specific javascript directories. |
55 |
builder.link_and_minify(builder.name, absolute_filename) |
56 |
print os.path.join(BUILD_DIR, min_filename) |