1 # Copyright (C) 2013 The Meme Factory, Inc. http://www.meme.com/
3 # This file is part of Gombe-MI.
5 # Gombe-MI is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Gombe-MI. If not, see <http://www.gnu.org/licenses/>.
18 # Karl O. Pinc <kop@meme.com>
20 # Makefile for pyramid app setup and maintenance.
22 # See the INSTALL file for initial setup that must be done by root.
24 # See: http://www.pylonsproject.org/
26 PYRAMID_VERSION := 1.5
27 MODWSGI_VENV := /usr/local/lib/pyramid_env
28 DEVEL_VENV := ../devel_venv
30 PROJECT_NAME := GMI_Pyramid
31 DEVEL_STUFF := $(PROJECT_NAME).egg-info distribute-0.6.10.tar.gz dist build \
37 @echo ' help This help'
38 @echo ' modwsgi_venv Create python virtual env into which live'
39 @echo ' app is installed and run with'
40 @echo ' Apache mod_wsgi.'
41 @echo ' ../devel_venv Create local virtual env into which devel'
42 @echo ' app is installed and run.'
43 @echo ' install_prod Install production app into modwsgi_venv.'
44 @echo ' configure_prod Install production.ini into modwsgi_venv.'
45 @echo ' install_devel Install development app into devel_venv.'
46 @echo ' run_devel Run the app in development mode.'
47 @echo ' test_devel Run unit tests in the development venv.'
48 @echo ' clean_devel_venv Destroy devel_venv.'
49 @echo ' clean_prod Destroy modwsgi_venv.'
50 @echo ' clean Destroy all generated development files.'
51 @echo ' maintainerclean Start development entirely over.'
53 @echo 'Production related changes must be made through this Makefile'
54 @echo 'or with a umask of 0002 to support collaboration with gombemi'
55 @echo 'Unix group members.'
57 # Note that we'd like to make modwsgi_venv depend on $(MODWSGI_VENV) and
58 # have the work done there. This way other production targets could also
59 # depend on $(MODWSGI_VENV). But the directory itself must be made by root.
63 # Allow UPG collaboration.
65 virtualenv --no-site-packages $(MODWSGI_VENV) ; \
66 $(MODWSGI_VENV)/bin/easy_install "pyramid==$(PYRAMID_VERSION)" ; \
67 printf '%s\n%s\n%s\n%s\n' \
68 'from pyramid.paster import get_app, setup_logging' \
69 "ini_path = '$(MODWSGI_VENV)/production.ini'" \
70 'setup_logging(ini_path)' \
71 "application = get_app(ini_path, 'main')" \
72 > $(MODWSGI_VENV)/pyramid.wsgi
77 $(MODWSGI_VENV)/bin/python setup.py bdist_egg
78 ln -sf dist/$(PROJECT_NAME)*.egg $(PROJECT_NAME).egg
81 install_prod: make_egg
83 $(MODWSGI_VENV)/bin/easy_install $$(readlink $(PROJECT_NAME).egg)
85 .PHONY: configure_prod
88 cp production.ini $(MODWSGI_VENV)
92 virtualenv --no-site-packages $(DEVEL_VENV)
94 $(DEVEL_VENV)/bin/easy_install "pyramid==$(PYRAMID_VERSION)"
97 install_devel: $(DEVEL_VENV)
98 $(DEVEL_VENV)/bin/python setup.py develop
102 $(DEVEL_VENV)/bin/python setup.py test -q
106 $(DEVEL_VENV)/bin/pserve --reload development.ini
108 .PHONY: clean_devel_venv
114 # Leave the $(MODWSGI_VENV) directory intact since it's ownwed by
115 # root and setgid with g=rwx.
116 rm -rf $(MODWSGI_VENV)/*
120 rm -rf $(DEVEL_STUFF)
122 .PHONY: maintainerclean
123 maintainterclean: clean_devel_venv clean