Created
August 13, 2010 06:33
-
-
Save laiso/522423 to your computer and use it in GitHub Desktop.
Exec closure-library's depswriter.py for Kay management action.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
import sys | |
import kay | |
from kay.management import utils | |
def action_jsdepswrite( | |
media_dir=('m', 'media'), | |
js_dir=('j', 'js'), | |
out_dir=('o', '.')): | |
""" | |
Closure Libray dir :: | |
APP_ROOT/MEDIA/js/closure | |
Action Example :: | |
./manage.py -j js -m media -o app | |
""" | |
DEPS_JS = 'deps.js' | |
media_dir = os.path.abspath(media_dir) | |
js_dir = os.path.join(media_dir, js_dir) | |
if not out_dir: | |
out_dir = os.path.join( | |
js_dir, utils.get_appid()) | |
else: | |
out_dir = os.path.abspath( | |
os.path.join(js_dir, out_dir)) | |
if not os.path.exists(out_dir): os.mkdir(out_dir, 0755) | |
out_path = os.path.join(out_dir, DEPS_JS) | |
utils.print_status("[output]: %s" % out_path) | |
execpy = os.path.join( | |
js_dir, | |
"closure", "bin", | |
"build", "depswriter.py") | |
os.spawnv(os.P_WAIT, execpy, ( | |
"--root=" + \ | |
os.path.join(js_dir, "closure" , "goog"), | |
"--output_file=" + \ | |
out_path)) | |
utils.print_status("done.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment