From db80cd9142ce7e59e770889bf7bd28f184b6061d Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Sat, 23 Jul 2016 19:27:39 +0000 Subject: [PATCH] Replace BaseCommand.option_list-is-gone-from-django1.10.patch by django-1.10-use-argparse-instead-of-optparse.patch Rewritten-From: 9f2140b7361640d1c86f243c47f0f21baeff7a93 --- xenial/debian/changelog | 1 + ....option_list-is-gone-from-django1.10.patch | 27 -- ...use-django.template.Context-function.patch | 24 +- ....10-use-argparse-instead-of-optparse.patch | 239 ++++++++++++++++++ xenial/debian/patches/series | 4 +- 5 files changed, 257 insertions(+), 38 deletions(-) delete mode 100644 xenial/debian/patches/BaseCommand.option_list-is-gone-from-django1.10.patch create mode 100644 xenial/debian/patches/django-1.10-use-argparse-instead-of-optparse.patch diff --git a/xenial/debian/changelog b/xenial/debian/changelog index e1126ec..e410df9 100644 --- a/xenial/debian/changelog +++ b/xenial/debian/changelog @@ -1,6 +1,7 @@ horizon (3:10.0.0~b2-2) UNRELEASED; urgency=medium * Add Django 1.10 patch: + - django-1.10-use-argparse-instead-of-optparse.patch - django-1.10-django.conf.urls.patterns-removed.patch - django-1.10-fix-wrong-django.conf.urls.url-call.patch - django-1.10-fixes-get-form-uses-kwargs.patch diff --git a/xenial/debian/patches/BaseCommand.option_list-is-gone-from-django1.10.patch b/xenial/debian/patches/BaseCommand.option_list-is-gone-from-django1.10.patch deleted file mode 100644 index c6edc56..0000000 --- a/xenial/debian/patches/BaseCommand.option_list-is-gone-from-django1.10.patch +++ /dev/null @@ -1,27 +0,0 @@ -Description: [Django 1.10] BaseCommand.option_list is gone from Django 1.10 -Author: Thomas Goirand -Forwarded: no -Last-Update: 2016-07-19 - ---- horizon-10.0.0~b2.orig/openstack_dashboard/management/commands/make_web_conf.py -+++ horizon-10.0.0~b2/openstack_dashboard/management/commands/make_web_conf.py -@@ -165,7 +165,7 @@ location you desire, e.g.:: - 'admin': context['ADMIN'], - 'hostname': context['VHOSTNAME'], } - -- option_list = BaseCommand.option_list + ( -+ option_list = getattr(BaseCommand, 'option_list', ()) + ( - # TODO(ygbo): Add an --nginx option. - make_option("-a", "--apache", - default=False, action="store_true", dest="apache", ---- horizon-10.0.0~b2.orig/openstack_dashboard/management/commands/migrate_settings.py -+++ horizon-10.0.0~b2/openstack_dashboard/management/commands/migrate_settings.py -@@ -75,7 +75,7 @@ class DirContext(object): - - - class Command(BaseCommand): -- option_list = BaseCommand.option_list + ( -+ option_list = getattr(BaseCommand, 'option_list', ()) + ( - optparse.make_option( - '--gendiff', - action='store_true', diff --git a/xenial/debian/patches/django-1.10-do-not-use-django.template.Context-function.patch b/xenial/debian/patches/django-1.10-do-not-use-django.template.Context-function.patch index e291dc2..0441d36 100644 --- a/xenial/debian/patches/django-1.10-do-not-use-django.template.Context-function.patch +++ b/xenial/debian/patches/django-1.10-do-not-use-django.template.Context-function.patch @@ -7,8 +7,10 @@ Author: Thomas Goirand Forwarded: no Last-Update: 2016-07-21 ---- horizon-10.0.0~b2.orig/horizon/forms/fields.py -+++ horizon-10.0.0~b2/horizon/forms/fields.py +Index: horizon/horizon/forms/fields.py +=================================================================== +--- horizon.orig/horizon/forms/fields.py ++++ horizon/horizon/forms/fields.py @@ -24,7 +24,6 @@ from django.core import urlresolvers from django.forms import fields from django.forms.utils import flatatt # noqa @@ -34,8 +36,10 @@ Last-Update: 2016-07-21 return template.render(context) ---- horizon-10.0.0~b2.orig/horizon/test/tests/templatetags.py -+++ horizon-10.0.0~b2/horizon/test/tests/templatetags.py +Index: horizon/horizon/test/tests/templatetags.py +=================================================================== +--- horizon.orig/horizon/test/tests/templatetags.py ++++ horizon/horizon/test/tests/templatetags.py @@ -19,7 +19,6 @@ import re @@ -53,9 +57,11 @@ Last-Update: 2016-07-21 def test_site_branding_tag(self): """Test if site_branding tag renders the correct setting.""" ---- horizon-10.0.0~b2.orig/openstack_dashboard/management/commands/make_web_conf.py -+++ horizon-10.0.0~b2/openstack_dashboard/management/commands/make_web_conf.py -@@ -23,7 +23,7 @@ import warnings +Index: horizon/openstack_dashboard/management/commands/make_web_conf.py +=================================================================== +--- horizon.orig/openstack_dashboard/management/commands/make_web_conf.py ++++ horizon/openstack_dashboard/management/commands/make_web_conf.py +@@ -22,7 +22,7 @@ import warnings from django.conf import settings from django.core.management.base import BaseCommand # noqa @@ -64,7 +70,7 @@ Last-Update: 2016-07-21 # Suppress DeprecationWarnings which clutter the output to the point of # rendering it unreadable. -@@ -66,7 +66,7 @@ def _getattr(obj, name, default): +@@ -65,7 +65,7 @@ def _getattr(obj, name, default): return default @@ -73,7 +79,7 @@ Last-Update: 2016-07-21 'DJANGO_SETTINGS_MODULE': os.environ['DJANGO_SETTINGS_MODULE'], 'HOSTNAME': socket.getfqdn(), 'PROJECT_PATH': os.path.realpath( -@@ -76,7 +76,7 @@ context = Context({ +@@ -75,7 +75,7 @@ context = Context({ 'SSLCERT': '/etc/pki/tls/certs/ca.crt', 'SSLKEY': '/etc/pki/tls/private/ca.key', 'CACERT': None, diff --git a/xenial/debian/patches/django-1.10-use-argparse-instead-of-optparse.patch b/xenial/debian/patches/django-1.10-use-argparse-instead-of-optparse.patch new file mode 100644 index 0000000..49ad65f --- /dev/null +++ b/xenial/debian/patches/django-1.10-use-argparse-instead-of-optparse.patch @@ -0,0 +1,239 @@ +Description: Use argparse instead of optparse + Use argparse instead of optparse + . + Use of optparse module is deprecated [1] in Django 1.8 and 1.9 versions and + its support has been removed in currently developed version 1.10 [2] + . + [1] https://docs.djangoproject.com/en/1.9/howto/custom-management-commands/#django.core.management.BaseCommand.option_list + [2] https://github.com/django/django/commit/6a70cb53971a19f2d9e71d5ee24bfb0e844b4d9d#diff-dfc45ab8548a0777543d12d6e77c9173 +Author: Ivan Udovichenko +Date: Fri, 22 Jul 2016 12:05:05 +0000 (+0300) +X-Git-Url: https://review.openstack.org/gitweb?p=openstack%2Fhorizon.git;a=commitdiff_plain;h=6fb1b860bf2343f412302ecfaed2eb48d315023c +Change-Id: I0c7622fce0d5fabce45366d002b5e72e4c170344 +Origin: upstream, https://review.openstack.org/#/c/345998/ +Last-Update: 2016-07-23 + +diff --git a/openstack_dashboard/management/commands/make_web_conf.py b/openstack_dashboard/management/commands/make_web_conf.py +index 9cbfe61..7f483bf 100644 +--- a/openstack_dashboard/management/commands/make_web_conf.py ++++ b/openstack_dashboard/management/commands/make_web_conf.py +@@ -13,7 +13,6 @@ + + from __future__ import print_function + +-from optparse import make_option # noqa + import os + import re + import socket +@@ -165,76 +164,100 @@ location you desire, e.g.:: + 'admin': context['ADMIN'], + 'hostname': context['VHOSTNAME'], } + +- option_list = BaseCommand.option_list + ( ++ def add_arguments(self, parser): + # TODO(ygbo): Add an --nginx option. +- make_option("-a", "--apache", +- default=False, action="store_true", dest="apache", +- help="generate an apache vhost configuration"), +- make_option("--cacert", +- dest="cacert", +- help=("Use with the --apache and --ssl option to define " +- "the path to the SSLCACertificateFile" +- ), +- metavar="CACERT"), +- make_option("-f", "--force", +- default=False, action="store_true", dest="force", +- help="force overwriting of an existing %s file" % +- context['WSGI_FILE']), +- make_option("-H", "--hostname", +- dest="hostname", +- help=("Use with the --apache option to define the server's" +- " hostname (default : %s)") % context['VHOSTNAME'], +- metavar="HOSTNAME"), +- make_option("--logdir", +- dest="logdir", +- help=("Use with the --apache option to define the path to " +- "the apache log directory(default : %s)" +- % context['LOGDIR']), +- metavar="CACERT"), +- make_option("-m", "--mail", +- dest="mail", +- help=("Use with the --apache option to define the web site" +- " administrator's email (default : %s)") % +- context['ADMIN'], +- metavar="MAIL"), +- make_option("-n", "--namedhost", +- default=False, action="store_true", dest="namedhost", +- help=("Use with the --apache option. The apache vhost " +- "configuration will work only when accessed with " +- "the proper hostname (see --hostname).")), +- make_option("-p", "--project", +- dest="project", +- help=("Use with the --apache option to define the project " +- "name (default : %s)") % context['PROJECT_NAME'], +- metavar="PROJECT"), +- make_option("-s", "--ssl", +- default=False, action="store_true", dest="ssl", +- help=("Use with the --apache option. The apache vhost " +- "configuration will use an SSL configuration")), +- make_option("--sslcert", +- dest="sslcert", +- help=("Use with the --apache and --ssl option to define " +- "the path to the SSLCertificateFile (default : %s)" +- ) % context['SSLCERT'], +- metavar="SSLCERT"), +- make_option("--sslkey", +- dest="sslkey", +- help=("Use with the --apache and --ssl option to define " +- "the path to the SSLCertificateKeyFile " +- "(default : %s)") % context['SSLKEY'], +- metavar="SSLKEY"), +- make_option("--apache-version", +- dest="apache_version", +- type="float", +- help=("Use with the --apache option to define the apache " +- "major (as a floating point number) version " +- "(default : %s)." +- % context['APACHE2_VERSION']), +- metavar="APACHE_VERSION"), +- make_option("-w", "--wsgi", +- default=False, action="store_true", dest="wsgi", +- help="generate the horizon.wsgi file"), +- ) ++ parser.add_argument( ++ "-a", "--apache", ++ default=False, action="store_true", dest="apache", ++ help="generate an apache vhost configuration" ++ ) ++ parser.add_argument( ++ "--cacert", ++ dest="cacert", ++ help=("Use with the --apache and --ssl option to define the path" ++ " to the SSLCACertificateFile"), ++ metavar="CACERT" ++ ) ++ parser.add_argument( ++ "-f", "--force", ++ default=False, action="store_true", dest="force", ++ help="force overwriting of an existing %s file" % ++ context['WSGI_FILE'] ++ ) ++ parser.add_argument( ++ "-H", "--hostname", ++ dest="hostname", ++ help=("Use with the --apache option to define the server's" ++ " hostname (default : %s)") % context['VHOSTNAME'], ++ metavar="HOSTNAME" ++ ) ++ parser.add_argument( ++ "--logdir", ++ dest="logdir", ++ help=("Use with the --apache option to define the path to " ++ "the apache log directory(default : %s)" ++ % context['LOGDIR']), ++ metavar="CACERT" ++ ) ++ parser.add_argument( ++ "-m", "--mail", ++ dest="mail", ++ help=("Use with the --apache option to define the web site" ++ " administrator's email (default : %s)") % ++ context['ADMIN'], ++ metavar="MAIL" ++ ) ++ parser.add_argument( ++ "-n", "--namedhost", ++ default=False, action="store_true", dest="namedhost", ++ help=("Use with the --apache option. The apache vhost " ++ "configuration will work only when accessed with " ++ "the proper hostname (see --hostname).") ++ ) ++ parser.add_argument( ++ "-p", "--project", ++ dest="project", ++ help=("Use with the --apache option to define the project " ++ "name (default : %s)") % context['PROJECT_NAME'], ++ metavar="PROJECT" ++ ) ++ parser.add_argument( ++ "-s", "--ssl", ++ default=False, action="store_true", dest="ssl", ++ help=("Use with the --apache option. The apache vhost " ++ "configuration will use an SSL configuration") ++ ) ++ parser.add_argument( ++ "--sslcert", ++ dest="sslcert", ++ help=("Use with the --apache and --ssl option to define " ++ "the path to the SSLCertificateFile (default : %s)" ++ ) % context['SSLCERT'], ++ metavar="SSLCERT" ++ ) ++ parser.add_argument( ++ "--sslkey", ++ dest="sslkey", ++ help=("Use with the --apache and --ssl option to define " ++ "the path to the SSLCertificateKeyFile " ++ "(default : %s)") % context['SSLKEY'], ++ metavar="SSLKEY" ++ ) ++ parser.add_argument( ++ "--apache-version", ++ dest="apache_version", ++ type="float", ++ help=("Use with the --apache option to define the apache " ++ "major (as a floating point number) version " ++ "(default : %s)." ++ % context['APACHE2_VERSION']), ++ metavar="APACHE_VERSION" ++ ) ++ parser.add_argument( ++ "-w", "--wsgi", ++ default=False, action="store_true", dest="wsgi", ++ help="generate the horizon.wsgi file" ++ ) + + def handle(self, *args, **options): + force = options.get('force') +diff --git a/openstack_dashboard/management/commands/migrate_settings.py b/openstack_dashboard/management/commands/migrate_settings.py +index ce4f7b9..8a9b420 100644 +--- a/openstack_dashboard/management/commands/migrate_settings.py ++++ b/openstack_dashboard/management/commands/migrate_settings.py +@@ -14,7 +14,6 @@ from __future__ import print_function + + import difflib + import imp +-import optparse + import os + import shlex + import subprocess +@@ -75,24 +74,23 @@ class DirContext(object): + + + class Command(BaseCommand): +- option_list = BaseCommand.option_list + ( +- optparse.make_option( ++ def add_arguments(self, parser): ++ parser.add_argument( + '--gendiff', + action='store_true', + dest='gendiff', + default=False, + help=('Generate a diff file between local_settings.py and ' + 'local_settings.py.example'), +- ), +- optparse.make_option( ++ ) ++ parser.add_argument( + '-f', '--force', + action='store_true', + dest='force', + default=False, + help=('Force destination rewriting without warning if the ' + 'destination file already exists.'), +- ), +- ) ++ ) + + help = ("Creates a local_settings.py file from the " + "local_settings.py.example template.") diff --git a/xenial/debian/patches/series b/xenial/debian/patches/series index 5b122d7..775c1c2 100644 --- a/xenial/debian/patches/series +++ b/xenial/debian/patches/series @@ -1,10 +1,10 @@ fix-dashboard-django-wsgi.patch fix-dashboard-manage.patch fixed-horizon-MANIFEST.in.patch -BaseCommand.option_list-is-gone-from-django1.10.patch +django-1.10-use-argparse-instead-of-optparse.patch django-1.10-django.conf.urls.patterns-removed.patch django-1.10-fix-wrong-django.conf.urls.url-call.patch django-1.10-fixes-get-form-uses-kwargs.patch -#django-1.10-do-not-use-django.template.Context-function.patch django-1.10-horizon.test.settings.patch django-1.10-openstack_dashboard.test.settings.patch +django-1.10-do-not-use-django.template.Context-function.patch -- 2.45.2