Merge branch 'master' into guardian
[e_cidadania.git] / install.py
blob539fb3b25f23fbcf7a96822eb8a6c89e7bbeff68
1 #/usr/bin/env python
2 # -*- coding: utf-8 -*-
4 # Copyright (c) 2010-2012 Cidadania S. Coop. Galega
6 # This file is part of e-cidadania.
8 # e-cidadania is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # e-cidadania is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with e-cidadania. If not, see <http://www.gnu.org/licenses/>.
21 import sys
22 import os
23 import subprocess
25 """
26 This script installs a development environment in an easy way, instead of
27 having to execute all the bootstrapping commands.
28 """
30 __version__ = '0.2'
31 print "e-cidadania install script %s\n" % __version__
33 # Detect where is this file
34 cwd = os.path.dirname(os.path.realpath(__file__))
35 # Change the working dir
36 os.chdir(cwd)
38 # Execute the bootstrap
39 print " * Bootstrapping..."
40 a = subprocess.Popen('python bootstrap.py', shell=True)
41 subprocess.Popen.wait(a)
43 print " * Making buildout..."
44 b = subprocess.Popen('bin/buildout')
45 subprocess.Popen.wait(b)
47 d = raw_input(' * Do you want to create the database? (y/n) ')
49 if d == 'y':
50 os.chdir(cwd + '/src/')
51 c = subprocess.Popen('../bin/django syncdb', shell=True)
52 subprocess.Popen.wait(c)
53 sys.exit(0)
54 elif d == 'n':
55 print 'Process finished'
56 print """You should follow this instructions blablabla"""
57 sys.exit(0)
58 else:
59 sys.exit(0)