diff options
author | Kurt Zenker <kz@openoffice.org> | 2008-05-20 13:32:42 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2008-05-20 13:32:42 +0000 |
commit | a565357d1d298c220401437544d735a2f2b1a8b9 (patch) | |
tree | 9553b4bf750457f6dd16ca9195688668db78f376 /pyuno/source | |
parent | 70e3929b27380a484333add35794b60a0a0cdc8c (diff) |
INTEGRATION: CWS pyunosystempaths_DEV300 (1.5.16); FILE MERGED
2008/04/23 20:04:52 fs 1.5.16.1: #i86251# committing on behalf of jbu@openoffice.org
Diffstat (limited to 'pyuno/source')
-rw-r--r-- | pyuno/source/loader/pythonloader.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/pyuno/source/loader/pythonloader.py b/pyuno/source/loader/pythonloader.py index 24a3b8cfbecf..5a246ea4237e 100644 --- a/pyuno/source/loader/pythonloader.py +++ b/pyuno/source/loader/pythonloader.py @@ -8,7 +8,7 @@ # # $RCSfile: pythonloader.py,v $ # -# $Revision: 1.6 $ +# $Revision: 1.7 $ # # This file is part of OpenOffice.org. # @@ -38,7 +38,7 @@ from com.sun.star.loader import XImplementationLoader from com.sun.star.lang import XServiceInfo MODULE_PROTOCOL = "vnd.openoffice.pymodule:" -DEBUG = 0 +DEBUG = 1 g_supportedServices = "com.sun.star.loader.Python", # referenced by the native C++ loader ! g_implementationName = "org.openoffice.comp.pyuno.Loader" # referenced by the native C++ loader ! @@ -53,18 +53,21 @@ g_loadedComponents = {} def checkForPythonPathBesideComponent( url ): path = unohelper.fileUrlToSystemPath( url+"/pythonpath.zip" ); if DEBUG == 1: - print "checking for existence of " + path - if 1 == os.access( path, os.F_OK) and not path in sys.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 " + path + " to sys.path" + print "adding " + encfile( path ) + " to sys.path" sys.path.append( path ) path = unohelper.fileUrlToSystemPath( url+"/pythonpath" ); - if 1 == os.access( path, os.F_OK) and not path in sys.path: + if 1 == os.access( encfile( path ), os.F_OK) and not path in sys.path: if DEBUG == 1: - print "adding " + path + " to sys.path" + print "adding " + encfile( path ) + " to sys.path" sys.path.append( path ) +def encfile(uni): + return uni.encode( sys.getfilesystemencoding()) + class Loader( XImplementationLoader, XServiceInfo, unohelper.Base ): def __init__(self, ctx ): if DEBUG: @@ -104,9 +107,9 @@ class Loader( XImplementationLoader, XServiceInfo, unohelper.Base ): src = src + "\n" # compile and execute the module - codeobject = compile( src, filename, "exec" ) + codeobject = compile( src, encfile(filename), "exec" ) exec codeobject in mod.__dict__ - mod.__file__ = filename + mod.__file__ = encfile(filename) g_loadedComponents[url] = mod return mod elif "vnd.openoffice.pymodule" == protocol: |