Skip to content

Commit

Permalink
Merge branch 'release/0.9.x' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Jul 15, 2017
2 parents 2e03f3c + 66db300 commit b14c155
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 50 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ language: python
sudo: false

python:
- 3.6
- 3.5
- 3.4
- 3.3
Expand All @@ -31,6 +32,7 @@ install:
- "if [[ $TRAVIS_PYTHON_VERSION == '3.3' ]]; then export TOX_ENV=py33; fi"
- "if [[ $TRAVIS_PYTHON_VERSION == '3.4' ]]; then export TOX_ENV=py34; fi"
- "if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then export TOX_ENV=py35; fi"
- "if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then export TOX_ENV=py36; fi"
- "if [[ $TEST != '1' ]]; then export TOX_ENV=$TEST; fi"

# command to run tests, e.g. python setup.py test
Expand Down Expand Up @@ -62,6 +64,12 @@ matrix:
env: TEST='isort'
- python: 3.4
env: TEST='docs'
- python: 3.5
env: TEST='pep8'
- python: 3.5
env: TEST='isort'
- python: 3.5
env: TEST='docs'

notifications:
webhooks: https://ring.nephila.it/packages/hook/
16 changes: 16 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@ History

* Dropped cmsplugin-filer in favor of core plugins which now use filer

0.9.7 (2017-07-15)
++++++++++++++++++

* Improve django-admin invocation to support more python environments layouts

0.9.6 (2017-03-12)
++++++++++++++++++

* Added more Django 1.10 fixes / cleanups
* Added python 3.6 compatibility

0.9.5 (2017-02-16)
++++++++++++++++++

* Added more Django 1.10 fixes / cleanups

0.9.4 (2017-01-03)
++++++++++++++++++

Expand Down
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ Warning
-------

``djangocms-installer`` assumes that ``django-admin.py`` is installed in the same directory
as python executable, which is the standard virtualenv layout.
as python executable, which is the standard virtualenv layout. Other installation layouts
might work, but are not officially supported.


Windows support
Expand Down
2 changes: 1 addition & 1 deletion djangocms_installer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
__author__ = 'Iacopo Spalletti'
__email__ = 'i.spalletti@nephila.it'
__version__ = '1.0.dev1'
__version__ = '1.0.0.dev2'
1 change: 0 additions & 1 deletion djangocms_installer/config/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
'html5lib>=0.999999,<0.99999999',
'Pillow>=3.0',
'django-sekizai>=0.9',
'django-select2<5.0'
'six',
],
'django-1.8': [
Expand Down
14 changes: 7 additions & 7 deletions djangocms_installer/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
TEMPLATE_CONTEXT_PROCESSORS = [
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.i18n',
'django.core.context_processors.debug',
'django.core.context_processors.request',
'django.core.context_processors.media',
'django.core.context_processors.csrf',
'django.core.context_processors.tz',
'django.template.context_processors.i18n',
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.template.context_processors.media',
'django.template.context_processors.csrf',
'django.template.context_processors.tz',
'sekizai.context_processors.sekizai',
'django.core.context_processors.static',
'django.template.context_processors.static',
]

TEMPLATE_CONTEXT_PROCESSORS_3 = [
Expand Down
9 changes: 5 additions & 4 deletions djangocms_installer/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,25 @@
from django.conf.urls import include, url
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.contrib.sitemaps.views import sitemap
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.views.static import serve

admin.autodiscover()

urlpatterns = [
url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap',
url(r'^sitemap\.xml$', sitemap,
{'sitemaps': {'cmspages': CMSSitemap}}),
url(r'^select2/', include('django_select2.urls')),
]

urlpatterns += i18n_patterns('',
urlpatterns += i18n_patterns(
url(r'^admin/', include(admin.site.urls)), # NOQA
url(r'^', include('cms.urls')),
)

# This is only needed when using runserver.
if settings.DEBUG:
urlpatterns = [
url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
url(r'^media/(?P<path>.*)$', serve,
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
] + staticfiles_urlpatterns() + urlpatterns
38 changes: 23 additions & 15 deletions djangocms_installer/django/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,22 @@ def create_project(config_data):
args.append(config_data.project_directory)
if not os.path.exists(config_data.project_directory):
os.makedirs(config_data.project_directory)
start_cmd = os.path.join(os.path.dirname(sys.executable), 'django-admin.py')
start_cmds = [start_cmd]
base_cmd = 'django-admin.py'
start_cmds = [os.path.join(os.path.dirname(sys.executable), base_cmd)]
start_cmd_pnodes = ['Scripts']
start_cmds.extend([
os.path.join(os.path.dirname(sys.executable), pnode, 'django-admin.py')
os.path.join(os.path.dirname(sys.executable), pnode, base_cmd)
for pnode in start_cmd_pnodes
])
start_cmd = [base_cmd]
for p in start_cmds:
if os.path.exists(p):
start_cmd = p
start_cmd = [sys.executable, p]
break
cmd_args = ' '.join([sys.executable, start_cmd, 'startproject'] + args)
cmd_args = start_cmd + ['startproject'] + args
if config_data.verbose:
sys.stdout.write('Project creation command: {0}\n'.format(cmd_args))
output = subprocess.check_output(cmd_args, shell=True)
sys.stdout.write('Project creation command: {0}\n'.format(' '.join(cmd_args)))
output = subprocess.check_output(cmd_args)
sys.stdout.write(output.decode('utf-8'))


Expand Down Expand Up @@ -160,8 +161,8 @@ def patch_settings(config_data):
:param config_data: configuration data
"""
overridden_settings = (
'MIDDLEWARE_CLASSES', 'INSTALLED_APPS', 'TEMPLATE_LOADERS', 'TEMPLATE_CONTEXT_PROCESSORS',
'TEMPLATE_DIRS', 'LANGUAGES'
'MIDDLEWARE_CLASSES', 'MIDDLEWARE', 'INSTALLED_APPS', 'TEMPLATE_LOADERS',
'TEMPLATE_CONTEXT_PROCESSORS', 'TEMPLATE_DIRS', 'LANGUAGES'
)
extra_settings = ''

Expand Down Expand Up @@ -260,14 +261,21 @@ def _build_settings(config_data):

processors = vars.TEMPLATE_CONTEXT_PROCESSORS + vars.TEMPLATE_CONTEXT_PROCESSORS_3
text.append(data.TEMPLATES_1_8.format(
loaders=(',\n' + spacer).join(['\'{0}\''.format(var) for var in vars.TEMPLATE_LOADERS]),
processors=(',\n' + spacer).join(['\'{0}\''.format(var) for var in processors]),
dirs='os.path.join(BASE_DIR, \'{0}\', \'templates\'),'.format(config_data.project_name)
loaders=(',\n' + spacer * 4).join(["'{0}'".format(var) for var in vars.TEMPLATE_LOADERS]),
processors=(',\n' + spacer * 4).join(["'{0}'".format(var) for var in processors]),
dirs="os.path.join(BASE_DIR, '{0}', 'templates'),".format(config_data.project_name)
))

text.append('MIDDLEWARE_CLASSES = (\n{0}{1}\n)'.format(
spacer, (',\n' + spacer).join(['\'{0}\''.format(var) for var in vars.MIDDLEWARE_CLASSES])
))
if LooseVersion(config_data.django_version) >= LooseVersion('1.10'):
text.append('MIDDLEWARE = (\n{0}{1}\n)'.format(
spacer, (',\n' + spacer).join(['\'{0}\''.format(var)
for var in vars.MIDDLEWARE_CLASSES])
))
else:
text.append('MIDDLEWARE_CLASSES = (\n{0}{1}\n)'.format(
spacer, (',\n' + spacer).join(["'{0}'".format(var)
for var in vars.MIDDLEWARE_CLASSES])
))

apps = list(vars.INSTALLED_APPS)
apps = list(vars.CMS_3_HEAD) + apps
Expand Down
1 change: 0 additions & 1 deletion djangocms_installer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import os
import sys

from decimal import Decimal, InvalidOperation
from distutils.version import LooseVersion

Expand Down
68 changes: 49 additions & 19 deletions tests/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,44 @@ def test_copy_data(self):
# self.assertTrue(os.path.exists(static_js))
# self.assertTrue(os.path.exists(aldryn_template))

@unittest.skipIf(sys.version_info[:2] not in ((2, 7), (3, 4), (3, 5),),
reason='django 1.9 only supports python 2.7, 3.4 and 3.5')
@unittest.skipIf(sys.version_info[:2] not in ((2, 7), (3, 4), (3, 5), (3, 6),),
reason='django 1.10 only supports python 2.7, 3.4, 3.5 and 3.6')
def test_patch_110_settings(self):
extra_path = os.path.join(os.path.dirname(__file__), 'data', 'extra_settings.py')
config_data = config.parse(['--db=sqlite://localhost/test.db',
'--lang=en', '--extra-settings=%s' % extra_path,
'--django-version=1.10',
'--cms-version=3.4', '--timezone=Europe/Moscow',
'-q', '-u', '-zno', '--i18n=no',
'-p' + self.project_dir, 'example_path_110_settings'])
install.requirements(config_data.requirements)
django.create_project(config_data)
django.patch_settings(config_data)
django.copy_files(config_data)
# settings is importable even in non django environment
sys.path.append(config_data.project_directory)

project = __import__(config_data.project_name, globals(), locals(), [str('settings')])

# checking for django options
self.assertEqual(project.settings.MEDIA_ROOT,
os.path.join(config_data.project_directory, 'media'))
self.assertEqual(project.settings.MEDIA_URL, '/media/')

# Data from external settings files
self.assertIsNotNone(getattr(project.settings, 'MIDDLEWARE', None))
self.assertIsNone(getattr(project.settings, 'MIDDLEWARE_CLASSES', None))

@unittest.skipIf(sys.version_info[:2] not in ((2, 7), (3, 4), (3, 5), (3, 6),),
reason='django 1.9 only supports python 2.7, 3.4, 3.5 and 3.6')
def test_patch_19_32_settings(self):
extra_path = os.path.join(os.path.dirname(__file__), 'data', 'extra_settings.py')
config_data = config.parse(['--db=sqlite://localhost/test.db',
'--lang=en', '--extra-settings=%s' % extra_path,
'--django-version=1.9',
'--cms-version=3.2', '--timezone=Europe/Moscow',
'-q', '-u', '-zno', '--i18n=no',
'-p' + self.project_dir, 'example_path_16_settigns'])
'-p' + self.project_dir, 'example_path_19_settings'])
install.requirements(config_data.requirements)
django.create_project(config_data)
django.patch_settings(config_data)
Expand All @@ -146,9 +174,11 @@ def test_patch_19_32_settings(self):
self.assertEqual(project.settings.CUSTOM_SETTINGS_VAR, True)
self.assertEqual(project.settings.CMS_PERMISSION, False)
self.assertEqual(set(project.settings.CMS_TEMPLATES), self.templates_basic)
self.assertIsNone(getattr(project.settings, 'MIDDLEWARE', None))
self.assertIsNotNone(getattr(project.settings, 'MIDDLEWARE_CLASSES', None))

@unittest.skipIf(sys.version_info[:2] not in ((2, 7), (3, 4), (3, 5),),
reason='django 1.9 only supports python 2.7, 3.4 and 3.5')
@unittest.skipIf(sys.version_info[:2] not in ((2, 7), (3, 4), (3, 5), (3, 6),),
reason='django 1.9 only supports python 2.7, 3.4, 3.5 and 3.6')
def test_patch_django_19_32(self):
config_data = config.parse(['--db=sqlite://localhost/test.db',
'--lang=en', '--bootstrap=yes',
Expand Down Expand Up @@ -211,8 +241,8 @@ def test_patch_django_19_32(self):
self.assertEqual(len(re.findall('MEDIA_ROOT =', settings)), 1)
self.assertEqual(len(re.findall('STATICFILES_DIRS', settings)), 1)

@unittest.skipIf(sys.version_info[:2] not in ((2, 7), (3, 3), (3, 4), (3, 5),),
reason='django 1.8 only supports python 2.7, 3.3, 3.4 and 3.5')
@unittest.skipIf(sys.version_info[:2] not in ((2, 7), (3, 3), (3, 4), (3, 5), (3, 6),),
reason='django 1.8 only supports python 2.7, 3.3, 3.4, 3.5 and 3.6')
def test_patch_django_18_32(self):
extra_path = os.path.join(os.path.dirname(__file__), 'data', 'extra_settings.py')
config_data = config.parse(['--db=sqlite://localhost/test.db',
Expand All @@ -235,8 +265,8 @@ def test_patch_django_18_32(self):
self.assertFalse('cms' in project.settings.MIGRATION_MODULES)
self.assertFalse('djangocms_text_ckeditor' in project.settings.MIGRATION_MODULES)

@unittest.skipIf(sys.version_info[:2] not in ((2, 7), (3, 3), (3, 4), (3, 5),),
reason='django 1.8 only supports python 2.7, 3.3, 3.4 and 3.5')
@unittest.skipIf(sys.version_info[:2] not in ((2, 7), (3, 3), (3, 4), (3, 5), (3, 6),),
reason='django 1.8 only supports python 2.7, 3.3, 3.4, 3.5 and 3.6')
def test_patch_django_18_develop(self):
# On django CMS 3.2 the reload apphooks middleware is enabled by default
extra_path = os.path.join(os.path.dirname(__file__), 'data', 'extra_settings.py')
Expand Down Expand Up @@ -267,8 +297,8 @@ def test_patch_django_18_develop(self):
project.settings.MIDDLEWARE_CLASSES
)

@unittest.skipIf(sys.version_info[:2] not in ((2, 7), (3, 4), (3, 5),),
reason='django 1.9 only supports python 2.7, 3.4 and 3.5')
@unittest.skipIf(sys.version_info[:2] not in ((2, 7), (3, 4), (3, 5), (3, 6),),
reason='django 1.9 only supports python 2.7, 3.4, 3.5 and 3.6')
def test_patch_django_19_develop(self):
# On django CMS 3.2 the reload apphooks middleware is enabled by default
extra_path = os.path.join(os.path.dirname(__file__), 'data', 'extra_settings.py')
Expand Down Expand Up @@ -299,8 +329,8 @@ def test_patch_django_19_develop(self):
project.settings.MIDDLEWARE_CLASSES
)

@unittest.skipIf(sys.version_info[:2] not in ((2, 7), (3, 3), (3, 4), (3, 5),),
reason='django 1.8 only supports python 2.7, 3.3, 3.4 and 3.5,')
@unittest.skipIf(sys.version_info[:2] not in ((2, 7), (3, 3), (3, 4), (3, 5), (3, 6),),
reason='django 1.8 only supports python 2.7, 3.3, 3.4, 3.5 and 3.6,')
def test_patch_django_no_plugins(self):
extra_path = os.path.join(os.path.dirname(__file__), 'data', 'extra_settings.py')
config_data = config.parse(['--db=sqlite://localhost/test.db',
Expand Down Expand Up @@ -340,8 +370,8 @@ def test_patch_django_no_plugins(self):
self.assertFalse('cms.plugins.twitter' in project.settings.INSTALLED_APPS)
self.assertFalse('cms.plugins.video' in project.settings.INSTALLED_APPS)

@unittest.skipIf(sys.version_info[:2] not in ((2, 7), (3, 3), (3, 4), (3, 5),),
reason='django 1.8 only supports python 2.7, 3.3, 3.4 and 3.5,')
@unittest.skipIf(sys.version_info[:2] not in ((2, 7), (3, 3), (3, 4), (3, 5), (3, 6),),
reason='django 1.8 only supports python 2.7, 3.3, 3.4, 3.5 and 3.6,')
def test_patch(self):
config_data = config.parse(['--db=sqlite://localhost/test.db',
'--lang=en',
Expand Down Expand Up @@ -426,8 +456,8 @@ def test_patch(self):
del project
del (sys.modules["%s.settings" % config_data.project_name])

@unittest.skipIf(sys.version_info[:2] not in ((2, 7), (3, 3), (3, 4), (3, 5),),
reason='django 1.8 only supports python 2.7, 3.3, 3.4 and 3.5,')
@unittest.skipIf(sys.version_info[:2] not in ((2, 7), (3, 3), (3, 4), (3, 5), (3, 6),),
reason='django 1.8 only supports python 2.7, 3.3, 3.4, 3.5 and 3.6,')
def test_database_setup_filer(self):
config_data = config.parse(['--db=sqlite://localhost/test.db',
'-f', '-q', '-u', '--django-version=1.8',
Expand Down Expand Up @@ -470,8 +500,8 @@ def test_database_setup_filer(self):
self.assertTrue('filer' in row)
self.assertTrue('image' in row)

@unittest.skipIf(sys.version_info[:2] not in ((2, 7), (3, 3), (3, 4), (3, 5),),
reason='django 1.8 only supports python 2.7, 3.3, 3.4 and 3.5,')
@unittest.skipIf(sys.version_info[:2] not in ((2, 7), (3, 3), (3, 4), (3, 5), (3, 6),),
reason='django 1.8 only supports python 2.7, 3.3, 3.4, 3.5 and 3.6,')
def test_starting_page(self):
config_data = config.parse(['--db=sqlite://localhost/test.db',
'-q', '-u', '--django-version=1.8',
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
downloadcache = {toxworkdir}/cache
envlist = pep8,isort,docs,py{27,33,34,35}
envlist = pep8,isort,docs,py{27,33,34,35,36}
passenv = LANG

[testenv]
Expand Down

0 comments on commit b14c155

Please sign in to comment.