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
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 ranklist shell json htmlsanitizer"
15 DEFAULT_ZIP_FILES
="tiny_mce.zip"
17 APP_BUILD
=${APP_BUILD:-"${DEFAULT_APP_BUILD}"}
18 APP_FOLDER
=${APP_FOLDER:-"${DEFAULT_APP_FOLDER}"}
19 APP_FILES
=${APP_FILES:-"${DEFAULT_APP_FILES}"}
20 APP_DIRS
=${APP_DIRS:-"${DEFAULT_APP_DIRS}"}
21 ZIP_FILES
=${ZIP_FILES:-"${DEFAULT_ZIP_FILES}"}
24 if [ "$1" != "--skip-pylint" ]; then
26 bash do_pylint.sh
--silent
27 if [ "$?" != "1" ] ; then
28 echo ' Build failed. Build script encountered pylint errors.'
34 if [ -e $APP_FOLDER ] ; then
37 echo 'This script must be run from within the scripts directory!'
41 # Remove old zip files (and django.zip in its old location)
42 rm -rf $ZIP_FILES django.
zip
44 # Remove old $APP_BUILD directory.
47 # Create new $APP_BUILD directory.
50 # Create new django.zip file, but directly in the $APP_BUILD directory,
51 # rather than in $APP_FOLDER and creating a symlink in $APP_BUILD. This
52 # keeps the presence of a django.zip file in the app/ folder from breaking
53 # debugging into app/django.
56 # - .svn subdirectories for obvious reasons.
57 # - contrib/gis/ and related files because it's huge and unneeded.
58 # - *.po and *.mo files because they are bulky and unneeded.
59 # - *.pyc and *.pyo because they aren't used by App Engine anyway.
61 zip -q "$APP_BUILD/django.zip" `find django \
62 -name .svn -prune -o \
64 -name admin -prune -o \
65 -name localflavor -prune -o \
66 -name mysql -prune -o \
67 -name mysql_old -prune -o \
68 -name oracle -prune -o \
69 -name postgresql-prune -o \
70 -name postgresql_psycopg2 -prune -o \
71 -name sqlite3 -prune -o \
72 -name test -prune -o \
73 -type f ! -name \*.py[co] ! -name *.[pm]o -print`
75 # Create new tiny_mce.zip file.
78 # - .svn subdirectories for obvious reasons.
80 # zipserve requires tiny_mce/* to be in root of zip file
81 pushd tiny_mce
> /dev
/null
82 zip -q ..
/tiny_mce.
zip `find . \
83 -name .svn -prune -o \
87 # Create symbolic links.
88 for x
in $APP_FILES $APP_DIRS $ZIP_FILES
90 ln -s $APP_FOLDER/$x $APP_BUILD/$x
93 echo "Build results in $APP_BUILD."