def env_create(args): import virtualenv settings = load_settings() ### Create virtualenv virtualenv.create_environment(settings.dir_virtualenv) py_reqs = ['brubeck', 'dictshield', 'ujson'] ### Ask about preferences web_server = ask_webserver(settings) if web_server == ENV_M2: py_reqs.append('pyzmq') concurrency = ask_concurrency(settings) py_reqs.append(concurrency) if concurrency == ENV_GEVENT: py_reqs.append('cython') template_engines = ask_template_engines(settings) py_reqs = py_reqs + template_engines ### Install web server requirements if web_server == ENV_M2: install_mongrel2(settings) ### pip install requirements response = install_with_pip(py_reqs)
def render_project(project_name): settings = load_settings() context = { '{{BPM_PROJECT_NAME}}': project_name, } find_and_render(settings.dir_project, context)
def install_with_pip(py_reqs): """Simple function for installing python packages with the virtualenv's pip. """ settings = load_settings() pip = os.path.join(settings.dir_virtualenv, 'bin/pip') cmd = [pip, 'install', '-I'] return subprocess.check_call(cmd + py_reqs)