~launchpad-pqm/launchpad/devel

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
#!${buildout:executable} -S

# Initialize our paths.
${python-relative-path-setup}
import sys
sys.path.insert(0, ${scripts:parts-directory|path-repr})
import site

import os

from lazr.js.build import ComboFile
from lazr.js.combo import combine_files


root = ${buildout:directory|path-repr}
icing = os.path.join(root, 'lib/canonical/launchpad/icing')
target = os.path.join(icing, 'combo.css')
# It'd probably be nice to have this script find all the CSS files we might
# need and combine them together, but if we do that we'd certainly end up
# including lots of styles that we don't need/want, so keeping this hard-coded
# list seems like the best option for now.
names = [
    'style.css',
    'lazr/build/yui/cssreset/reset.css',
    'lazr/build/yui/cssfonts/fonts.css',
    'lazr/build/yui/cssgrids/grids.css',
    'lazr/build/lazr/assets/skins/sam/lazr.css',
    'lazr/build/inlineedit/assets/skins/sam/editor.css',
    'lazr/build/autocomplete/assets/skins/sam/autocomplete.css',
    'lazr/build/overlay/assets/skins/sam/pretty-overlay.css',
    'lazr/build/formoverlay/assets/formoverlay-core.css',
    'lazr/build/picker/assets/skins/sam/picker.css',
    'lazr/build/activator/assets/skins/sam/activator.css',
    'lazr/build/choiceedit/assets/choiceedit-core.css',
    # This one goes at the end because it's our main stylesheet and should
    # take precedence over the others.
    'build/style-3-0.css']

absolute_names = []
for name in names:
    absolute_names.append(os.path.join(icing, name))

combo = ComboFile(absolute_names, target)
if combo.needs_update():
    result = ''
    for content in combine_files(names, icing):
        result += content

    f = open(target, 'w')
    f.write(result)
    f.close()