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
|
#!${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 lp.scripts.utilities.js.jsbuild import ComboFile
from lp.scripts.utilities.js.combo import combine_files
# This constant helps us meet maximum line-length goals.
GALLERY_ACCORDION = 'yui3-gallery/gallery-accordion/assets/'
root = os.path.abspath('.')
root = os.path.normpath(${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',
'yui/cssreset/reset.css',
# Use the old cssgrids instead of the new cssgrids.
#'lazr/build/yui/cssgrids/grids.css',
'cssgrids/grids.css',
'build/lazr/assets/skins/sam/lazr.css',
'build/inlineedit/assets/skins/sam/editor.css',
'build/autocomplete/assets/skins/sam/autocomplete.css',
'build/overlay/assets/skins/sam/pretty-overlay.css',
'build/formoverlay/assets/formoverlay-core.css',
'build/picker/assets/skins/sam/picker.css',
'build/activator/assets/skins/sam/activator.css',
'build/choiceedit/assets/choiceedit-core.css',
GALLERY_ACCORDION + 'gallery-accordion-core.css',
GALLERY_ACCORDION + 'skins/sam/gallery-accordion-skin.css',
'build/sprite.css',
# This one goes at the end because it's our main stylesheet and should
# take precedence over the others.
'style-3-0.css']
absolute_names = []
for name in names:
full_path_name = os.path.abspath(os.path.join(icing, name))
absolute_names.append(full_path_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()
|