~launchpad-pqm/launchpad/devel

10713.1.1 by Gary Poster
use new version of z3c.recipe.filetemplate and zc.buildout fork to use relative paths.
1
#!${buildout:executable} -S
2
3
# Initialize our paths.
4
${python-relative-path-setup}
5
import sys
6
sys.path.insert(0, ${scripts:parts-directory|path-repr})
7
import site
7675.438.2 by Guilherme Salgado
Combine all the css files we need in a single combo.css, which is now the only one included in our base template
8
9
import os
10
10289.1.1 by Paul Hummer
Fixed the unneeded generation of a new combined css file.
11
from lazr.js.build import ComboFile
7675.438.2 by Guilherme Salgado
Combine all the css files we need in a single combo.css, which is now the only one included in our base template
12
from lazr.js.combo import combine_files
13
14
10713.1.1 by Gary Poster
use new version of z3c.recipe.filetemplate and zc.buildout fork to use relative paths.
15
root = ${buildout:directory|path-repr}
7675.438.2 by Guilherme Salgado
Combine all the css files we need in a single combo.css, which is now the only one included in our base template
16
icing = os.path.join(root, 'lib/canonical/launchpad/icing')
10289.1.1 by Paul Hummer
Fixed the unneeded generation of a new combined css file.
17
target = os.path.join(icing, 'combo.css')
7675.438.3 by Guilherme Salgado
Remove one now-unused function and add a comment to buildout-templates/bin/combine-css.in explaining why we use a hard-coded list of css files to combine.
18
# It'd probably be nice to have this script find all the CSS files we might
19
# need and combine them together, but if we do that we'd certainly end up
20
# including lots of styles that we don't need/want, so keeping this hard-coded
21
# list seems like the best option for now.
7675.438.2 by Guilherme Salgado
Combine all the css files we need in a single combo.css, which is now the only one included in our base template
22
names = [
23
    'style.css',
24
    'lazr/build/yui/cssreset/reset.css',
25
    'lazr/build/yui/cssfonts/fonts.css',
26
    'lazr/build/yui/cssgrids/grids.css',
27
    'lazr/build/lazr/assets/skins/sam/lazr.css',
28
    'lazr/build/inlineedit/assets/skins/sam/editor.css',
29
    'lazr/build/autocomplete/assets/skins/sam/autocomplete.css',
30
    'lazr/build/overlay/assets/skins/sam/pretty-overlay.css',
31
    'lazr/build/formoverlay/assets/formoverlay-core.css',
32
    'lazr/build/picker/assets/skins/sam/picker.css',
33
    'lazr/build/activator/assets/skins/sam/activator.css',
34
    'lazr/build/choiceedit/assets/choiceedit-core.css',
35
    # This one goes at the end because it's our main stylesheet and should
36
    # take precedence over the others.
7675.507.20 by Edwin Grubbs
Generating css correctly.
37
    'build/style-3-0.css']
10289.1.1 by Paul Hummer
Fixed the unneeded generation of a new combined css file.
38
39
absolute_names = []
40
for name in names:
41
    absolute_names.append(os.path.join(icing, name))
42
43
combo = ComboFile(absolute_names, target)
44
if combo.needs_update():
45
    result = ''
46
    for content in combine_files(names, icing):
47
        result += content
48
49
    f = open(target, 'w')
50
    f.write(result)
51
    f.close()