wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py |   12 
++++++++--
 wizards/com/sun/star/wizards/common/NoValidPathException.py        |   12 
++++++++--
 wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.py       |   12 
++++++++--
 wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py |   12 
++++++++--
 wizards/com/sun/star/wizards/ui/WizardDialog.py                    |   12 
++++++++--
 5 files changed, 50 insertions(+), 10 deletions(-)

New commits:
commit 4cdd446b090e3b04cd36d9bd992ca020381c039e
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Wed Aug 12 17:52:35 2020 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Wed Aug 12 20:45:09 2020 +0200

    imp is deprecated since Python v.3.4
    
    This avoid Python warnings about this during checks
    
    Change-Id: I6647d9c93f3c2fbc1af475f8bc45e03300ee8b79
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100518
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py 
b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py
index b1d53de6b4f6..15631123fbcb 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py
@@ -24,8 +24,16 @@ class AgendaWizardDialogResources(object):
     SECTION_MINUTES = "MINUTES"
 
     def __init__(self):
-        import imp, os
-        imp.load_source('strings', os.path.join(os.path.dirname(__file__), 
'../common/strings.hrc'))
+        import sys, os
+
+        # imp is deprecated since Python v.3.4
+        if sys.version_info >= (3,3):
+            from importlib.machinery import SourceFileLoader
+            SourceFileLoader('strings', 
os.path.join(os.path.dirname(__file__), '../common/strings.hrc')).load_module()
+        else:
+            import imp
+            imp.load_source('strings', os.path.join(os.path.dirname(__file__), 
'../common/strings.hrc'))
+
         import strings
 
         self.resAgendaWizardDialog_title = 
strings.RID_AGENDAWIZARDDIALOG_START_1
diff --git a/wizards/com/sun/star/wizards/common/NoValidPathException.py 
b/wizards/com/sun/star/wizards/common/NoValidPathException.py
index 07794852710f..54fb58613c09 100644
--- a/wizards/com/sun/star/wizards/common/NoValidPathException.py
+++ b/wizards/com/sun/star/wizards/common/NoValidPathException.py
@@ -22,8 +22,16 @@ class NoValidPathException(Exception):
         # TODO: NEVER open a dialog in an exception
         from .SystemDialog import SystemDialog
         if xMSF:
-            import imp, os
-            imp.load_source('strings', os.path.join(os.path.dirname(__file__), 
'../common/strings.hrc'))
+            import sys, os
+
+            # imp is deprecated since Python v.3.4
+            if sys.version_info >= (3,3):
+                from importlib.machinery import SourceFileLoader
+                SourceFileLoader('strings', 
os.path.join(os.path.dirname(__file__), '../common/strings.hrc')).load_module()
+            else:
+                import imp
+                imp.load_source('strings', 
os.path.join(os.path.dirname(__file__), '../common/strings.hrc'))
+
             import strings
             SystemDialog.showErrorBox(xMSF, strings.RID_COMMON_START_21) 
#OfficePathnotavailable
 
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.py 
b/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.py
index 6ee89bf9b680..a5bd469df80f 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.py
@@ -19,8 +19,16 @@
 class FaxWizardDialogResources(object):
 
     def __init__(self):
-        import imp, os
-        imp.load_source('strings', os.path.join(os.path.dirname(__file__), 
'../common/strings.hrc'))
+        import sys, os
+
+        # imp is deprecated since Python v.3.4
+        if sys.version_info >= (3,3):
+            from importlib.machinery import SourceFileLoader
+            SourceFileLoader('strings', 
os.path.join(os.path.dirname(__file__), '../common/strings.hrc')).load_module()
+        else:
+            import imp
+            imp.load_source('strings', os.path.join(os.path.dirname(__file__), 
'../common/strings.hrc'))
+
         import strings
 
         self.resFaxWizardDialog_title = strings.RID_FAXWIZARDDIALOG_START_1
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py 
b/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py
index 34a82cfd552b..19ef40c4a576 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py
@@ -19,8 +19,16 @@
 class LetterWizardDialogResources(object):
 
     def __init__(self):
-        import imp, os
-        imp.load_source('strings', os.path.join(os.path.dirname(__file__), 
'../common/strings.hrc'))
+        import sys, os
+
+        # imp is deprecated since Python v.3.4
+        if sys.version_info >= (3,3):
+            from importlib.machinery import SourceFileLoader
+            SourceFileLoader('strings', 
os.path.join(os.path.dirname(__file__), '../common/strings.hrc')).load_module()
+        else:
+            import imp
+            imp.load_source('strings', os.path.join(os.path.dirname(__file__), 
'../common/strings.hrc'))
+
         import strings
 
         self.resLetterWizardDialog_title = 
strings.RID_LETTERWIZARDDIALOG_START_1
diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.py 
b/wizards/com/sun/star/wizards/ui/WizardDialog.py
index 7f0060bdc49d..afa865a224c0 100644
--- a/wizards/com/sun/star/wizards/ui/WizardDialog.py
+++ b/wizards/com/sun/star/wizards/ui/WizardDialog.py
@@ -28,8 +28,16 @@ from com.sun.star.frame import TerminationVetoException
 from com.sun.star.awt.PushButtonType import HELP, STANDARD
 from com.sun.star.awt.FontWeight import BOLD
 
-import imp, os
-imp.load_source('strings', os.path.join(os.path.dirname(__file__), 
'../common/strings.hrc'))
+import sys, os
+
+# imp is deprecated since Python v.3.4
+if sys.version_info >= (3,3):
+    from importlib.machinery import SourceFileLoader
+    SourceFileLoader('strings', os.path.join(os.path.dirname(__file__), 
'../common/strings.hrc')).load_module()
+else:
+    import imp
+    imp.load_source('strings', os.path.join(os.path.dirname(__file__), 
'../common/strings.hrc'))
+
 import strings
 
 class WizardDialog(UnoDialog2):
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to