Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Bootstrap code for a fabfile module that automatically loads all .py files and makes all pre-loaded libraries available to them
from __future__ import with_statement
from fabric.api import *
from code import interact
import os
import sys
import time
APP_ROOT = os.path.abspath(os.path.dirname(__file__))
sys.path += [APP_ROOT, os.path.join(APP_ROOT, 'lib')]
from support import (
config,
get_db_handler,
sqlwitch,
sha1,
re,
simplejson,
jshash
)
def do():
interact(local=locals())
def shell(init_globals=None):
if init_globals is None:
init_globals = globals()
interact(local=init_globals)
import glob
import types
pre_globals = dict([(key, value) for key, value in globals().items()])
for fabfile in [py for py in glob.glob('fabfile/*.py') if not py.endswith('__init__.py')]:
module_name = os.path.splitext(os.path.split(fabfile)[1])[0]
module = __import__(module_name, globals(), locals(), ['*'], -1)
for key in pre_globals.keys():
setattr(module, key, pre_globals[key])
for key in dir(module):
if not re.match('^__.+__$', key):
globals()[key] = getattr(module, key)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.