From d61986ffad3d28dbbd2413714be5fc6b8c971d83 Mon Sep 17 00:00:00 2001
From: Paul Marillonnet <pmarillonnet@entrouvert.com>
Date: Wed, 6 Mar 2019 17:35:56 +0100
Subject: [PATCH] python3: remove "execfile", which isn't a builtin anymore
 (#31145)

---
 debian-wheezy/debian_config.py                  | 2 +-
 debian-wheezy/multitenant/config.py             | 2 +-
 debian-wheezy/multitenant/debian_config.py      | 6 +++---
 debian/debian_config.py                         | 2 +-
 debian/multitenant/config.py                    | 2 +-
 debian/multitenant/debian_config.py             | 6 +++---
 doc/conf.py                                     | 2 +-
 src/authentic2/management/commands/load-ldif.py | 2 +-
 src/authentic2/settings.py                      | 2 +-
 src/django_rbac/test_settings.py                | 2 +-
 10 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/debian-wheezy/debian_config.py b/debian-wheezy/debian_config.py
index be1f5dd6..873152cc 100644
--- a/debian-wheezy/debian_config.py
+++ b/debian-wheezy/debian_config.py
@@ -303,7 +303,7 @@ extract_settings_from_environ()
 
 CONFIG_FILE = '/etc/authentic2/config.py'
 if os.path.exists(CONFIG_FILE):
-    execfile(CONFIG_FILE)
+    exec(open(CONFIG_FILE).read())
 
 # Warn if DEFAULT_FROM_EMAIL is the default value
 if DEFAULT_FROM_EMAIL == 'webmaster@localhost':
diff --git a/debian-wheezy/multitenant/config.py b/debian-wheezy/multitenant/config.py
index 2b228db7..73f4ef61 100644
--- a/debian-wheezy/multitenant/config.py
+++ b/debian-wheezy/multitenant/config.py
@@ -9,7 +9,7 @@
 # WARNING! Quick-start development settings unsuitable for production!
 # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
 
-# This file is sourced by "execfile" from /usr/lib/authentic/debian_config.py
+# This file is sourced by "exec" from /usr/lib/authentic/debian_config.py
 
 # SECURITY WARNING: don't run with debug turned on in production!
 DEBUG = False
diff --git a/debian-wheezy/multitenant/debian_config.py b/debian-wheezy/multitenant/debian_config.py
index 53cedacc..19b8a367 100644
--- a/debian-wheezy/multitenant/debian_config.py
+++ b/debian-wheezy/multitenant/debian_config.py
@@ -9,7 +9,7 @@ PROJECT_NAME = 'authentic2-multitenant'
 #
 # hobotization (multitenant)
 #
-execfile('/usr/lib/hobo/debian_config_common.py')
+exec(open('/usr/lib/hobo/debian_config_common.py').read())
 
 # Add the XForwardedForMiddleware
 MIDDLEWARE_CLASSES = ('authentic2.middleware.XForwardedForMiddleware',) + MIDDLEWARE_CLASSES
@@ -50,7 +50,7 @@ HOBO_SKELETONS_DIR = os.path.join(VAR_DIR, 'skeletons')
 
 CONFIG_FILE='/etc/%s/config.py' % PROJECT_NAME
 if os.path.exists(CONFIG_FILE):
-    execfile(CONFIG_FILE)
+    exec(open(CONFIG_FILE).read())
 
 # run additional settings snippets
-execfile('/usr/lib/hobo/debian_config_settings_d.py')
+exec(open('/usr/lib/hobo/debian_config_settings_d.py').read())
diff --git a/debian/debian_config.py b/debian/debian_config.py
index 7f9ab4ca..90511c52 100644
--- a/debian/debian_config.py
+++ b/debian/debian_config.py
@@ -309,7 +309,7 @@ extract_settings_from_environ()
 
 CONFIG_FILE = '/etc/authentic2/config.py'
 if os.path.exists(CONFIG_FILE):
-    execfile(CONFIG_FILE)
+    exec(open(CONFIG_FILE).read())
 
 # Warn if DEFAULT_FROM_EMAIL is the default value
 if DEFAULT_FROM_EMAIL == 'webmaster@localhost':
diff --git a/debian/multitenant/config.py b/debian/multitenant/config.py
index d80d13f8..d01a16c5 100644
--- a/debian/multitenant/config.py
+++ b/debian/multitenant/config.py
@@ -9,7 +9,7 @@
 # WARNING! Quick-start development settings unsuitable for production!
 # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
 
-# This file is sourced by "execfile" from
+# This file is sourced by "exec" from
 # /usr/lib/authentic2-multitenant/debian_config.py
 
 # SECURITY WARNING: don't run with debug turned on in production!
diff --git a/debian/multitenant/debian_config.py b/debian/multitenant/debian_config.py
index 5d906420..90e478c5 100644
--- a/debian/multitenant/debian_config.py
+++ b/debian/multitenant/debian_config.py
@@ -9,7 +9,7 @@ PROJECT_NAME = 'authentic2-multitenant'
 #
 # hobotization (multitenant)
 #
-execfile('/usr/lib/hobo/debian_config_common.py')
+exec(open('/usr/lib/hobo/debian_config_common.py').read())
 
 # Add the XForwardedForMiddleware
 MIDDLEWARE_CLASSES = ('authentic2.middleware.XForwardedForMiddleware',) + MIDDLEWARE_CLASSES
@@ -49,7 +49,7 @@ HOBO_SKELETONS_DIR = os.path.join(VAR_DIR, 'skeletons')
 
 CONFIG_FILE='/etc/%s/config.py' % PROJECT_NAME
 if os.path.exists(CONFIG_FILE):
-    execfile(CONFIG_FILE)
+    exec(open(CONFIG_FILE).read())
 
 # run additional settings snippets
-execfile('/usr/lib/hobo/debian_config_settings_d.py')
+exec(open('/usr/lib/hobo/debian_config_settings_d.py').read())
diff --git a/doc/conf.py b/doc/conf.py
index 524aeeb8..4feb346c 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -3,7 +3,7 @@
 # Authentic2 documentation build configuration file, created by
 # sphinx-quickstart on Thu Oct 13 14:38:32 2011.
 #
-# This file is execfile()d with the current directory set to its containing dir.
+# This file is exec()d with the current directory set to its containing dir.
 #
 # Note that not all possible configuration values are present in this
 # autogenerated file.
diff --git a/src/authentic2/management/commands/load-ldif.py b/src/authentic2/management/commands/load-ldif.py
index 34f11fb1..4d306ab0 100644
--- a/src/authentic2/management/commands/load-ldif.py
+++ b/src/authentic2/management/commands/load-ldif.py
@@ -26,7 +26,7 @@ class DjangoUserLDIFParser(ldif.LDIFParser):
         self.callback = None
         if 'callback' in self.options:
             d = globals().copy()
-            execfile(self.options['callback'], d)
+            exec(open(self.options['callback'], d).read())
             self.callback = d.get('callback')
         ldif.LDIFParser.__init__(self, *args, **kwargs)
 
diff --git a/src/authentic2/settings.py b/src/authentic2/settings.py
index 15a443e2..232e1e77 100644
--- a/src/authentic2/settings.py
+++ b/src/authentic2/settings.py
@@ -333,5 +333,5 @@ SELECT2_CSS = xstatic('select2', 'select2.min.css')
 #
 
 if 'AUTHENTIC2_SETTINGS_FILE' in os.environ:
-    execfile(os.environ['AUTHENTIC2_SETTINGS_FILE'])
+    exec(open(os.environ['AUTHENTIC2_SETTINGS_FILE']).read())
 logging.config.dictConfig(LOGGING)
diff --git a/src/django_rbac/test_settings.py b/src/django_rbac/test_settings.py
index ad595009..461d04d8 100644
--- a/src/django_rbac/test_settings.py
+++ b/src/django_rbac/test_settings.py
@@ -21,4 +21,4 @@ import os
 ALLOWED_HOSTS = []
 
 if 'AUTHENTIC2_SETTINGS_FILE' in os.environ:
-    execfile(os.environ['AUTHENTIC2_SETTINGS_FILE'])
+    exec(open(os.environ['AUTHENTIC2_SETTINGS_FILE']).read())
-- 
2.20.1

