From a0ef331191fa8e1c7a7a9816f1cf35ed6b9bfe59 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Tue, 6 Dec 2011 11:18:41 -0300 Subject: made dependency checking more complete and incremented revision --- askbot/__init__.py | 26 +++++++++++++++++++++++++- askbot/doc/source/changelog.rst | 9 +++++---- askbot/models/__init__.py | 6 +++--- askbot/startup_procedures.py | 20 ++++++++++++++------ setup.py | 24 +----------------------- 5 files changed, 48 insertions(+), 37 deletions(-) diff --git a/askbot/__init__.py b/askbot/__init__.py index 9686b5f5..99c3f596 100644 --- a/askbot/__init__.py +++ b/askbot/__init__.py @@ -9,7 +9,31 @@ import smtplib import sys import logging -VERSION = (0, 7, 32) +VERSION = (0, 7, 33) + +#keys are module names used by python imports, +#values - the package qualifier to use for pip +REQUIREMENTS = { + 'akismet': 'akismet', + 'django': 'django>=1.1.2', + 'jinja2': 'Jinja2', + 'coffin': 'Coffin>=0.3', + 'south': 'South>=0.7.1', + 'oauth2': 'oauth2', + 'markdown2': 'markdown2', + 'html5lib': 'html5lib', + 'keyedcache': 'django-keyedcache', + 'threaded_multihost': 'django-threaded-multihost', + 'robots': 'django-robots', + 'unidecode': 'unidecode', + 'django_countries': 'django-countries==1.0.5', + 'djcelery': 'django-celery==2.2.7', + 'djkombu': 'django-kombu==0.9.2', + 'followit': 'django-followit', + 'recaptcha_works': 'django-recaptcha-works', + 'openid': 'python-openid', + 'pystache': 'pystache==0.3.1', +} #necessary for interoperability of django and coffin try: diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst index c8bd18f2..2617b096 100644 --- a/askbot/doc/source/changelog.rst +++ b/askbot/doc/source/changelog.rst @@ -1,16 +1,17 @@ Changes in Askbot ================= -Development version -------------------- +0.7.33 (Current Version) +------------------------ * Made on log in redirect to the forum index page by default and to the question page, if user was reading the question it is still possible to override the ``next`` url parameter or just rely on django's ``LOGIN_REDIRECT_URL`` (Evgeny) * Implemented retraction of offensive flags (Dejan Noveski) +* Made automatic dependency checking more complete (Evgeny) -0.7.32 (Current Version) ------------------------- +0.7.32 +------ * Bugfixes in English locale (Evgeny) 0.7.31 diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py index 4c5cfdc5..9f5e8999 100644 --- a/askbot/models/__init__.py +++ b/askbot/models/__init__.py @@ -1,3 +1,6 @@ +from askbot import startup_procedures +startup_procedures.run() + import logging import re import hashlib @@ -36,9 +39,6 @@ from askbot.utils.decorators import auto_now_timestamp from askbot.utils.slug import slugify from askbot.utils.diff import textDiff as htmldiff from askbot.utils import mail -from askbot import startup_procedures - -startup_procedures.run() def get_model(model_name): return models.get_model('askbot', model_name) diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py index 5e2f7da0..9c962f2a 100644 --- a/askbot/startup_procedures.py +++ b/askbot/startup_procedures.py @@ -12,7 +12,6 @@ import os from django.db import transaction from django.conf import settings as django_settings from django.core.exceptions import ImproperlyConfigured -from askbot.models import badges from askbot.utils.loading import load_module PREAMBLE = """\n @@ -120,15 +119,18 @@ def try_import(module_name, pypi_package_name): try: load_module(module_name) except ImportError, error: - message = unicode(error) + ' run\npip install %s' % pypi_package_name - message += '\nTo install all the dependencies at once, type:' + message = 'Error: ' + unicode(error) + message += '\n\nPlease run: >pip install %s' % pypi_package_name + message += '\n\nTo install all the dependencies at once, type:' message += '\npip install -r askbot_requirements.txt\n' + message += '\nType ^C to quit.' raise ImproperlyConfigured(message) def test_modules(): """tests presence of required modules""" - try_import('akismet', 'akismet') - try_import('recaptcha_works', 'django-recaptcha-works') + from askbot import REQUIREMENTS + for module_name, pip_path in REQUIREMENTS.items(): + try_import(module_name, pip_path) def test_postgres(): """Checks for the postgres buggy driver, version 2.4.2""" @@ -283,8 +285,14 @@ def run_startup_tests(): @transaction.commit_manually def run(): """runs all the startup procedures""" - run_startup_tests() try: + run_startup_tests() + except ImproperlyConfigured, error: + transaction.rollback() + print error + sys.exit(1) + try: + from askbot.models import badges badges.init_badges() transaction.commit() except Exception, error: diff --git a/setup.py b/setup.py index 253f9db9..2227aba3 100644 --- a/setup.py +++ b/setup.py @@ -6,28 +6,6 @@ import sys #NOTE: if you want to develop askbot #you might want to install django-debug-toolbar as well -install_requires = [ - 'akismet', - 'django>=1.1.2', - 'Jinja2', - 'Coffin>=0.3', - 'South>=0.7.1', - 'oauth2', - 'markdown2', - 'html5lib', - 'django-keyedcache', - 'django-threaded-multihost', - 'django-robots', - 'unidecode', - 'django-countries==1.0.5', - 'django-celery==2.2.7', - 'django-kombu==0.9.2', - 'django-followit', - 'django-recaptcha-works', - 'python-openid', - 'pystache==0.3.1', -] - import askbot setup( @@ -46,7 +24,7 @@ setup( }, url = 'http://askbot.org', include_package_data = True, - install_requires = install_requires, + install_requires = askbot.REQUIREMENTS.values(), classifiers = [ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', -- cgit v1.2.3-1-g7c22