Skip to content
Newer
Older
100644 54 lines (42 sloc) 2.38 KB
0cb989c @nowells Added refactoring of code. Dummy example.
nowells authored Sep 2, 2009
1 import os
2 import glob
3 from fabric import local
865a8d8 @nowells Fixed fabfile to not be python2.5 specific.
nowells authored Sep 7, 2009
4 import sys
0cb989c @nowells Added refactoring of code. Dummy example.
nowells authored Sep 2, 2009
5
6 LOCAL_PACKAGES = (
7 'examples',
8 '',
9 )
10
11 PROJECT_ROOT = os.path.abspath(os.path.curdir)
865a8d8 @nowells Fixed fabfile to not be python2.5 specific.
nowells authored Sep 7, 2009
12 PY_VERSION = 'python%s.%s' % (sys.version_info[0], sys.version_info[1])
0cb989c @nowells Added refactoring of code. Dummy example.
nowells authored Sep 2, 2009
13
14 def bootstrap():
15 # Create new virtual environment in a new location. We will atomically swap the current virtualenv with the new once at the end of this process.
16 local("rm -Rf .ve~/")
17
18 local('virtualenv .ve~')
19
20 # hack activate so it uses project directory instead of ve in prompt
21 local('sed \'s/(`basename \\\\"\\$VIRTUAL_ENV\\\\\"`)/(`basename \\\\`dirname \\\\"$VIRTUAL_ENV\\\\"\\\\``)/g\' .ve~/bin/activate > .ve~/bin/activate.tmp')
22 local('mv .ve~/bin/activate.tmp .ve~/bin/activate')
23
24 # PIP install requirements
25 local("pip install -I --source=.ve~/src/ --environment=.ve~/ -r REQUIREMENTS")
26
27 # Cleanup pip install process
28 local("rm -Rf build/")
29
30 # Add local src folders to python path.
6f9cc56 @nowells Fixed a bug in string formatting in fabfile.
nowells authored Sep 8, 2009
31 local("echo '%s' >> .ve~/lib/%s/site-packages/easy-install.pth" % ('\n'.join([ os.path.join(PROJECT_ROOT, x) for x in LOCAL_PACKAGES ]), PY_VERSION))
0cb989c @nowells Added refactoring of code. Dummy example.
nowells authored Sep 2, 2009
32
33 # Apply patches.
34 for patch in glob.glob(os.path.join(PROJECT_ROOT, 'dist', 'patches', '*.patch')):
35 dirname, filename = os.path.split(patch)
36 application_name = filename.split('.patch')[0]
37 application_path = os.path.join(PROJECT_ROOT, '.ve~', 'src', application_name)
38 if os.path.exists(application_path):
39 print 'Patching %s...' % application_name
40 local("cd %s; patch -p0 < %s" % (application_path, patch))
41
42 # Cleanup and .pyc files that got generated so that we do not have any corrupt pyc files hanging out with the .ve~ path.
43 local("find .ve~/ -type f -name '*.pyc' -print0 | xargs -0 rm -f")
44 # Prepare the temporary virtualenv to take the place of the primary virtualenv by replacing the paths
45 local("find .ve~/ -type f -print0 | xargs -0 sed -i 's/\.ve~/ve/g'")
46 # Atomically move the new virtualenv into place, and move the old virtualenv into a backup location.
47 local("mv ve/ .ve.old~/ 2> /dev/null; mv .ve~/ ve/")
48
49 def documentation():
50 local("rm -Rf docs/modules/")
51 local("rm -Rf docs/_build/html/")
95bf228 @nowells Fixed silly walks.
nowells authored Sep 4, 2009
52 local("DJANGO_SETTINGS_MODULE=sillywalks.settings ve/bin/sphinx-build -aE docs/ docs/_build/html/")
0cb989c @nowells Added refactoring of code. Dummy example.
nowells authored Sep 2, 2009
53 print "View the documentation here: file://%s" % os.path.join(PROJECT_ROOT, 'docs', '_build', 'html', 'index.html')
Something went wrong with that request. Please try again.