Add taggable-mixin and gviz to build script.
[Melange.git] / scripts / build.sh
blob827fba096f17a98f03790c0f23f8f6747e7f68fb
1 #!/bin/bash
3 # Script to create a "build" subdirectory. This is a subdirectory
4 # containing a bunch of symlinks, from which the app can be updated.
5 # The main reason for this is to import Django from a zipfile, which
6 # saves dramatically in upload time: statting and computing the SHA1
7 # for 1000s of files is slow. Even if most of those files don't
8 # actually need to be uploaded, they still add to the work done for
9 # each update.
11 DEFAULT_APP_BUILD=../build
12 DEFAULT_APP_FOLDER="../app"
13 DEFAULT_APP_FILES="app.yaml cron.yaml index.yaml main.py settings.py shell.py urls.py gae_django.py"
14 DEFAULT_APP_DIRS="soc ghop gsoc feedparser python25src reflistprop jquery \
15 ranklist shell json htmlsanitizer taggable-mixin gviz"
16 DEFAULT_ZIP_FILES="tiny_mce.zip"
18 APP_BUILD=${APP_BUILD:-"${DEFAULT_APP_BUILD}"}
19 APP_FOLDER=${APP_FOLDER:-"${DEFAULT_APP_FOLDER}"}
20 APP_FILES=${APP_FILES:-"${DEFAULT_APP_FILES}"}
21 APP_DIRS=${APP_DIRS:-"${DEFAULT_APP_DIRS}"}
22 ZIP_FILES=${ZIP_FILES:-"${DEFAULT_ZIP_FILES}"}
25 if [ "$1" != "--skip-pylint" ]; then
26 cd pylint
27 bash do_pylint.sh --silent
28 if [ "$?" != "1" ] ; then
29 echo ' Build failed. Build script encountered pylint errors.'
30 exit 1
32 cd ..
35 if [ -e $APP_FOLDER ] ; then
36 cd $APP_FOLDER
37 else
38 echo 'This script must be run from within the scripts directory!'
39 exit 1
42 # Remove old zip files (and django.zip in its old location)
43 rm -rf $ZIP_FILES django.zip
45 # Remove old $APP_BUILD directory.
46 rm -rf $APP_BUILD
48 # Create new $APP_BUILD directory.
49 mkdir $APP_BUILD
51 # Create new django.zip file, but directly in the $APP_BUILD directory,
52 # rather than in $APP_FOLDER and creating a symlink in $APP_BUILD. This
53 # keeps the presence of a django.zip file in the app/ folder from breaking
54 # debugging into app/django.
56 # We prune:
57 # - .svn subdirectories for obvious reasons.
58 # - contrib/gis/ and related files because it's huge and unneeded.
59 # - *.po and *.mo files because they are bulky and unneeded.
60 # - *.pyc and *.pyo because they aren't used by App Engine anyway.
62 zip -q "$APP_BUILD/django.zip" `find django \
63 -name .svn -prune -o \
64 -name gis -prune -o \
65 -name admin -prune -o \
66 -name localflavor -prune -o \
67 -name mysql -prune -o \
68 -name mysql_old -prune -o \
69 -name oracle -prune -o \
70 -name postgresql-prune -o \
71 -name postgresql_psycopg2 -prune -o \
72 -name sqlite3 -prune -o \
73 -name test -prune -o \
74 -type f ! -name \*.py[co] ! -name *.[pm]o -print`
76 # Create new tiny_mce.zip file.
78 # We prune:
79 # - .svn subdirectories for obvious reasons.
81 # zipserve requires tiny_mce/* to be in root of zip file
82 pushd tiny_mce > /dev/null
83 zip -q ../tiny_mce.zip `find . \
84 -name .svn -prune -o \
85 -type f -print`
86 popd > /dev/null
88 # Create symbolic links.
89 for x in $APP_FILES $APP_DIRS $ZIP_FILES
91 ln -s $APP_FOLDER/$x $APP_BUILD/$x
92 done
94 echo "Build results in $APP_BUILD."