No subject


Tue Jun 28 14:12:10 PDT 2011


--- a/pyuno/source/loader/pythonloader.py
+++ b/pyuno/source/loader/pythonloader.py
@@ -49,16 +49,16 @@ g_loadedComponents = {}
 def checkForPythonPathBesideComponent( url ):
       path = unohelper.fileUrlToSystemPath( url+"/pythonpath.zip" );
       if DEBUG == 1:
-            print "checking for existence of " + encfile( path )
+        print("checking for existence of " + encfile( path ))
       if 1 == os.access( encfile( path ), os.F_OK) and not path in sys.path:
             if DEBUG == 1:
-                  print "adding " + encfile( path ) + " to sys.path"
+            print("adding " + encfile( path ) + " to sys.path")
             sys.path.append( path )

       path = unohelper.fileUrlToSystemPath( url+"/pythonpath" );
       if 1 == os.access( encfile( path ), os.F_OK) and not path in sys.path:
             if DEBUG == 1:
-                  print "adding " + encfile( path ) + " to sys.path"
+            print("adding " + encfile( path ) + " to sys.path")
             sys.path.append( path )

 def encfile(uni):
###########################

So already in the first hunk that is not whitespace-only, it changes
the alignment of the print statement from the last if-clause to the
wrong level.. This is noticable in various places.

But what makes it incompatible with Mac are those:

@@ -113,13 +113,13 @@ class Loader( XImplementationLoader,
XServiceInfo, unohelper.Base ):
                 else:
                       raise RuntimeException( "PythonLoader: Unknown
protocol " +
                                               protocol + " in url "
+url, self )
-          except ImportError, e:
-                raise RuntimeException( "Couldn't load "+url+ " for
reason "+str(e), None)
+        except ImportError as e:
+            raise RuntimeException( "Couldn't load " + url + " for
reason " + str(e), None )
           return None

       def activate( self, implementationName, dummy, locationUrl, regKey ):
          if DEBUG:
-            print "pythonloader.Loader.activate"
+            print("pythonloader.Loader.activate")

          mod = self.getModuleFromUrl( locationUrl )
           implHelper = mod.__dict__.get( "g_ImplementationHelper" , None )
###########################

I.e. "except ImportError as e" is a syntax error in python 2.3, you
need to keep it as "except ImportError, e" - same for various other
places.

So I ask Andreas Becker to either revert and apply a clean version of
the Python 3 relevant changes /only/ (i.e. without the whitespache
changes all over the place), or to go through the whole thing again
and make sure that the indendation still matches the original
versions.

AFAICT the only think that is python 3 relevant is to put the argument
to print in parentheses.

Especially this change:

@@ -104,7 +104,7 @@ class Loader( XImplementationLoader, XServiceInfo,
unohelper.Base ):

                             # compile and execute the module
                             codeobject = compile( src,
encfile(filename), "exec" )
-                            exec codeobject in mod.__dict__
+                    exec(codeobject, mod.__dict__)
                             mod.__file__ = encfile(filename)
                             g_loadedComponents[url] = mod
                       return mod
########
just is not right, is it?

ciao
Christian


More information about the LibreOffice mailing list