Preparation for Django 3.0 and 3.1 support (2)

django-pyscss is not compatible with Django 3.0.
django_pyscss_fix is a temporary workaround for django.utils.six
used in django-pyscss. It also add six in requirements.txt
as we use six module for this workaround.
This is just to run horizon for testing with Django 3.0+.

six is re-added to requirements.txt as it is used in the workaround.
Note that other codes in the horizon repo should not depend on six.

Change-Id: If79289b7518dd8eaf292a90d6fb790beb154cb7c
This commit is contained in:
Akihiro Motoki 2021-02-24 21:02:21 +09:00
parent bbaf21c4df
commit 39f28ad5ed
6 changed files with 40 additions and 2 deletions

View File

@ -0,0 +1,24 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import sys
import django
import six
import six.moves
# Temporary workaround for a situation that django-pyscss depends on
# a vendored version of six, django.utils.six which was dropped in Django 3.0.
# TODO(amotoki): Drop the workaround once django-pyscss supports Django 3.0+.
if django.VERSION[0] >= 3:
sys.modules['django.utils.six'] = six
sys.modules['django.utils.six.moves'] = six.moves

View File

@ -51,6 +51,7 @@ INSTALLED_APPS = (
'django.contrib.humanize',
'django.contrib.auth',
'django.contrib.contenttypes',
'horizon.test.django_pyscss_fix',
'django_pyscss',
'compressor',
'horizon',

View File

@ -110,7 +110,7 @@ Routes==2.3.1
selenium==2.50.1
semantic-version==2.3.1
simplejson==3.5.1
six==1.12.0
six==1.16.0
snowballstemmer==1.2.1
statsd==3.2.1
stevedore==3.3.0

View File

@ -12,9 +12,21 @@
import logging
import os
import sys
import django
import six
import six.moves
from django.conf import settings
# Temporary workaround for a situation that django-pyscss depends on
# a vendored version of six, django.utils.six which was dropped in Django 3.0.
# TODO(amotoki): Drop the workaround once django-pyscss supports Django 3.0+.
if django.VERSION[0] >= 3:
sys.modules['django.utils.six'] = six
sys.modules['django.utils.six.moves'] = six.moves
scss_asset_root = os.path.join(settings.STATIC_ROOT, 'scss', 'assets')
LOG = logging.getLogger(__name__)

View File

@ -151,9 +151,9 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'openstack_dashboard.django_pyscss_fix',
'django_pyscss',
'debreach',
'openstack_dashboard.django_pyscss_fix',
'compressor',
'horizon',
'openstack_auth',

View File

@ -39,6 +39,7 @@ python-swiftclient>=3.2.0 # Apache-2.0
pytz>=2013.6 # MIT
PyYAML>=3.12 # MIT
requests>=2.25.1 # Apache-2.0
six>=1.16.0 # MIT
semantic-version>=2.3.1 # BSD
XStatic>=1.0.0 # MIT License
XStatic-Angular>=1.5.8.0 # MIT License