Skip to content

Commit

Permalink
Enable django 3.0 (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Apr 22, 2020
1 parent 60a173f commit 7cff153
Show file tree
Hide file tree
Showing 12 changed files with 183 additions and 90 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ language: python
dist: xenial

python:
- 3.8
- 3.7
- 3.6
- 3.5
Expand Down Expand Up @@ -32,6 +33,7 @@ install:
- "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 [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then export TOX_ENV=py37; fi"
- "if [[ $TRAVIS_PYTHON_VERSION == '3.8' ]]; then export TOX_ENV=py38; fi"
- "if [[ $TEST != '1' ]]; then export TOX_ENV=$TEST; fi"

# command to run tests, e.g. python setup.py test
Expand Down Expand Up @@ -61,6 +63,12 @@ matrix:
env: TEST='isort'
- python: 3.6
env: TEST='docs'
- python: 3.7
env: TEST='pep8'
- python: 3.7
env: TEST='isort'
- python: 3.7
env: TEST='docs'

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

* Nothing yet

1.2.2 (unreleased)
++++++++++++++++++

* Added support for Django 3.0

1.2.1 (2019-12-27)
++++++++++++++++++

Expand Down
14 changes: 7 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ Supported versions

The current supported version matrix is the following:

+----------------+-------------+-------------+---------------+--------------+
| | Django 1.11 | Django 2.0 | Django 2.1 | Django 2.2 |
+----------------+-------------+-------------+---------------+--------------+
| django CMS 3.6 | Supported | Supported | Supported | Supported |
+----------------+-------------+-------------+---------------+--------------+
| django CMS 3.7 | Supported | Supported | Supported | Supported |
+----------------+-------------+-------------+---------------+--------------+
+----------------+-------------+-------------+---------------+--------------+--------------+
| | Django 1.11 | Django 2.0 | Django 2.1 | Django 2.2 | Django 3.0 |
+----------------+-------------+-------------+---------------+--------------+--------------+
| django CMS 3.6 | Supported | Supported | Supported | Supported | Supported |
+----------------+-------------+-------------+---------------+--------------+--------------+
| django CMS 3.7 | Supported | Supported | Supported | Supported | Supported |
+----------------+-------------+-------------+---------------+--------------+--------------+

See `version 1.1`_ for older Django / django CMS versions support

Expand Down
1 change: 1 addition & 0 deletions djangocms_installer/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ def parse(args):
except RuntimeError as e: # pragma: no cover
sys.stderr.write(compat.unicode(e))
sys.exit(6)

if django_version is None: # pragma: no cover
sys.stderr.write(
'Please provide a Django supported version: {0}. Only Major.Minor '
Expand Down
72 changes: 44 additions & 28 deletions djangocms_installer/config/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@
'--permissions', '--bootstrap', '--templates',
'--starting-page']

DJANGOCMS_DEVELOP = 'https://github.com/divio/django-cms/archive/develop.zip?{bust}'.format(
DJANGOCMS_DEVELOP = 'https://github.com/yakky/django-cms/archive/develop.zip?{bust}'.format(
**bust
)
DJANGOCMS_RC = 'https://github.com/divio/django-cms/archive/release/3.7.x.zip?{bust}'.format(
**bust
)
DJANGOCMS_BETA = DJANGOCMS_RC
DJANGOCMS_36 = 'django-cms>=3.6,<3.7'
DJANGOCMS_37 = 'django-cms>=3.7,<3.8'

if sys.version_info > (3, 0):
DJANGOCMS_37 = 'django-cms>=3.7,<3.8'
else:
DJANGOCMS_37 = 'django-cms>=3.7,<3.7.2'

if sys.version_info >= (3, 5):
DJANGOCMS_SUPPORTED = ('3.6', '3.7', 'stable', 'lts', 'develop', 'rc')
Expand All @@ -33,7 +37,11 @@

DJANGO_DEVELOP = 'https://github.com/django/django/archive/master.zip?{bust}'.format(**bust)
DJANGO_BETA = 'https://github.com/django/django/archive/master.zip?{bust}'.format(**bust)
if sys.version_info >= (3, 5):
if sys.version_info >= (3, 6):
DJANGO_SUPPORTED = ('1.11', '2.0', '2.1', '2.2', '3.0', 'stable', 'lts')
DJANGO_STABLE = '3.0'
DJANGO_LTS = '2.2'
elif (3, 6) > sys.version_info >= (3, 5):
DJANGO_SUPPORTED = ('1.11', '2.0', '2.1', '2.2', 'stable', 'lts')
DJANGO_STABLE = '2.2'
DJANGO_LTS = '2.2'
Expand All @@ -53,16 +61,16 @@
DJANGO_VERSION_MATRIX = {
'stable': DJANGO_STABLE,
'lts': DJANGO_LTS,
'rc': '2.2',
'beta': '2.2',
'develop': '2.2'
'rc': DJANGO_STABLE,
'beta': DJANGO_STABLE,
'develop': DJANGO_STABLE
}
VERSION_MATRIX = {
'3.6': ('1.11', '2.1'),
'3.7': ('1.11', '2.2'),
DJANGOCMS_BETA: ('1.11', '2.2'),
DJANGOCMS_RC: ('1.11', '2.2'),
DJANGOCMS_DEVELOP: ('1.11', '2.2'),
'3.7': ('1.11', '3.0'),
DJANGOCMS_BETA: ('1.11', '3.0'),
DJANGOCMS_RC: ('1.11', '3.0'),
DJANGOCMS_DEVELOP: ('1.11', '2.2', '3.0'),
}
PACKAGE_MATRIX = {
'3.6': DJANGOCMS_36,
Expand Down Expand Up @@ -100,6 +108,11 @@
'django-sekizai>=1.0',
'django-mptt>0.9',
],
'django-3.0': [
'django-classy-tags>=0.9',
'django-sekizai>=1.0',
'django-mptt>0.9',
],
'reversion-django-1.11': [
'django-reversion>=2.0,<2.1',
],
Expand All @@ -116,32 +129,35 @@
'django-treebeard>=4.0,<5.0',
],
'plugins-3.6': [
'djangocms-text-ckeditor>=3.7,<3.9',
'djangocms-link>=2.3,<2.6',
'djangocms-style>=2.2,<2.3',
'djangocms-googlemap>=1.3,<1.4',
'djangocms-snippet>=2.1,<2.3',
'djangocms-video>=2.1,<2.3',
'djangocms-file>=2.2,<3.0',
'djangocms-picture>=2.3,<2.4',
'djangocms-bootstrap4>=1.5,<1.6',
'djangocms-text-ckeditor>=3.7,<4.0',
'djangocms-link>=2.5,<2.7',
'djangocms-icon>=1.4,<1.6',
'djangocms-style>=2.2,<2.4',
'djangocms-googlemap>=1.3,<1.5',
'djangocms-snippet>=2.2,<2.4',
'djangocms-video>=2.1,<2.4',
'djangocms-file>=2.3,<2.5',
'djangocms-picture>=2.3,<2.5',
'djangocms-bootstrap4>=1.5,<1.7',
],
'plugins-3.7': [
'djangocms-text-ckeditor>=3.7,<3.9',
'djangocms-link>=2.5,<2.6',
'djangocms-style>=2.2,<2.3',
'djangocms-googlemap>=1.3,<1.4',
'djangocms-snippet>=2.2,<2.3',
'djangocms-video>=2.1,<2.3',
'djangocms-file>=2.3,<3.0',
'djangocms-picture>=2.3,<2.4',
'djangocms-bootstrap4>=1.5,<1.6',
'djangocms-text-ckeditor>=3.7,<4.0',
'djangocms-link>=2.5,<2.7',
'djangocms-icon>=1.4,<1.6',
'djangocms-style>=2.2,<2.4',
'djangocms-googlemap>=1.3,<1.5',
'djangocms-snippet>=2.2,<2.4',
'djangocms-video>=2.1,<2.4',
'djangocms-file>=2.3,<2.5',
'djangocms-picture>=2.3,<2.5',
'djangocms-bootstrap4>=1.5,<1.7',
],
'plugins-master': [
'https://github.com/divio/djangocms-text-ckeditor/archive/master.zip?{bust}'
''.format(**bust),
'https://github.com/divio/djangocms-file/archive/master.zip?{bust}'.format(**bust),
'https://github.com/divio/djangocms-link/archive/master.zip?{bust}'.format(**bust),
'https://github.com/divio/djangocms-icon/archive/master.zip?{bust}'.format(**bust),
'https://github.com/divio/djangocms-style/archive/master.zip?{bust}'.format(**bust),
'https://github.com/divio/djangocms-googlemap/archive/master.zip?{bust}'.format(**bust),
'https://github.com/divio/djangocms-snippet/archive/master.zip?{bust}'.format(**bust),
Expand Down
2 changes: 1 addition & 1 deletion djangocms_installer/install/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def check_install(config_data):


def requirements(req_file, pip_options='', is_file=False, verbose=False):
args = ['install']
args = ['install', '--disable-pip-version-check']
if not verbose:
args.append('-q')
if pip_options:
Expand Down
2 changes: 1 addition & 1 deletion djangocms_installer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def supported_versions(django, cms):
cms_version and django_version and
not (LooseVersion(VERSION_MATRIX[compat.unicode(cms_version)][0]) <=
LooseVersion(compat.unicode(django_version)) <=
LooseVersion(VERSION_MATRIX[compat.unicode(cms_version)][1]))
LooseVersion(VERSION_MATRIX[compat.unicode(cms_version)][-1]))
):
raise RuntimeError(
'Django and django CMS versions doesn\'t match: '
Expand Down
32 changes: 25 additions & 7 deletions tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,23 +117,41 @@ def setUp(self):

def get_latest_django(latest_stable=False, latest_1_x=False):
"""
Get latest django version compatible with all the supported django CMS versions.
Get latest django version compatible with all the supported django CMS and python versions.
Takes into account arguments and python version.
"""
if latest_1_x:
dj_ver = '1.11'
match = 'Django<2.0'
elif sys.version_info < (3, 4) and not latest_stable:
dj_ver = '1.11'
match = 'Django<2.0'
elif sys.version_info < (3, 4) and latest_stable:
elif sys.version_info < (3, 4):
dj_ver = '1.11'
match = 'Django<2.0'
elif sys.version_info < (3, 5):
dj_ver = '2.0'
match = 'Django<2.1'
elif sys.version_info < (3, 6):
dj_ver = '2.2'
match = 'Django<2.3'
else:
dj_ver = '3.0'
match = 'Django<3.1'
return dj_ver, match


def get_latest_djangocms(latest_1_x=False):
"""
Get latest django CMS version compatible with all the supported django and python versions.
Takes into account arguments and python version.
"""
if latest_1_x:
dj_ver = '3.7'
match = 'django-cms<3.8'
elif sys.version_info < (3, 5):
dj_ver = '3.7'
match = 'django-cms<3.8'
else:
dj_ver = '2.1'
match = 'Django<2.2'
dj_ver = '3.7'
match = 'django-cms<3.8'
return dj_ver, match
35 changes: 19 additions & 16 deletions tests/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

from .base import BaseTestClass, get_latest_django, unittest

latest_stable_django, latest_stable_django_match = get_latest_django()


class TestConfig(BaseTestClass):

Expand All @@ -32,7 +34,7 @@ def test_default_config(self):
self.assertEqual(conf_data.project_name, 'example_prj')

self.assertEqual(conf_data.cms_version, '3.7')
self.assertEqual(conf_data.django_version, '2.2')
self.assertEqual(conf_data.django_version, latest_stable_django)
self.assertEqual(conf_data.i18n, 'yes')
self.assertEqual(conf_data.reversion, 'yes')
self.assertEqual(conf_data.permissions, 'no')
Expand Down Expand Up @@ -401,11 +403,11 @@ def test_latest_version(self):
@unittest.skipIf(sys.version_info[0] < 3,
reason='django 2+ only supports python 3')
def test_supported_versions(self):
self.assertEqual(supported_versions('stable', 'stable'), ('2.2', '3.7'))
self.assertEqual(supported_versions('stable', '3.1.10'), ('2.2', None))
self.assertEqual(supported_versions('stable', 'rc'), ('2.2', DJANGOCMS_RC))
self.assertEqual(supported_versions('stable', 'beta'), ('2.2', DJANGOCMS_BETA))
self.assertEqual(supported_versions('stable', 'develop'), ('2.2', DJANGOCMS_DEVELOP))
self.assertEqual(supported_versions('stable', 'stable'), (latest_stable_django, '3.7'))
self.assertEqual(supported_versions('stable', '3.1.10'), (latest_stable_django, None))
self.assertEqual(supported_versions('stable', 'rc'), (latest_stable_django, DJANGOCMS_RC))
self.assertEqual(supported_versions('stable', 'beta'), (latest_stable_django, DJANGOCMS_BETA))
self.assertEqual(supported_versions('stable', 'develop'), (latest_stable_django, DJANGOCMS_DEVELOP))
self.assertEqual(supported_versions('lts', 'rc'), ('2.2', DJANGOCMS_RC))
self.assertEqual(supported_versions('lts', 'lts'), ('2.2', '3.7'))

Expand Down Expand Up @@ -464,7 +466,7 @@ def test_requirements(self):
self.assertTrue(conf_data.requirements.find(config.data.DJANGOCMS_37) > -1)
self.assertTrue(conf_data.requirements.find('Django<2.0') > -1)
self.assertFalse(conf_data.requirements.find('django-reversion') > -1)
self.assertTrue(conf_data.requirements.find('djangocms-text-ckeditor>=3.7,<3.9') > -1)
self.assertTrue(conf_data.requirements.find('djangocms-text-ckeditor>=3.7,<4.0') > -1)
self.assertTrue(conf_data.requirements.find('djangocms-admin-style>=1.4') > -1)
self.assertTrue(conf_data.requirements.find('django-filer') > -1)
self.assertTrue(conf_data.requirements.find('cmsplugin-filer') == -1)
Expand All @@ -483,11 +485,11 @@ def test_requirements(self):
'example_prj'])

self.assertTrue(conf_data.requirements.find(config.data.DJANGOCMS_37) > -1)
self.assertTrue(conf_data.requirements.find('Django<2.3') > -1)
self.assertTrue(conf_data.requirements.find(latest_stable_django_match) > -1)
self.assertFalse(conf_data.requirements.find('django-reversion') > -1)
self.assertTrue(conf_data.requirements.find('cmsplugin-filer') == -1)
self.assertTrue(conf_data.requirements.find('djangocms-admin-style') > -1)
self.assertTrue(conf_data.requirements.find('djangocms-text-ckeditor>=3.7,<3.9') > -1)
self.assertTrue(conf_data.requirements.find('djangocms-text-ckeditor>=3.7,<4.0') > -1)
self.assertTrue(conf_data.requirements.find('djangocms-bootstrap4') > -1)
self.assertTrue(conf_data.requirements.find('djangocms-file') > -1)
self.assertTrue(conf_data.requirements.find('djangocms-flash') == -1)
Expand Down Expand Up @@ -576,7 +578,7 @@ def test_requirements(self):
'example_prj'])

self.assertTrue(conf_data.requirements.find(config.data.DJANGOCMS_DEVELOP) > -1)
self.assertTrue(conf_data.requirements.find('Django<2.3') > -1)
self.assertTrue(conf_data.requirements.find(latest_stable_django_match) > -1)
self.assertFalse(conf_data.requirements.find('django-reversion') > -1)
self.assertTrue(conf_data.requirements.find('https://github.com/divio/djangocms-link') > -1)
self.assertTrue(conf_data.requirements.find('https://github.com/divio/djangocms-style') > -1)
Expand All @@ -601,9 +603,9 @@ def test_requirements(self):
'example_prj'])

self.assertTrue(conf_data.requirements.find(config.data.DJANGOCMS_37) > -1)
self.assertTrue(conf_data.requirements.find('Django<2.3') > -1)
self.assertTrue(conf_data.requirements.find(latest_stable_django_match) > -1)
self.assertFalse(conf_data.requirements.find('django-reversion') > -1)
self.assertTrue(conf_data.requirements.find('djangocms-text-ckeditor>=3.7,<3.9') > -1)
self.assertTrue(conf_data.requirements.find('djangocms-text-ckeditor>=3.7') > -1)
self.assertTrue(conf_data.requirements.find('djangocms-admin-style') > -1)
self.assertTrue(conf_data.requirements.find('pytz') > -1)

Expand All @@ -622,7 +624,7 @@ def test_requirements(self):
self.assertTrue(conf_data.requirements.find(config.data.DJANGOCMS_37) > -1)
self.assertTrue(conf_data.requirements.find('Django<2.3') > -1)
self.assertFalse(conf_data.requirements.find('django-reversion') > -1)
self.assertTrue(conf_data.requirements.find('djangocms-text-ckeditor>=3.7,<3.9') > -1)
self.assertTrue(conf_data.requirements.find('djangocms-text-ckeditor>=3.7') > -1)
self.assertTrue(conf_data.requirements.find('djangocms-admin-style') > -1)
self.assertTrue(conf_data.requirements.find('pytz') > -1)

Expand Down Expand Up @@ -736,8 +738,9 @@ def test_requirements(self):
'-p'+self.project_dir,
'example_prj'])

self.assertTrue(conf_data.requirements.find(config.data.DJANGOCMS_37) > -1)
self.assertTrue(conf_data.requirements.find('Django<2.3') > -1)
self.assertTrue(conf_data.requirements.find(config.data.DJANGOCMS_37)
> -1)
self.assertTrue(conf_data.requirements.find(latest_stable_django_match) > -1)

def test_bootstrap(self):
"""
Expand Down Expand Up @@ -987,7 +990,7 @@ def test_parse_config_file(self, *args):
('config-03.ini', None, (
('cms_version', '3.7'),
('i18n', 'no'),
('django_version', '2.2'),
('django_version', latest_stable_django),
)),
('config-04.ini', None, (('cms_version', '3.7'), ('use_timezone', 'no'))),
('config-05.ini', None, (('cms_version', '3.7'), ('timezone', 'Europe/London'))),
Expand Down

0 comments on commit 7cff153

Please sign in to comment.