Exemple #1
0
# A list of extensions that will be enabled by default when first loading the
# extension registration. These won't be re-enabled automatically if disabled.
EXTENSIONS_ENABLED_BY_DEFAULT = [
    'rbintegrations.extension.RBIntegrationsExtension',
]

DJBLETS_EXTENSIONS_BROWSE_URL = 'https://www.reviewboard.org/store/'

# Load local settings.  This can override anything in here, but at the very
# least it needs to define database connectivity.
try:
    import settings_local
    from settings_local import *
except ImportError as exc:
    dependency_error('Unable to import settings_local.py: %s' % exc)

SESSION_COOKIE_PATH = SITE_ROOT

INSTALLED_APPS = RB_BUILTIN_APPS + RB_EXTRA_APPS + ['django_evolution']
MIDDLEWARE_CLASSES += RB_EXTRA_MIDDLEWARE_CLASSES

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            os.path.join(REVIEWBOARD_ROOT, 'templates'),
        ],
        'OPTIONS': {
            'builtins': [
                'reviewboard.site.templatetags.localsite',
Exemple #2
0
def check_dependencies(settings):
    # We're now safe to import anything that might touch Django settings,
    # such as code utilizing the database. Start importing what we need for
    # dependency checks.
    from djblets.util.filesystem import is_exe_in_path

    from reviewboard.admin.import_utils import has_module
    from reviewboard.dependencies import (dependency_error,
                                          dependency_warning,
                                          fail_if_missing_dependencies)

    # Make sure the correct version of Python is being used. This should be
    # covered by setup.py, but it's best to make sure here.
    if sys.version_info[0] != 2 or sys.version_info[1] != 7:
        dependency_error('Python 2.7 is required.')

    # Check for NodeJS and installed modules, to make sure these weren't
    # missed during installation.
    if not is_exe_in_path('node'):
        dependency_error('node (from NodeJS) was not found. It must be '
                         'installed from your package manager or from '
                         'https://nodejs.org/')

    if not os.path.exists('node_modules'):
        dependency_error('The node_modules directory is missing. Please '
                         're-run `./setup.py develop` to install all NodeJS '
                         'dependencies.')

    for key in ('UGLIFYJS_BINARY', 'LESS_BINARY', 'BABEL_BINARY'):
        path = settings.PIPELINE[key]

        if not os.path.exists(path):
            dependency_error('%s is missing. Please re-run `./setup.py '
                             'develop` to install all NodeJS dependencies.'
                             % os.path.abspath(path))

    # The following checks are non-fatal warnings, since these dependencies
    # are merely recommended, not required. These are primarily for SCM
    # support.
    if not has_module('pysvn') and not has_module('subvertpy'):
        dependency_warning('Neither the subvertpy nor pysvn Python modules '
                           'were found. Subversion integration will not work. '
                           'For pysvn, see your package manager for the '
                           'module or download from '
                           'http://pysvn.tigris.org/project_downloads.html. '
                           'For subvertpy, run `pip install subvertpy`. We '
                           'recommend pysvn for better compatibility.')

    if has_module('P4'):
        try:
            subprocess.call(['p4', '-h'],
                            stdin=subprocess.PIPE, stdout=subprocess.PIPE)
        except OSError:
            dependency_warning('The p4 command not found. Perforce '
                               'integration will not work. To enable support, '
                               'download p4 from '
                               'http://cdist2.perforce.com/perforce/ and '
                               'place it in your PATH.')
    else:
        dependency_warning('The p4python module was not found. Perforce '
                           'integration will not work. To enable support, '
                           'run `pip install p4python`')

    if not is_exe_in_path('hg'):
        dependency_warning('The hg command was not found. Mercurial '
                           'integration will not work. To enable support, '
                           'run `pip install mercurial`')

    if not is_exe_in_path('bzr'):
        dependency_warning('The bzr command was not found. Bazaar integration '
                           'will not work. To enable support, run '
                           '`pip install bzr`')

    if not is_exe_in_path('cvs'):
        dependency_warning('The cvs command was not found. CVS integration '
                           'will not work. To enable support, install cvs '
                           'from your package manager or from '
                           'http://www.nongnu.org/cvs/')

    if not is_exe_in_path('git'):
        dependency_warning('The git command not found. Git integration '
                           'will not work. To enable support, install git '
                           'from your package manager or from '
                           'https://git-scm.com/downloads')

    # Along with all those, Django will print warnings/errors for database
    # backend modules if the configuration requires it.
    #
    # Now that that's all done, check if anything was missing and, if so,
    # fail with some helpful text.
    fail_if_missing_dependencies()
Exemple #3
0

# A list of extensions that will be enabled by default when first loading the
# extension registration. These won't be re-enabled automatically if disabled.
EXTENSIONS_ENABLED_BY_DEFAULT = [
    'rbintegrations.extension.RBIntegrationsExtension',
]


# Load local settings.  This can override anything in here, but at the very
# least it needs to define database connectivity.
try:
    import settings_local
    from settings_local import *
except ImportError as exc:
    dependency_error('Unable to import settings_local.py: %s' % exc)


# If we're using MySQL, switch to our custom backend.
for db_info in DATABASES.values():
    if db_info['ENGINE'] == 'django.db.backends.mysql':
        db_info['ENGINE'] = 'djblets.db.backends.mysql'


SESSION_COOKIE_PATH = SITE_ROOT

INSTALLED_APPS = RB_BUILTIN_APPS + RB_EXTRA_APPS + ['django_evolution']
MIDDLEWARE_CLASSES += RB_EXTRA_MIDDLEWARE_CLASSES


TEMPLATES = [
Exemple #4
0
def check_dependencies(settings):
    # We're now safe to import anything that might touch Django settings,
    # such as code utilizing the database. Start importing what we need for
    # dependency checks.
    from djblets.util.filesystem import is_exe_in_path

    from reviewboard.admin.import_utils import has_module
    from reviewboard.dependencies import (dependency_error, dependency_warning,
                                          fail_if_missing_dependencies)

    # Make sure the correct version of Python is being used. This should be
    # covered by setup.py, but it's best to make sure here.
    pyver = sys.version_info[:2]

    if pyver < PYTHON_2_MIN_VERSION or (3, 0) <= pyver < PYTHON_3_MIN_VERSION:
        dependency_error('Python %s or %s+ is required.' %
                         (PYTHON_2_MIN_VERSION_STR, PYTHON_3_MIN_VERSION_STR))

    # Check for NodeJS and installed modules, to make sure these weren't
    # missed during installation.
    if not is_exe_in_path('node'):
        dependency_error('node (from NodeJS) was not found. It must be '
                         'installed from your package manager or from '
                         'https://nodejs.org/')

    if not os.path.exists('node_modules'):
        dependency_error('The node_modules directory is missing. Please '
                         're-run `./setup.py develop` to install all NodeJS '
                         'dependencies.')

    for key in ('UGLIFYJS_BINARY', 'LESS_BINARY', 'BABEL_BINARY'):
        path = settings.PIPELINE[key]

        if not os.path.exists(path):
            dependency_error('%s is missing. Please re-run `./setup.py '
                             'develop` to install all NodeJS dependencies.' %
                             os.path.abspath(path))

    # The following checks are non-fatal warnings, since these dependencies
    # are merely recommended, not required. These are primarily for SCM
    # support.
    if not has_module('pysvn') and not has_module('subvertpy'):
        dependency_warning('Neither the subvertpy nor pysvn Python modules '
                           'were found. Subversion integration will not work. '
                           'For pysvn, see your package manager for the '
                           'module or download from '
                           'http://pysvn.tigris.org/project_downloads.html. '
                           'For subvertpy, run `pip install subvertpy`. We '
                           'recommend pysvn for better compatibility.')

    if has_module('P4'):
        try:
            subprocess.call(['p4', '-h'],
                            stdin=subprocess.PIPE,
                            stdout=subprocess.PIPE)
        except OSError:
            dependency_warning('The p4 command not found. Perforce '
                               'integration will not work. To enable support, '
                               'download p4 from '
                               'http://cdist2.perforce.com/perforce/ and '
                               'place it in your PATH.')
    else:
        dependency_warning('The p4python module was not found. Perforce '
                           'integration will not work. To enable support, '
                           'run `pip install p4python`')

    if not is_exe_in_path('hg'):
        dependency_warning('The hg command was not found. Mercurial '
                           'integration will not work. To enable support, '
                           'run `pip install mercurial`')

    if not is_exe_in_path('bzr'):
        dependency_warning('The bzr command was not found. Bazaar integration '
                           'will not work. To enable support, run '
                           '`pip install bzr`')

    if not is_exe_in_path('cvs'):
        dependency_warning('The cvs command was not found. CVS integration '
                           'will not work. To enable support, install cvs '
                           'from your package manager or from '
                           'http://www.nongnu.org/cvs/')

    if not is_exe_in_path('git'):
        dependency_warning('The git command not found. Git integration '
                           'will not work. To enable support, install git '
                           'from your package manager or from '
                           'https://git-scm.com/downloads')

    # Along with all those, Django will print warnings/errors for database
    # backend modules if the configuration requires it.
    #
    # Now that that's all done, check if anything was missing and, if so,
    # fail with some helpful text.
    fail_if_missing_dependencies()