diff --git a/horizon/test/django_pyscss_fix/__init__.py b/horizon/test/django_pyscss_fix/__init__.py new file mode 100644 index 0000000000..52ef028586 --- /dev/null +++ b/horizon/test/django_pyscss_fix/__init__.py @@ -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 diff --git a/horizon/test/settings.py b/horizon/test/settings.py index 17031debba..291fc65dbc 100644 --- a/horizon/test/settings.py +++ b/horizon/test/settings.py @@ -51,6 +51,7 @@ INSTALLED_APPS = ( 'django.contrib.humanize', 'django.contrib.auth', 'django.contrib.contenttypes', + 'horizon.test.django_pyscss_fix', 'django_pyscss', 'compressor', 'horizon', diff --git a/lower-constraints.txt b/lower-constraints.txt index 5ef4ed063a..7df1b0fe18 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -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 diff --git a/openstack_dashboard/django_pyscss_fix/__init__.py b/openstack_dashboard/django_pyscss_fix/__init__.py index f53f10df3f..ceb851b625 100644 --- a/openstack_dashboard/django_pyscss_fix/__init__.py +++ b/openstack_dashboard/django_pyscss_fix/__init__.py @@ -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__) diff --git a/openstack_dashboard/settings.py b/openstack_dashboard/settings.py index 6253ef962c..ccfb4bfa9c 100644 --- a/openstack_dashboard/settings.py +++ b/openstack_dashboard/settings.py @@ -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', diff --git a/requirements.txt b/requirements.txt index 37866b9d74..fe857c6a72 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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