# The text in this file should be passed in its entirety # to the virtualenv.create_bootstrap_script() call. import os, os.path, subprocess, platform, sys def extend_parser(optparser): opt_no_site_packages = optparser.get_option("--no-site-packages") optparser.add_option("--use-site-packages", dest=opt_no_site_packages.dest, action='store_false', default=True) optparser.add_option("--extra-paths", dest="extra_paths", action='append', default=globals().get("extra_paths", []), help="Bake paths into sys.path") optparser.add_option("--no-extra-paths", dest="no_extra_paths", action='store_true', default=False, help="Ignore any baked in or specified extra_paths") def adjust_options(options, args): # Unzip setuptools options.unzip_setuptools = True # Install distribute options.use_distribute = True def add_extra_lib_paths(options, home_dir): # Note: This needs to be set by the creation script. extra_paths = options.extra_paths if not extra_paths: return lib_dir = join(home_dir, 'lib', 'python' + sys.version[:3]) with open(join(lib_dir, 'site-packages', 'sitecustomize.py'), "at") as f: print >>f, "import site, os.path" for extra_path in extra_paths: print "Adding to sys.path:", extra_path print >>f, "site.addsitedir(os.path.expandvars(os.path.expanduser(" + repr(extra_path) + ")))" def after_install(options, home_dir): add_extra_lib_paths(options, home_dir) packages = [] if platform.system() == "Darwin": packages.append("appscript", "keyring") packages.extend([ "redis", "python-memcached", # too bad python-libmemcached didn't build on Darwin "markdown", "mako", "pyyaml", "lxml", "pydot", "requests", # See https://github.com/kennethreitz/requests "rauth", # For OAuth. See https://github.com/litl/rauth "cherrypy", "httplib2", "eventlet", ]) pip = join(home_dir, 'bin', 'pip') subprocess.call([pip, "install"] + packages)