Commit 48bad589 authored by Georgios Gousios's avatar Georgios Gousios
Browse files

Add the django-hudson module to the CI environment

parent b9cf4a80
#!/usr/bin/env python2.6
# -*- coding: utf-8 -*-
from os import path
import shutil, sys, virtualenv, subprocess
PROJECT_ROOT = path.abspath(path.dirname(__file__))
REQUIREMENTS = path.join(PROJECT_ROOT, 'requirements.pip')
VE_ROOT = path.join(PROJECT_ROOT, '.ve')
VE_TIMESTAMP = path.join(VE_ROOT, 'timestamp')
envtime = path.exists(VE_ROOT) and path.getmtime(VE_ROOT) or 0
envreqs = path.exists(VE_TIMESTAMP) and path.getmtime(VE_TIMESTAMP) or 0
envspec = path.getmtime(REQUIREMENTS)
def go_to_ve():
# going into ve
if not sys.prefix == VE_ROOT:
if sys.platform == 'win32':
python = path.join(VE_ROOT, 'Scripts', 'python.exe')
else:
python = path.join(VE_ROOT, 'bin', 'python')
retcode = subprocess.call([python, __file__] + sys.argv[1:])
sys.exit(retcode)
update_ve = 'update_ve' in sys.argv
if update_ve or envtime < envspec or envreqs < envspec:
if update_ve:
# install ve
if envtime < envspec:
if path.exists(VE_ROOT):
shutil.rmtree(VE_ROOT)
virtualenv.logger = virtualenv.Logger(consumers=[])
virtualenv.create_environment(VE_ROOT, site_packages=True)
go_to_ve()
# check requirements
if update_ve or envreqs < envspec:
import pip
pip.main(initial_args=['install', '-r', REQUIREMENTS])
file(VE_TIMESTAMP, 'w').close()
sys.exit(0)
else:
print "VirtualEnv need to be updated"
print "Run ./manage.py update_ve"
sys.exit(1)
go_to_ve()
# run django
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory")
sys.exit(1)
if __name__ == "__main__":
execute_manager(settings)
......@@ -3,4 +3,7 @@ simplejson==2.1.3
pyzmq==2.0.10.1
pycurl==7.19.0
python-dateutil==1.4.1
django-hudson
MySQL-python==1.2.3
psycopg2==2.4
......@@ -111,6 +111,7 @@ INSTALLED_APPS = (
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'django_hudson',
# 'django.contrib.admindocs',
'synnefo.auth',
'synnefo.api',
......
......@@ -108,6 +108,7 @@ INSTALLED_APPS = (
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'django_hudson',
# 'django.contrib.admindocs',
'synnefo.auth',
'synnefo.api',
......
......@@ -105,6 +105,7 @@ INSTALLED_APPS = (
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'django_hudson',
# 'django.contrib.admindocs',
'synnefo.auth',
'synnefo.api',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment