diff --git a/AUTHORS.rst b/AUTHORS.rst index e6addf7..be2f24d 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -13,6 +13,7 @@ Contributors ------------ * Aaron Boman +* Alexander Pervakov * Carlo Ascani * Claudio Luck * Enkel Mitrushi diff --git a/HISTORY.rst b/HISTORY.rst index 51375e1..5000de7 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,13 @@ History ------- +0.8.0 (XXXX-XX-XX) +++++++++++++++++++ + +* Options can now be provided via an ini file for easy scripting +* Better migration modules discovery strategy +* Minor fixes + 0.7.9 (2015-07-21) ++++++++++++++++++ diff --git a/README.rst b/README.rst index 4815ae2..8d1d37e 100644 --- a/README.rst +++ b/README.rst @@ -67,9 +67,9 @@ The current supported version matrix is the following: +----------------+-------------+-------------+-------------+-------------+-------------+ | django CMS 3.0 | Supported | Supported | Supported | Supported | Unsupported | +----------------+-------------+-------------+-------------+-------------+-------------+ -| django CMS 3.1 | Unsupported | Unsupported | Supported | Supported | WiP | +| django CMS 3.1 | Unsupported | Unsupported | Supported | Supported | Supported | +----------------+-------------+-------------+-------------+-------------+-------------+ -| django CMS dev | Unsupported | Unsupported | Supported | Supported | WiP | +| django CMS dev | Unsupported | Unsupported | Supported | Supported | Supported | +----------------+-------------+-------------+-------------+-------------+-------------+ Any beta and develop version of Django and django CMS, by its very nature, diff --git a/config.ini.sample b/config.ini.sample new file mode 100644 index 0000000..ec33ae2 --- /dev/null +++ b/config.ini.sample @@ -0,0 +1,27 @@ +[djangocms_installer] +db = sqlite://localhost/project.db +i18n = yes +use-tz = yes +timezone = +reversion = yes +permissions = yes +languages = +django-version = stable +cms-version = stable +parent-dir = . +bootstrap = no +templates = no +starting-page = no +list-plugins = false +dump-requirements = false +no-input = false +filer = false +requirements = +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/djangocms_installer/__init__.py b/djangocms_installer/__init__.py index b3e7d88..e49f196 100644 --- a/djangocms_installer/__init__.py +++ b/djangocms_installer/__init__.py @@ -2,4 +2,4 @@ # -*- coding: utf-8 -*- __author__ = 'Iacopo Spalletti' __email__ = 'i.spalletti@nephila.it' -__version__ = '0.7.10.dev1' +__version__ = '0.8.0.dev3' diff --git a/djangocms_installer/config/__init__.py b/djangocms_installer/config/__init__.py index b8c34f5..c0475c0 100644 --- a/djangocms_installer/config/__init__.py +++ b/djangocms_installer/config/__init__.py @@ -9,7 +9,7 @@ from tzlocal import get_localzone -from . import data +from . import data, ini from .internal import DbAction, validate_project from .. import compat, utils from ..utils import less_than_version, supported_versions @@ -20,6 +20,12 @@ def parse(args): Define the available arguments """ parser = argparse.ArgumentParser(description='Bootstrap a django CMS project.') + parser.add_argument('--config-file', dest='config_file', action='store', + default=None, + help='Configuration file for djangocms_installer') + parser.add_argument('--config-dump', dest='config_dump', action='store', + default=None, + help='Dump configuration file with current args') parser.add_argument('--db', '-d', dest='db', action=DbAction, default='sqlite://localhost/project.db', help='Database configuration (in URL format)') @@ -72,7 +78,7 @@ def parse(args): # Advanced options. These have a predefined default and are not managed # by config wizard. - #parser.add_argument('--aldryn', '-a', dest='aldryn', action='store_true', + # parser.add_argument('--aldryn', '-a', dest='aldryn', action='store_true', # default=False, help="Use Aldryn-boilerplate as project template") parser.add_argument('--no-input', '-q', dest='noinput', action='store_true', default=False, help="Don't run the configuration wizard, just use the provided values") @@ -103,7 +109,10 @@ def parse(args): for action in parser._positionals._actions: if action.dest == 'timezone': action.default = 'UTC' - args = parser.parse_args(args) + + # If config_args then pretend that config args came from the stdin and run parser again. + config_args = ini.parse_config_file(parser, args) + args = parser.parse_args(config_args + args) # First of all, check if the project name is valid if not validate_project(args.project_name): @@ -129,6 +138,10 @@ def parse(args): "please choose a different one\n" % args.project_path) sys.exit(4) + if args.config_dump and os.path.isfile(args.config_dump): + sys.stdout.write('Cannot dump because given configuration file "%s" is exists.\n' % args.config_dump) + sys.exit(8) + for item in data.CONFIGURABLE_OPTIONS: action = parser._option_string_actions[item] choices = default = "" @@ -296,6 +309,9 @@ def parse(args): setattr(args, 'urlconf_path', os.path.join(args.project_directory, args.project_name, 'urls.py').strip()) + if args.config_dump: + ini.dump_config_file(args.config_dump, args, parser) + return args diff --git a/djangocms_installer/config/data.py b/djangocms_installer/config/data.py index dfd4d45..f6111ef 100644 --- a/djangocms_installer/config/data.py +++ b/djangocms_installer/config/data.py @@ -7,13 +7,13 @@ '--permissions', '--bootstrap', '--templates', '--starting-page'] -DJANGOCMS_DEVELOP = 'https://github.com/divio/django-cms/archive/develop.zip?%s' % time.time() ## to avoid getting this from caches or mirrors +DJANGOCMS_DEVELOP = 'https://github.com/divio/django-cms/archive/develop.zip?%s' % time.time() DJANGOCMS_RC = 'https://github.com/divio/django-cms/archive/3.0c2.zip' DJANGOCMS_BETA = 'https://github.com/divio/django-cms/archive/3.0.0.beta3.zip' DJANGOCMS_SUPPORTED = ('2.4', '3.0', '3.1', 'stable', 'develop') -DJANGO_DEVELOP = 'https://github.com/django/django/archive/master.zip?%s' % time.time() ## to avoid getting this from caches or mirrors -DJANGO_BETA = 'https://github.com/django/django/archive/master.zip?%s' % time.time() ## to avoid getting this from caches or mirrors +DJANGO_DEVELOP = 'https://github.com/django/django/archive/master.zip?%s' % time.time() +DJANGO_BETA = 'https://github.com/django/django/archive/master.zip?%s' % time.time() DJANGO_SUPPORTED = ('1.4', '1.5', '1.6', '1.7', '1.8', 'stable') CMS_VERSION_MATRIX = { @@ -35,7 +35,7 @@ 3.2: (1.6, 1.8), } -REQUIREMENTS ={ +REQUIREMENTS = { 'default': [ 'django-classy-tags>=0.3.4.1', 'html5lib', diff --git a/djangocms_installer/config/ini.py b/djangocms_installer/config/ini.py new file mode 100644 index 0000000..182334b --- /dev/null +++ b/djangocms_installer/config/ini.py @@ -0,0 +1,122 @@ +# -*- coding: utf-8 -*- +from __future__ import print_function + +import sys + +try: + from configparser import ConfigParser # Python 3. +except ImportError: + from ConfigParser import ConfigParser # Python 2. + +from .data import CMS_VERSION_MATRIX, DJANGO_VERSION_MATRIX + + +SECTION = 'djangocms_installer' + + +def parse_config_file(parser, stdin_args): + """Parse config file. + + Returns a list of additional args. + """ + config_args = [] + + # Temporary switch required args and save them to restore. + required_args = [] + for action in parser._actions: + if action.required: + required_args.append(action) + action.required = False + + parsed_args = parser.parse_args(stdin_args) + + # Restore required args. + for action in required_args: + action.required = True + + if not parsed_args.config_file: + return config_args + + config = ConfigParser() + if not config.read(parsed_args.config_file): + sys.stderr.write("Config file '%s' doesn't exists\n" % parsed_args.config_file) + sys.exit(7) # It isn't used anythere. + + config_args = _convert_config_to_stdin(config, parser) + return config_args + + +def dump_config_file(filename, args, parser=None): + """Dump args to config file.""" + config = ConfigParser() + config.add_section(SECTION) + if parser is None: + for attr in args: + config.set(SECTION, attr, args.attr) + else: + keys_empty_values_not_pass = ( + '--extra-settings', '--languages', '--requirements', '--template', '--timezone') + + # positionals._option_string_actions + for action in parser._actions: + if action.dest in ('help', 'config_file', 'config_dump', 'project_name'): + continue + + keyp = action.option_strings[0] + option_name = keyp.lstrip('-') + option_value = getattr(args, action.dest) + if any([i for i in keys_empty_values_not_pass if i in action.option_strings]): + if action.dest == 'timezone': + config.set(SECTION, option_name, option_value.zone) + elif action.dest == 'languages': + if len(option_value) == 1 and option_value[0] == 'en': + config.set(SECTION, option_name, '') + else: + config.set(SECTION, option_name, ','.join()) + else: + config.set(SECTION, option_name, option_value if option_value else '') + elif action.choices == ('yes', 'no'): + config.set(SECTION, option_name, 'yes' if option_value else 'no') + elif action.dest == 'templates': + config.set(SECTION, option_name, option_value if option_value else 'no') + elif action.dest == 'cms_version': + version = 'stable' if option_value == CMS_VERSION_MATRIX['stable'] else option_value + config.set(SECTION, option_name, version) + elif action.dest == 'django_version': + version = 'stable' if option_value == DJANGO_VERSION_MATRIX['stable'] else option_value + config.set(SECTION, option_name, version) + elif action.const: + config.set(SECTION, option_name, 'true' if option_value else 'false') + else: + config.set(SECTION, option_name, str(option_value)) + with open(filename, 'w') as fp: + config.write(fp) + + +def _convert_config_to_stdin(config, parser): + """Convert config options to stdin args. + + Especially boolean values, for more information + @see https://docs.python.org/3.4/library/configparser.html#supported-datatypes + """ + keys_empty_values_not_pass = ( + '--extra-settings', '--languages', '--requirements', '--template', '--timezone') + args = [] + for key, val in config.items(SECTION): + keyp = '--%s' % key + action = parser._option_string_actions[keyp] + + if action.const: + try: + if config.getboolean(SECTION, key): + args.append(keyp) + except ValueError: + args.extend([keyp, val]) # Pass it as is to get the error from ArgumentParser. + elif any([i for i in keys_empty_values_not_pass if i in action.option_strings]): + # Some keys with empty values shouldn't be passed into args to use their defaults from ArgumentParser. + if val != '': + args.extend([keyp, val]) + else: + args.extend([keyp, val]) + + return args diff --git a/djangocms_installer/config/settings.py b/djangocms_installer/config/settings.py index fe9cf65..856fe64 100644 --- a/djangocms_installer/config/settings.py +++ b/djangocms_installer/config/settings.py @@ -184,46 +184,30 @@ } -SOUTH_MIGRATION_MODULES = ( - ('easy_thumbnails', 'easy_thumbnails.south_migrations'), - ('djangocms_text_ckeditor', 'djangocms_text_ckeditor.south_migrations'), -) - -MIGRATION_MODULES_COMMON = ( - ('djangocms_column', 'djangocms_column.migrations_django'), - ('djangocms_flash', 'djangocms_flash.migrations_django'), - ('djangocms_googlemap', 'djangocms_googlemap.migrations_django'), - ('djangocms_inherit', 'djangocms_inherit.migrations_django'), - ('djangocms_link', 'djangocms_link.migrations_django'), - ('djangocms_style', 'djangocms_style.migrations_django'), -) - -MIGRATION_MODULES_STANDARD = ( - ('djangocms_file', 'djangocms_file.migrations_django'), - ('djangocms_picture', 'djangocms_picture.migrations_django'), - ('djangocms_teaser', 'djangocms_teaser.migrations_django'), - ('djangocms_video', 'djangocms_video.migrations_django'), -) +APPHOOK_RELOAD_APPLICATIONS = [ + 'aldryn_apphook_reload' +] +APPHOOK_RELOAD_MIDDLEWARE_CLASS = 'aldryn_apphook_reload.middleware.ApphookReloadMiddleware' -MIGRATION_MODULES_FILER = ( - ('cmsplugin_filer_image', 'cmsplugin_filer_image.migrations_django'), - ('cmsplugin_filer_file', 'cmsplugin_filer_file.migrations_django'), - ('cmsplugin_filer_folder', 'cmsplugin_filer_folder.migrations_django'), - ('cmsplugin_filer_teaser', 'cmsplugin_filer_teaser.migrations_django'), - ('cmsplugin_filer_utils', 'cmsplugin_filer_utils.migrations_django'), - ('cmsplugin_filer_video', 'cmsplugin_filer_video.migrations_django'), +MIGRATIONS_CHECK_MODULES = ( + 'cms', + 'menus', + 'filer', + 'cmsplugin_filer_image', + 'cmsplugin_filer_file', + 'cmsplugin_filer_folder', + 'cmsplugin_filer_teaser', + 'cmsplugin_filer_utils', + 'cmsplugin_filer_video', + 'djangocms_text_ckeditor', + 'djangocms_column', + 'djangocms_flash', + 'djangocms_googlemap', + 'djangocms_inherit', + 'djangocms_link', + 'djangocms_style', + 'djangocms_file', + 'djangocms_picture', + 'djangocms_teaser', + 'djangocms_video', ) - -MIGRATION_MODULES_BASE = ( - ('cms', 'cms.migrations_django'), - ('menus', 'menus.migrations_django'), -) + MIGRATION_MODULES_COMMON + MIGRATION_MODULES_STANDARD - -MIGRATION_MODULES_BASE_FILER = ( - ('cms', 'cms.migrations_django'), - ('menus', 'menus.migrations_django'), -) + MIGRATION_MODULES_COMMON + MIGRATION_MODULES_FILER - -MIGRATION_MODULES_3_1 = MIGRATION_MODULES_COMMON + MIGRATION_MODULES_STANDARD - -MIGRATION_MODULES_3_1_FILER = MIGRATION_MODULES_COMMON + MIGRATION_MODULES_FILER \ No newline at end of file diff --git a/djangocms_installer/django/__init__.py b/djangocms_installer/django/__init__.py index 133c8b1..d79a8ad 100644 --- a/djangocms_installer/django/__init__.py +++ b/djangocms_installer/django/__init__.py @@ -1,20 +1,24 @@ # -*- coding: utf-8 -*- from __future__ import print_function -from copy import copy, deepcopy + import glob import os import re -try: - from shlex import quote as shlex_quote -except ImportError: - from pipes import quote as shlex_quote import shutil import subprocess import sys import tempfile +import textwrap import zipfile -from six import BytesIO +from copy import copy, deepcopy + +try: + from shlex import quote as shlex_quote +except ImportError: + from pipes import quote as shlex_quote + +from six import BytesIO from ..compat import iteritems from ..utils import chdir @@ -42,6 +46,22 @@ def create_project(config_data): subprocess.check_call(' '.join([sys.executable, os.path.join(os.path.dirname(sys.executable), 'django-admin.py'), 'startproject'] + args), shell=True) + +def _detect_migration_layout(vars, apps): + SOUTH_MODULES = {} + DJANGO_MODULES = {} + + for module in vars.MIGRATIONS_CHECK_MODULES: + if module in apps: + try: + mod = __import__('%s.migrations_django' % module) # NOQA + DJANGO_MODULES[module] = '%s.migrations_django' % module + SOUTH_MODULES[module] = '%s.migrations' % module + except Exception: + pass + return DJANGO_MODULES, SOUTH_MODULES + + def _install_aldryn(config_data): import requests media_project = os.path.join(config_data.project_directory, 'dist', 'media') @@ -245,23 +265,14 @@ def _build_settings(config_data): if config_data.cms_version == 2.4: apps.extend(vars.CMS_2_APPLICATIONS) apps.extend(vars.MPTT_APPS) - MIGRATION_MODULES = () elif config_data.cms_version == 3.0: apps = list(vars.CMS_3_HEAD) + apps apps.extend(vars.MPTT_APPS) apps.extend(vars.CMS_3_APPLICATIONS) - if config_data.filer: - MIGRATION_MODULES = vars.MIGRATION_MODULES_BASE_FILER - else: - MIGRATION_MODULES = vars.MIGRATION_MODULES_BASE else: apps = list(vars.CMS_3_HEAD) + apps apps.extend(vars.TREEBEARD_APPS) apps.extend(vars.CMS_3_APPLICATIONS) - if config_data.filer: - MIGRATION_MODULES = vars.MIGRATION_MODULES_3_1_FILER - else: - MIGRATION_MODULES = vars.MIGRATION_MODULES_3_1 if config_data.cms_version == 2.4: if config_data.filer: @@ -329,18 +340,25 @@ def _build_settings(config_data): text.append("CMS_PERMISSION = %s" % vars.CMS_PERMISSION) text.append("CMS_PLACEHOLDER_CONF = %s" % vars.CMS_PLACEHOLDER_CONF) - text.append("DATABASES = {\n%s'default':\n%s%s\n}" % (spacer, spacer * 2, config_data.db_parsed)) + text.append(textwrap.dedent(""" + DATABASES = { + 'default': { + %s + } + }""").strip() % (",\n" + spacer * 2).join(["'%s': '%s'" % (key, val) for key, val in sorted(config_data.db_parsed.items(), key=lambda x: x[0])])) + + DJANGO_MIGRATION_MODULES, SOUTH_MIGRATION_MODULES = _detect_migration_layout(vars, apps) if config_data.django_version >= 1.7: text.append("MIGRATION_MODULES = {\n%s%s\n}" % ( - spacer, (",\n" + spacer).join(["'%s': '%s'" % item for item in MIGRATION_MODULES]))) + spacer, (",\n" + spacer).join(["'%s': '%s'" % item for item in DJANGO_MIGRATION_MODULES.items()]))) + else: + text.append("SOUTH_MIGRATION_MODULES = {\n%s%s\n}" % ( + spacer, (",\n" + spacer).join(["'%s': '%s'" % item for item in SOUTH_MIGRATION_MODULES.items()]))) if config_data.filer: text.append("THUMBNAIL_PROCESSORS = (\n%s%s\n)" % ( spacer, (",\n" + spacer).join(["'%s'" % var for var in vars.THUMBNAIL_PROCESSORS]))) - if config_data.django_version <= 1.6: - text.append("SOUTH_MIGRATION_MODULES = {\n%s%s\n}" % ( - spacer, (",\n" + spacer).join(["'%s': '%s'" % item for item in vars.SOUTH_MIGRATION_MODULES]))) return "\n\n".join(text) diff --git a/djangocms_installer/install/__init__.py b/djangocms_installer/install/__init__.py index 072db6c..aab1f62 100644 --- a/djangocms_installer/install/__init__.py +++ b/djangocms_installer/install/__init__.py @@ -20,7 +20,6 @@ def check_install(config_data): Many other errors will go undetected """ errors = [] - size = 128, 128 # PIL tests try: @@ -73,7 +72,7 @@ def cleanup(requirements): # pragma: no cover args = ['uninstall', '-q', '-y'] args.extend(requirements.split()) - exit_status = pip.main(args) + pip.main(args) return True diff --git a/djangocms_installer/share/starting_page.py b/djangocms_installer/share/starting_page.py index a81885f..abf9013 100644 --- a/djangocms_installer/share/starting_page.py +++ b/djangocms_installer/share/starting_page.py @@ -31,8 +31,8 @@ def create_pages(): try: # try to get a feature placeholder placeholder_feature = page.placeholders.get(slot='feature') - p = add_plugin(placeholder_feature, 'TextPlugin', lang, - body=content['feature']) + add_plugin(placeholder_feature, 'TextPlugin', lang, + body=content['feature']) except Placeholder.DoesNotExist: # fallback, add it to the add_plugin(placeholder['main'], 'TextPlugin', lang, body=content['feature']) @@ -57,4 +57,4 @@ def create_pages(): if __name__ == '__main__': if LooseVersion(django.get_version()) >= LooseVersion('1.7'): django.setup() - create_pages() \ No newline at end of file + create_pages() diff --git a/docs/conf.py b/docs/conf.py index f537922..08d7612 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,7 +12,8 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os +import os +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the diff --git a/docs/faq.rst b/docs/faq.rst index fdfebc8..5c72ba0 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -27,7 +27,8 @@ FAQ **djangocms-installer** uses `dj-database-url`_ to get database configuration parameters; refer to this package for more details. -#. The installer dies with an error like ``ImportError: Could not import settings 'foo.bar.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named foo.bar.settings``, +#. The installer dies with an error like + ``ImportError: Could not import settings 'foo.bar.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named foo.bar.settings``, what's happening? Chances are you have ``DJANGO_SETTINGS_MODULE`` set in you environment, diff --git a/docs/libraries.rst b/docs/libraries.rst index 896a185..1f9eaae 100644 --- a/docs/libraries.rst +++ b/docs/libraries.rst @@ -3,7 +3,7 @@ Libraries installation issues ============================= -While this wizard try to handle most of the things for you, it doesn't check for +While this wizard tries to handle most of the things for you, it doesn't check for all the proper native (non python) libraries to be installed. Before running this, please check you have the proper header and libraries installed and available for packages to be installed. @@ -15,7 +15,7 @@ Libraries you would want to check: * postgresql (for ``psycopg``) * libmysqlclient (for ``Mysql-Python``) -The actualy package name may vary depending on the platform / distribution you +The actual package name may vary depending on the platform / distribution you are using; you should make sure you have the library headers file installed (mostly contained in package with `-dev` in its name: e.g. `libjpeg-dev` for `libjpeg` library). @@ -27,9 +27,12 @@ Below are provided examples for Debian/Ubuntu, for other Linux distributions or other operating system details may vary: * Pillow: ``sudo apt-get install -y libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev`` -* postgres: ``sudo apt-get install libqd-dev`` +* Postgres: ``sudo apt-get install libqd-dev`` * MySQL: ``sudo apt-get install libmysqlclient-dev`` +If you are using yum to install packages, use ``yum search xx`` to search for any missing packages + +* Pillow: ``sudo yum install libjpeg-devel libpng-devel libtiff-devel freetype-devel zlib-devel`` Fixing libraries installation issues ------------------------------------ @@ -47,6 +50,8 @@ the package is compiled with some functionality missing, you have to first deinstall it (`pip uninstall *package-name*`), then install the correct library and the execute ``djangocms-installer`` again. +* Reinstall ``pip install --upgrade --force-reinstall --no-deps djangocms-installer`` + For older Debian / Ubuntu releases, a manual fix may be needed to properly fix compilation issues: see `stackoverflow`_ diff --git a/docs/reference.rst b/docs/reference.rst index 887e7d9..859d3ac 100644 --- a/docs/reference.rst +++ b/docs/reference.rst @@ -57,6 +57,9 @@ advanced usage: * ``--no-input``, ``-q``: If given **djangocms installer** run in :ref:`batch_mode`; * ``--filer``, ``-f``: Install and configure django-filer plugins; +* ``--config-file``: Provides the configuration options via a ini file; see :ref:`ini_mode`; +* ``--config-dump``: Dumps the configuration in a format suitable for ``-config-file`` + option; see :ref:`ini_mode`; * ``--dump-requirements``, ``-R``: Dumps the generated requirements to stdout and exits; see :ref:`dump_mode`; * ``--requirements``, ``-r``: You can use a custom requirements files instead of the @@ -71,11 +74,11 @@ advanced usage: project; * ``--extra-settings``: Path to a file with extra variables to append to generated settings file. It doesn't need to be a Python file, its content is blindly copied in the project settings. -*``--aldryn``, ``-a``: Use `aldryn-boilerplate`_; this downloads **aldryn-boilerplate** and copies +* ``--aldryn``, ``-a``: Use `aldryn-boilerplate`_; this downloads **aldryn-boilerplate** and copies it to the project, adapting the project layout according to boilerplate specifications; the use of aldryn-boilerplate requires manual actions, look at `aldryn-boilerplate documentation`_ for further informations. -*``--skip-empty-check``, ``-s``: Skip the check if the project dir contains files or directory; +* ``--skip-empty-check``, ``-s``: Skip the check if the project dir contains files or directory; in case of error when setting up the project, ``djangocms-installer`` may ask you to remove the directory, be careful if using this option as you may remove files not related to the project set up by the installer. diff --git a/docs/usage.rst b/docs/usage.rst index 8f4d553..5254b6b 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -58,6 +58,51 @@ This can be helpful to customize the virtualenv: See :ref:`arguments` for arguments reference +.. _ini_mode: + +Config file mode +---------------- + +In config file mode, all (or some) options can be provided via an external configuration file. + +See a `complete example`_ +with all available arguments. + +Is it possible to either provide all the values in the config file: + +.. code-block:: shell + + djangocms_installer --config-file /path/to/config.ini project_name + +Or just some, or overriding by using the command line arguments: + +.. code-block:: shell + + djangocms_installer --config-file /path/general-config.ini -p /path/other/proj -s -q project_name + +.. note:: If config.ini not contains `no-input = true` and `-q` argument isn't set then one + act as a placeholder with default values for wizard. + + +Dump config files +^^^^^^^^^^^^^^^^^ + +Values passed to the installer can be dumped for later reuse: + +.. code-block:: shell + + djangocms_installer --config-dump /path/config.ini -p . project_name + +if installation fails dump can be used to fix some arguments and re-run installer with dumped config: + +.. code-block:: shell + + djangocms_installer --config-dump /path/config.ini --db postgres://wrong-usr:pwd@host/db -p . project_name + # fails + + djangocms_installer --config-file /path/config.ini --db postgres://correct-user:pwd@host/db -p . project_name + # succeed + Custom settings --------------- @@ -106,4 +151,6 @@ Use different templates directory You can create the base project with a custom templateset by using the ``--templates`` parameter. Be aware that while **djangocms installer** will copy the files for you, it won't update the ``CMS_TEMPLATES`` settings -parameter, so you'll need to modify that after installation. \ No newline at end of file +parameter, so you'll need to modify that after installation. + +.. _complete example: https://github.com/nephila/djangocms-installer/blob/develop/config.ini.sample diff --git a/requirements_dev.txt b/requirements-test.txt similarity index 69% rename from requirements_dev.txt rename to requirements-test.txt index 61ca229..5699f0b 100644 --- a/requirements_dev.txt +++ b/requirements-test.txt @@ -1,5 +1,6 @@ -r requirements.txt flake8 tox -unittest2 mock +pillow +coverage diff --git a/tests/base.py b/tests/base.py index cf66ee6..b6a4c6f 100644 --- a/tests/base.py +++ b/tests/base.py @@ -6,13 +6,14 @@ import sys import tempfile +from copy import copy +from six import StringIO + if sys.version_info[:2] < (2, 7): import unittest2 as unittest else: import unittest -from six import StringIO - SYSTEM_ACTIVATE = os.path.join(os.path.dirname(sys.executable), 'activate_this.py') @@ -74,6 +75,7 @@ def _create_project_dir(self): print("creating virtualenv", self.virtualenv_dir) def tearDown(self): + from djangocms_installer.config.settings import MIGRATIONS_CHECK_MODULES if self.verbose: print("deactivating virtualenv", self.virtualenv_dir) if os.path.exists(SYSTEM_ACTIVATE): @@ -85,6 +87,10 @@ def tearDown(self): exec(code, dict(__file__=SYSTEM_ACTIVATE)) sys.executable = os.path.join(os.path.dirname(SYSTEM_ACTIVATE), 'python') super(IsolatedTestClass, self).tearDown() + modules = copy(sys.modules) + for module in modules: + if 'django' in module: + del sys.modules[module] def setUp(self): super(IsolatedTestClass, self).setUp() diff --git a/tests/config.py b/tests/config.py index 881f893..a1c198c 100644 --- a/tests/config.py +++ b/tests/config.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import print_function +from argparse import Namespace +import copy import os import sys @@ -8,10 +10,11 @@ from tzlocal import get_localzone from djangocms_installer import config +from djangocms_installer.config.data import CMS_VERSION_MATRIX, DJANGO_VERSION_MATRIX from djangocms_installer.install import check_install from djangocms_installer.utils import less_than_version, supported_versions -from .base import BaseTestClass +from .base import unittest, BaseTestClass class TestConfig(BaseTestClass): @@ -582,3 +585,129 @@ def test_show_requirements(self): config.show_requirements(conf_data) finally: sys.stdout = sys.__stdout__ + + +class TestBaseConfig(unittest.TestCase): + base_dir = os.path.dirname(os.path.dirname(__file__)) + config_dir = os.path.join(base_dir, 'tests/fixtures/configs') + args = ['--config-file', '-s', '-q', 'example_prj'] + config_fixture = Namespace(**{ + 'bootstrap': False, + 'cms_version': CMS_VERSION_MATRIX['stable'], + 'db': 'sqlite://localhost/project.db', + 'django_version': DJANGO_VERSION_MATRIX['stable'], + 'dump_reqs': False, + 'extra_settings': None, + 'filer': False, + 'i18n': 'yes', + 'languages': ['en'], + 'no_db_driver': False, + 'no_deps': False, + 'noinput': True, + 'no_sync': False, + 'no_user': False, + 'permissions': 'yes', + 'plugins': False, + 'project_directory': '.', + 'project_name': 'example_prj', + 'requirements_file': None, + 'reversion': 'yes', + 'skip_project_dir_check': True, + 'starting_page': False, + 'template': None, + 'templates': False, + 'timezone': get_localzone(), + 'use_timezone': 'yes', + 'utc': False + }) + + def __init__(self, *args, **kwargs): + self.config_not_exists = self.conf('config-dump.ini') + + super(TestBaseConfig, self).__init__(*args, **kwargs) + + def tearDown(self): + if os.path.isfile(self.config_not_exists): + os.remove(self.config_not_exists) + + def conf(self, filename): + return os.path.join(self.config_dir, filename) + + def unused(self, config_data): + """Remove not configurable keys.""" + for attr in ('aldryn', 'config_dump', 'config_file', 'db_driver', 'db_parsed', + 'project_path', 'settings_path', 'urlconf_path'): + delattr(config_data, attr) + # When `requirements` arg is used then requirements attr isn't set. + if hasattr(config_data, 'requirements'): + delattr(config_data, 'requirements') + + @patch('sys.stdout') + @patch('sys.stderr') + def test_parse_config_file(self, *args): + """Tests .config.__init__._parse_config_file function.""" + with self.assertRaises(SystemExit) as error: + config_data = config.parse(self.args[0:1] + [self.conf('config-not-exists.ini')] + self.args[1:]) + self.assertEqual(7, error.exception.code) + + args = self.args[0:1] + [self.conf('config-01.ini')] + self.args[1:] + config_data = config.parse(args) + self.unused(config_data) + self.assertEqual(self.config_fixture, config_data) + + fixture = copy.copy(self.config_fixture) + test_data = ( + ('config-02.ini', 'db', 'postgres://user:pwd@host:54321/dbname'), + ('config-03.ini', 'i18n', 'no'), + ('config-04.ini', 'use_timezone', 'no'), + ('config-05.ini', 'timezone', 'Europe/London'), + ('config-06.ini', 'reversion', 'no'), + ('config-07.ini', 'permissions', 'no'), + ('config-08.ini', 'languages', ['en', 'ru']), + ('config-09.ini', 'django_version', 1.8), + ('config-10.ini', 'i18n', 'no'), + ('config-11.ini', 'project_directory', '/test/me'), + ('config-12.ini', 'bootstrap', True), + ('config-13.ini', 'templates', '.'), + ('config-14.ini', 'starting_page', True), + ('config-15.ini', 'plugins', True), + ('config-16.ini', 'dump_reqs', True), + ('config-17.ini', 'noinput', True), + ('config-18.ini', 'filer', True), + ('config-19.ini', 'requirements_file', '/test/reqs'), + ('config-20.ini', 'no_deps', True), + ('config-21.ini', 'no_db_driver', True), + ('config-22.ini', 'no_sync', True), + ('config-23.ini', 'no_user', True), + ('config-24.ini', 'template', '/test/template'), + ('config-25.ini', 'extra_settings', '/test/extra_settings'), + ('config-26.ini', 'skip_project_dir_check', True), + ('config-27.ini', 'utc', True), + ) + for filename, key, val in test_data: + setattr(fixture, key, val) # Change value. + args = self.args[0:1] + [self.conf(filename)] + self.args[1:] # Load new config. + config_data = config.parse(args) + self.unused(config_data) + self.assertEqual(fixture, config_data) # Check if config value and changed value equals. + + @patch('sys.stdout') + @patch('sys.stderr') + def test_dump_config_file(self, *args): + """Tests .config.ini.dump_config_file function.""" + config_exists = self.conf('config-01.ini') + + with self.assertRaises(SystemExit) as error: + config_data = config.parse(['--config-dump', config_exists] + self.args[1:] + ['-p', '.']) + self.assertEqual(8, error.exception.code) + + config_data = config.parse(['--config-dump', self.config_not_exists] + self.args[1:] + ['-p', '.']) + self.assertTrue(os.path.isfile(self.config_not_exists)) + + fixture = copy.copy(self.config_fixture) + setattr(fixture, 'timezone', get_localzone().zone) + # Load dumped config. + args = self.args[0:1] + [self.config_not_exists] + self.args[1:] + config_data = config.parse(args) + self.unused(config_data) + self.assertEqual(fixture, config_data) diff --git a/tests/django.py b/tests/django.py index 81fcb26..08cc1f3 100644 --- a/tests/django.py +++ b/tests/django.py @@ -4,10 +4,9 @@ import re import sqlite3 import sys +import textwrap from djangocms_installer import config, django, install -from djangocms_installer.config.settings import (MIGRATION_MODULES_BASE, - MIGRATION_MODULES_3_1_FILER) from .base import unittest, IsolatedTestClass dj_ver = '1.7' if sys.version_info >= (2, 7) else '1.6' @@ -243,9 +242,8 @@ def test_patch_django_17_settings(self): ## checking for django options self.assertFalse('south' in project.settings.INSTALLED_APPS) - for module in MIGRATION_MODULES_BASE: - self.assertTrue(module[0] in project.settings.MIGRATION_MODULES.keys()) - self.assertTrue(module[1] in project.settings.MIGRATION_MODULES.values()) + self.assertFalse('cms' in project.settings.MIGRATION_MODULES) + self.assertFalse('djangocms_text_ckeditor' in project.settings.MIGRATION_MODULES) def test_patch_31(self): config_data = config.parse(['--db=sqlite://localhost/test.db', @@ -293,9 +291,8 @@ def test_patch_django_17_31(self): ## checking for django options self.assertFalse('south' in project.settings.INSTALLED_APPS) - for module in MIGRATION_MODULES_3_1_FILER: - self.assertTrue(module[0] in project.settings.MIGRATION_MODULES.keys()) - self.assertTrue(module[1] in project.settings.MIGRATION_MODULES.values()) + self.assertFalse('filer' in project.settings.MIGRATION_MODULES) + self.assertFalse('djangocms_text_ckeditor' in project.settings.MIGRATION_MODULES) @unittest.skipIf(sys.version_info <= (2, 7), reason="django 1.7 does not support python 2.6") @@ -512,7 +509,7 @@ def test_database_setup_filer(self): def test_database_setup(self): config_data = config.parse(['--db=sqlite://localhost/test.db', - '-q', '--cms-version=3.0', '--django=%s' % dj_ver, + '-q', '--cms-version=3.1', '--django=%s' % dj_ver, '-p'+self.project_dir, 'cms_project']) install.requirements(config_data.requirements) django.create_project(config_data) @@ -534,3 +531,22 @@ def test_database_setup(self): query = project_db.execute('SELECT * FROM auth_user') self.assertTrue(query) + +class TestBaseDjango(unittest.TestCase): + def test_build_settings(self): + """Tests django.__init__._build_settings function.""" + config_data = config.parse(['--db=postgres://user:pwd@host:5432/dbname', + '--cms-version=stable', '--django=%s' % dj_ver, + '-q', '-p .', 'example_prj']) + settings = django._build_settings(config_data) + self.assertTrue(textwrap.dedent(''' + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'HOST': 'host', + 'NAME': 'dbname', + 'PASSWORD': 'pwd', + 'PORT': '5432', + 'USER': 'user' + } + }''').strip() in settings) diff --git a/tests/fixtures/configs/config-01.ini b/tests/fixtures/configs/config-01.ini new file mode 100644 index 0000000..ec33ae2 --- /dev/null +++ b/tests/fixtures/configs/config-01.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = sqlite://localhost/project.db +i18n = yes +use-tz = yes +timezone = +reversion = yes +permissions = yes +languages = +django-version = stable +cms-version = stable +parent-dir = . +bootstrap = no +templates = no +starting-page = no +list-plugins = false +dump-requirements = false +no-input = false +filer = false +requirements = +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-02.ini b/tests/fixtures/configs/config-02.ini new file mode 100644 index 0000000..51ef4c6 --- /dev/null +++ b/tests/fixtures/configs/config-02.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = yes +use-tz = yes +timezone = +reversion = yes +permissions = yes +languages = +django-version = stable +cms-version = stable +parent-dir = . +bootstrap = no +templates = no +starting-page = no +list-plugins = false +dump-requirements = false +no-input = false +filer = false +requirements = +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-03.ini b/tests/fixtures/configs/config-03.ini new file mode 100644 index 0000000..3699851 --- /dev/null +++ b/tests/fixtures/configs/config-03.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = yes +timezone = +reversion = yes +permissions = yes +languages = +django-version = stable +cms-version = stable +parent-dir = . +bootstrap = no +templates = no +starting-page = no +list-plugins = false +dump-requirements = false +no-input = false +filer = false +requirements = +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-04.ini b/tests/fixtures/configs/config-04.ini new file mode 100644 index 0000000..b7a5e20 --- /dev/null +++ b/tests/fixtures/configs/config-04.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = +reversion = yes +permissions = yes +languages = +django-version = stable +cms-version = stable +parent-dir = . +bootstrap = no +templates = no +starting-page = no +list-plugins = false +dump-requirements = false +no-input = false +filer = false +requirements = +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-05.ini b/tests/fixtures/configs/config-05.ini new file mode 100644 index 0000000..5756262 --- /dev/null +++ b/tests/fixtures/configs/config-05.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = yes +permissions = yes +languages = +django-version = stable +cms-version = stable +parent-dir = . +bootstrap = no +templates = no +starting-page = no +list-plugins = false +dump-requirements = false +no-input = false +filer = false +requirements = +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-06.ini b/tests/fixtures/configs/config-06.ini new file mode 100644 index 0000000..9723b7b --- /dev/null +++ b/tests/fixtures/configs/config-06.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = yes +languages = +django-version = stable +cms-version = stable +parent-dir = . +bootstrap = no +templates = no +starting-page = no +list-plugins = false +dump-requirements = false +no-input = false +filer = false +requirements = +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-07.ini b/tests/fixtures/configs/config-07.ini new file mode 100644 index 0000000..bcb2053 --- /dev/null +++ b/tests/fixtures/configs/config-07.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = +django-version = stable +cms-version = stable +parent-dir = . +bootstrap = no +templates = no +starting-page = no +list-plugins = false +dump-requirements = false +no-input = false +filer = false +requirements = +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-08.ini b/tests/fixtures/configs/config-08.ini new file mode 100644 index 0000000..3883800 --- /dev/null +++ b/tests/fixtures/configs/config-08.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = stable +cms-version = stable +parent-dir = . +bootstrap = no +templates = no +starting-page = no +list-plugins = false +dump-requirements = false +no-input = false +filer = false +requirements = +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-09.ini b/tests/fixtures/configs/config-09.ini new file mode 100644 index 0000000..ec6d37d --- /dev/null +++ b/tests/fixtures/configs/config-09.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = 1.8 +cms-version = stable +parent-dir = . +bootstrap = no +templates = no +starting-page = no +list-plugins = false +dump-requirements = false +no-input = false +filer = false +requirements = +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-10.ini b/tests/fixtures/configs/config-10.ini new file mode 100644 index 0000000..b4f5b8c --- /dev/null +++ b/tests/fixtures/configs/config-10.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = 1.8 +cms-version = 3.1 +parent-dir = . +bootstrap = no +templates = no +starting-page = no +list-plugins = false +dump-requirements = false +no-input = false +filer = false +requirements = +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-11.ini b/tests/fixtures/configs/config-11.ini new file mode 100644 index 0000000..b8ea73a --- /dev/null +++ b/tests/fixtures/configs/config-11.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = 1.8 +cms-version = 3.1 +parent-dir = /test/me +bootstrap = no +templates = no +starting-page = no +list-plugins = false +dump-requirements = false +no-input = false +filer = false +requirements = +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-12.ini b/tests/fixtures/configs/config-12.ini new file mode 100644 index 0000000..e0c9af5 --- /dev/null +++ b/tests/fixtures/configs/config-12.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = 1.8 +cms-version = 3.1 +parent-dir = /test/me +bootstrap = yes +templates = no +starting-page = no +list-plugins = false +dump-requirements = false +no-input = false +filer = false +requirements = +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-13.ini b/tests/fixtures/configs/config-13.ini new file mode 100644 index 0000000..7814010 --- /dev/null +++ b/tests/fixtures/configs/config-13.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = 1.8 +cms-version = 3.1 +parent-dir = /test/me +bootstrap = yes +templates = . +starting-page = no +list-plugins = false +dump-requirements = false +no-input = false +filer = false +requirements = +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-14.ini b/tests/fixtures/configs/config-14.ini new file mode 100644 index 0000000..d0b80a6 --- /dev/null +++ b/tests/fixtures/configs/config-14.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = 1.8 +cms-version = 3.1 +parent-dir = /test/me +bootstrap = yes +templates = . +starting-page = yes +list-plugins = false +dump-requirements = false +no-input = false +filer = false +requirements = +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-15.ini b/tests/fixtures/configs/config-15.ini new file mode 100644 index 0000000..37bf9e4 --- /dev/null +++ b/tests/fixtures/configs/config-15.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = 1.8 +cms-version = 3.1 +parent-dir = /test/me +bootstrap = yes +templates = . +starting-page = yes +list-plugins = true +dump-requirements = false +no-input = false +filer = false +requirements = +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-16.ini b/tests/fixtures/configs/config-16.ini new file mode 100644 index 0000000..4a42c9c --- /dev/null +++ b/tests/fixtures/configs/config-16.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = 1.8 +cms-version = 3.1 +parent-dir = /test/me +bootstrap = yes +templates = . +starting-page = yes +list-plugins = true +dump-requirements = true +no-input = false +filer = false +requirements = +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-17.ini b/tests/fixtures/configs/config-17.ini new file mode 100644 index 0000000..75e1181 --- /dev/null +++ b/tests/fixtures/configs/config-17.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = 1.8 +cms-version = 3.1 +parent-dir = /test/me +bootstrap = yes +templates = . +starting-page = yes +list-plugins = true +dump-requirements = true +no-input = true +filer = false +requirements = +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-18.ini b/tests/fixtures/configs/config-18.ini new file mode 100644 index 0000000..3d1c250 --- /dev/null +++ b/tests/fixtures/configs/config-18.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = 1.8 +cms-version = 3.1 +parent-dir = /test/me +bootstrap = yes +templates = . +starting-page = yes +list-plugins = true +dump-requirements = true +no-input = true +filer = true +requirements = +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-19.ini b/tests/fixtures/configs/config-19.ini new file mode 100644 index 0000000..2525b25 --- /dev/null +++ b/tests/fixtures/configs/config-19.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = 1.8 +cms-version = 3.1 +parent-dir = /test/me +bootstrap = yes +templates = . +starting-page = yes +list-plugins = true +dump-requirements = true +no-input = true +filer = true +requirements = /test/reqs +no-deps = false +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-20.ini b/tests/fixtures/configs/config-20.ini new file mode 100644 index 0000000..8730890 --- /dev/null +++ b/tests/fixtures/configs/config-20.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = 1.8 +cms-version = 3.1 +parent-dir = /test/me +bootstrap = yes +templates = . +starting-page = yes +list-plugins = true +dump-requirements = true +no-input = true +filer = true +requirements = /test/reqs +no-deps = true +no-db-driver = false +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-21.ini b/tests/fixtures/configs/config-21.ini new file mode 100644 index 0000000..c8a8f1d --- /dev/null +++ b/tests/fixtures/configs/config-21.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = 1.8 +cms-version = 3.1 +parent-dir = /test/me +bootstrap = yes +templates = . +starting-page = yes +list-plugins = true +dump-requirements = true +no-input = true +filer = true +requirements = /test/reqs +no-deps = true +no-db-driver = true +no-sync = false +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-22.ini b/tests/fixtures/configs/config-22.ini new file mode 100644 index 0000000..14564c3 --- /dev/null +++ b/tests/fixtures/configs/config-22.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = 1.8 +cms-version = 3.1 +parent-dir = /test/me +bootstrap = yes +templates = . +starting-page = yes +list-plugins = true +dump-requirements = true +no-input = true +filer = true +requirements = /test/reqs +no-deps = true +no-db-driver = true +no-sync = true +no-user = false +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-23.ini b/tests/fixtures/configs/config-23.ini new file mode 100644 index 0000000..da87be5 --- /dev/null +++ b/tests/fixtures/configs/config-23.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = 1.8 +cms-version = 3.1 +parent-dir = /test/me +bootstrap = yes +templates = . +starting-page = yes +list-plugins = true +dump-requirements = true +no-input = true +filer = true +requirements = /test/reqs +no-deps = true +no-db-driver = true +no-sync = true +no-user = true +template = +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-24.ini b/tests/fixtures/configs/config-24.ini new file mode 100644 index 0000000..b222ee8 --- /dev/null +++ b/tests/fixtures/configs/config-24.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = 1.8 +cms-version = 3.1 +parent-dir = /test/me +bootstrap = yes +templates = . +starting-page = yes +list-plugins = true +dump-requirements = true +no-input = true +filer = true +requirements = /test/reqs +no-deps = true +no-db-driver = true +no-sync = true +no-user = true +template = /test/template +extra-settings = +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-25.ini b/tests/fixtures/configs/config-25.ini new file mode 100644 index 0000000..23858a2 --- /dev/null +++ b/tests/fixtures/configs/config-25.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = 1.8 +cms-version = 3.1 +parent-dir = /test/me +bootstrap = yes +templates = . +starting-page = yes +list-plugins = true +dump-requirements = true +no-input = true +filer = true +requirements = /test/reqs +no-deps = true +no-db-driver = true +no-sync = true +no-user = true +template = /test/template +extra-settings = /test/extra_settings +skip-empty-check = false +utc = false diff --git a/tests/fixtures/configs/config-26.ini b/tests/fixtures/configs/config-26.ini new file mode 100644 index 0000000..7f53ea2 --- /dev/null +++ b/tests/fixtures/configs/config-26.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = 1.8 +cms-version = 3.1 +parent-dir = /test/me +bootstrap = yes +templates = . +starting-page = yes +list-plugins = true +dump-requirements = true +no-input = true +filer = true +requirements = /test/reqs +no-deps = true +no-db-driver = true +no-sync = true +no-user = true +template = /test/template +extra-settings = /test/extra_settings +skip-empty-check = true +utc = false diff --git a/tests/fixtures/configs/config-27.ini b/tests/fixtures/configs/config-27.ini new file mode 100644 index 0000000..9ae3517 --- /dev/null +++ b/tests/fixtures/configs/config-27.ini @@ -0,0 +1,27 @@ +[djangocms_installer] +db = postgres://user:pwd@host:54321/dbname +i18n = no +use-tz = no +timezone = Europe/London +reversion = no +permissions = no +languages = en,ru +django-version = 1.8 +cms-version = 3.1 +parent-dir = /test/me +bootstrap = yes +templates = . +starting-page = yes +list-plugins = true +dump-requirements = true +no-input = true +filer = true +requirements = /test/reqs +no-deps = true +no-db-driver = true +no-sync = true +no-user = true +template = /test/template +extra-settings = /test/extra_settings +skip-empty-check = true +utc = true diff --git a/tox.ini b/tox.ini index f5f13e9..11c986e 100644 --- a/tox.ini +++ b/tox.ini @@ -7,14 +7,8 @@ passenv = LANG recreate = True commands = {env:COMMAND:python} setup.py test deps = - -r{toxinidir}/requirements.txt - pillow - coverage + -r{toxinidir}/requirements-test.txt py26: unittest2 - py26: mock<1.1 - py27: mock - py33: mock - py34: mock [testenv:coverage] commands =