Added django badge
[e_cidadania.git] / install.py
blob2c90c1d2dbff7027037593ef0f89c9d99068d02a
1 #/usr/bin/env python
2 # -*- coding: utf-8 -*-
4 # Copyright (c) 2013 Clione Software
5 # Copyright (c) 2010-2013 Cidadania S. Coop. Galega
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
19 import sys
20 import os
21 import subprocess
23 """
24 This script installs a development environment in an easy way, instead of
25 having to execute all the bootstrapping commands.
26 """
28 __version__ = '0.2'
29 print "e-cidadania install script %s\n" % __version__
31 # Detect where is this file
32 cwd = os.path.dirname(os.path.realpath(__file__))
33 # Change the working dir
34 os.chdir(cwd)
36 # Execute the bootstrap
37 print " * Bootstrapping..."
38 a = subprocess.Popen('python bootstrap.py', shell=True)
39 subprocess.Popen.wait(a)
41 print " * Making buildout..."
42 b = subprocess.Popen('bin/buildout')
43 subprocess.Popen.wait(b)
45 d = raw_input(' * Do you want to create the database? (y/n) ')
47 if d == 'y':
48 os.chdir(cwd + '/src/')
49 c = subprocess.Popen('../bin/django syncdb', shell=True)
50 subprocess.Popen.wait(c)
51 sys.exit(0)
52 elif d == 'n':
53 print 'Process finished'
54 print """You should follow this instructions blablabla"""
55 sys.exit(0)
56 else:
57 sys.exit(0)