This is an automated email from the ASF dual-hosted git repository.

jimjag pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/AOO42X by this push:
     new 08fafdc14b AOO42X: revert the Python 3.10 changes, keep arm64 support
08fafdc14b is described below

commit 08fafdc14b7dfdc1a4810fbbbda8d35fad41b5a0
Author: Jim Jagielski <[email protected]>
AuthorDate: Fri Jun 5 09:56:37 2026 -0400

    AOO42X: revert the Python 3.10 changes, keep arm64 support
    
    The combined backport (cd15cd7435) brought both the macOS arm64 work and
    a bundled-Python 2.7->3.10 baseline to AOO42X. Per decision, AOO42X
    should NOT carry the Python 3 migration (a release branch keeps its
    known Python 2.7), but MUST keep the Apple Silicon support.
    
    Verified none of the 5 Python-changed files contain any arch-specific
    code and no arm64 file depends on the Python version, so reverting them
    does not affect arm64 support. Restore to their pre-backport AOO42X
    state (b4fbd80c76):
      - python/pyversion.mk, pyversion_dmake.mk  (back to 2.7.18)
      - pyuno/source/loader/pythonloader.py      (imp, file())
      - scripting/source/pyprov/pythonscript.py  (imp.new_module)
      - scripting/source/pyprov/mailmerge.py     (Py2 email module imports)
    
    All arm64 changes (bridge, build plumbing, externals, packaging, JVM
    discovery, the aoo-420-release.xml arm64 entry) are untouched. The Py3
    work remains on trunk.
---
 main/python/pyversion.mk                     |  4 ++--
 main/python/pyversion_dmake.mk               |  4 ++--
 main/pyuno/source/loader/pythonloader.py     |  6 +++---
 main/scripting/source/pyprov/mailmerge.py    | 16 ++++++++--------
 main/scripting/source/pyprov/pythonscript.py | 10 +++++-----
 5 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/main/python/pyversion.mk b/main/python/pyversion.mk
index 95f7b299da..353925e92e 100644
--- a/main/python/pyversion.mk
+++ b/main/python/pyversion.mk
@@ -20,8 +20,8 @@
 # *************************************************************
 # when you want to change the python version, you must update the d.lst
 # in the python project accordingly !!!
-PYMAJOR=3
-PYMINOR=10
+PYMAJOR=2
+PYMINOR=7
 PYMICRO=18
 PYVERSION=$(PYMAJOR).$(PYMINOR).$(PYMICRO)
 
diff --git a/main/python/pyversion_dmake.mk b/main/python/pyversion_dmake.mk
index b8252a9767..37aa099277 100644
--- a/main/python/pyversion_dmake.mk
+++ b/main/python/pyversion_dmake.mk
@@ -20,8 +20,8 @@
 # *************************************************************
 # when you want to change the python version, you must update the d.lst
 # in the python project accordingly !!!
-PYMAJOR=3
-PYMINOR=10
+PYMAJOR=2
+PYMINOR=7
 PYMICRO=18
 PYVERSION=$(PYMAJOR).$(PYMINOR).$(PYMICRO)
 
diff --git a/main/pyuno/source/loader/pythonloader.py 
b/main/pyuno/source/loader/pythonloader.py
index 34ff1c532b..46e051da98 100644
--- a/main/pyuno/source/loader/pythonloader.py
+++ b/main/pyuno/source/loader/pythonloader.py
@@ -21,7 +21,7 @@
 import uno
 import unohelper
 import sys
-import types
+import imp
 import os
 from com.sun.star.uno import Exception,RuntimeException
 from com.sun.star.loader import XImplementationLoader
@@ -84,14 +84,14 @@ class Loader( XImplementationLoader, XServiceInfo, 
unohelper.Base ):
                 # did we load the module already ?
                 mod = g_loadedComponents.get( url )
                 if not mod:
-                    mod = types.ModuleType("uno_component")
+                    mod = imp.new_module("uno_component")
 
                     # check for pythonpath.zip beside .py files
                     checkForPythonPathBesideComponent( url[0:url.rfind('/')] )
 
                     # read the file
                     filename = unohelper.fileUrlToSystemPath( url )
-                    fileHandle = open( filename )
+                    fileHandle = file( filename )
                     src = fileHandle.read().replace("\r","")
                     if not src.endswith( "\n" ):
                         src = src + "\n"
diff --git a/main/scripting/source/pyprov/mailmerge.py 
b/main/scripting/source/pyprov/mailmerge.py
index c11ddd8c7a..4a4c430c28 100644
--- a/main/scripting/source/pyprov/mailmerge.py
+++ b/main/scripting/source/pyprov/mailmerge.py
@@ -54,13 +54,13 @@ from com.sun.star.lang import IllegalArgumentException
 from com.sun.star.lang import EventObject
 from com.sun.star.mail import SendMailMessageFailedException
 
-from email.mime.base import MIMEBase
-from email.message import Message
-from email import encoders
-from email.header import Header
-from email.mime.multipart import MIMEMultipart
-from email.utils import formatdate
-from email.utils import parseaddr
+from email.MIMEBase import MIMEBase
+from email.Message import Message
+from email import Encoders
+from email.Header import Header
+from email.MIMEMultipart import MIMEMultipart
+from email.Utils import formatdate
+from email.Utils import parseaddr
 from socket import _GLOBAL_DEFAULT_TIMEOUT
 
 import sys, smtplib, imaplib, poplib
@@ -245,7 +245,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
             msgattachment = MIMEBase(maintype, subtype)
             data = content.getTransferData(flavor)
             msgattachment.set_payload(data)
-            encoders.encode_base64(msgattachment)
+            Encoders.encode_base64(msgattachment)
             fname = attachment.ReadableName
             try:
                 fname.encode('ascii')
diff --git a/main/scripting/source/pyprov/pythonscript.py 
b/main/scripting/source/pyprov/pythonscript.py
index 03f52b897a..4e7fc4667e 100644
--- a/main/scripting/source/pyprov/pythonscript.py
+++ b/main/scripting/source/pyprov/pythonscript.py
@@ -24,7 +24,7 @@ import uno
 import unohelper
 import sys
 import os
-import types
+import imp
 import time
 import ast
 
@@ -356,7 +356,7 @@ class ScriptContext(unohelper.Base):
 #        code = readTextFromStream( sfa.openFileRead( url ) )
 
         # execute the module
-#        entry = ModuleEntry( lastRead, 
types.ModuleType("ooo_script_framework") )
+#        entry = ModuleEntry( lastRead, imp.new_module("ooo_script_framework") 
)
 #        entry.module.__dict__[GLOBAL_SCRIPTCONTEXT_NAME] = g_scriptContext
 #        entry.module.__file__ = url
 #        exec code in entry.module.__dict__
@@ -489,7 +489,7 @@ class ProviderContext:
             src = ensureSourceState( src )
 
             # execute the module
-            entry = ModuleEntry( lastRead, 
types.ModuleType("ooo_script_framework") )
+            entry = ModuleEntry( lastRead, 
imp.new_module("ooo_script_framework") )
             entry.module.__dict__[GLOBAL_SCRIPTCONTEXT_NAME] = 
self.scriptContext
 
             code = None
@@ -666,7 +666,7 @@ class ScriptBrowseNode( unohelper.Base, XBrowseNode, 
XPropertySet, XInvocation,
             if event.ActionCommand == "Run":
                 code = self.editor.getControl("EditorTextField").getText()
                 code = ensureSourceState( code )
-                mod = types.ModuleType("ooo_script_framework")
+                mod = imp.new_module("ooo_script_framework")
                 mod.__dict__[GLOBAL_SCRIPTCONTEXT_NAME] = 
self.provCtx.scriptContext
                 exec(code, mod.__dict__)
                 values = mod.__dict__.get( CALLABLE_CONTAINER_NAME , None )
@@ -827,7 +827,7 @@ class FileBrowseNode( unohelper.Base, XBrowseNode, 
XPropertySet, XInvocation, XA
             if event.ActionCommand == "Run":
                 code = self.editor.getControl("EditorTextField").getText()
                 code = ensureSourceState( code )
-                mod = types.ModuleType("ooo_script_framework")
+                mod = imp.new_module("ooo_script_framework")
                 mod.__dict__[GLOBAL_SCRIPTCONTEXT_NAME] = 
self.provCtx.scriptContext
                 exec(code, mod.__dict__)
                 values = mod.__dict__.get( CALLABLE_CONTAINER_NAME , None )

Reply via email to