diff options
Diffstat (limited to 'scripting/source')
-rw-r--r-- | scripting/source/basprov/basprov.map | 9 | ||||
-rw-r--r-- | scripting/source/basprov/makefile.mk | 2 | ||||
-rw-r--r-- | scripting/source/dlgprov/dlgprov.map | 9 | ||||
-rw-r--r-- | scripting/source/dlgprov/makefile.mk | 2 | ||||
-rw-r--r-- | scripting/source/pyprov/pythonscript.py | 51 | ||||
-rw-r--r-- | scripting/source/stringresource/makefile.mk | 2 | ||||
-rw-r--r-- | scripting/source/stringresource/stringresource.map | 9 | ||||
-rw-r--r--[-rwxr-xr-x] | scripting/source/vbaevents/makefile.mk | 2 | ||||
-rwxr-xr-x | scripting/source/vbaevents/vbaevents.map | 9 |
9 files changed, 38 insertions, 57 deletions
diff --git a/scripting/source/basprov/basprov.map b/scripting/source/basprov/basprov.map deleted file mode 100644 index 737cddbfe3dfe..0000000000000 --- a/scripting/source/basprov/basprov.map +++ /dev/null @@ -1,9 +0,0 @@ -OOO_1.1 { - global: - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; diff --git a/scripting/source/basprov/makefile.mk b/scripting/source/basprov/makefile.mk index 1555a74926e26..5001e5db288ec 100644 --- a/scripting/source/basprov/makefile.mk +++ b/scripting/source/basprov/makefile.mk @@ -50,7 +50,7 @@ SLOFILES= \ SHL1TARGET= $(TARGET)$(DLLPOSTFIX).uno SHL1IMPLIB= i$(TARGET) -SHL1VERSIONMAP=$(TARGET).map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) diff --git a/scripting/source/dlgprov/dlgprov.map b/scripting/source/dlgprov/dlgprov.map deleted file mode 100644 index 737cddbfe3dfe..0000000000000 --- a/scripting/source/dlgprov/dlgprov.map +++ /dev/null @@ -1,9 +0,0 @@ -OOO_1.1 { - global: - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; diff --git a/scripting/source/dlgprov/makefile.mk b/scripting/source/dlgprov/makefile.mk index 0ad861d5c2811..4554234127849 100644 --- a/scripting/source/dlgprov/makefile.mk +++ b/scripting/source/dlgprov/makefile.mk @@ -46,7 +46,7 @@ SLOFILES= \ SHL1TARGET= $(TARGET)$(DLLPOSTFIX).uno SHL1IMPLIB= i$(TARGET) -SHL1VERSIONMAP=$(TARGET).map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) diff --git a/scripting/source/pyprov/pythonscript.py b/scripting/source/pyprov/pythonscript.py index 6a57fa792873d..88e0a9efbc9df 100644 --- a/scripting/source/pyprov/pythonscript.py +++ b/scripting/source/pyprov/pythonscript.py @@ -5,6 +5,7 @@ import sys import os import imp import time +import compiler class LogLevel: NONE = 0 @@ -340,6 +341,32 @@ class ProviderContext: ret = url[0:pos]+ package.transientPathElement + "/" + url[pos:len(url)] log.isDebugLevel() and log.debug( "getStorageUrlFromPersistentUrl " + url + " -> "+ ret) return ret + + def getFuncsByUrl( self, url ): + src = readTextFromStream( self.sfa.openFileRead( url ) ) + checkForPythonPathBesideScript( url[0:url.rfind('/')] ) + src = ensureSourceState( src ) + + code = compiler.parse( src ) + + allFuncs = [] + + if code == None: + return allFuncs + + g_exportedScripts = [] + for node in code.node.nodes: + if node.__class__.__name__ == 'Function': + allFuncs.append(node.name) + elif node.__class__.__name__ == 'Assign': + for assignee in node.nodes: + if assignee.name == 'g_exportedScripts': + for item in node.expr: + if item.__class__.__name__ == 'Name': + g_exportedScripts.append(item.name) + return g_exportedScripts + + return allFuncs def getModuleByUrl( self, url ): entry = self.modules.get(url) @@ -382,11 +409,10 @@ def isScript( candidate ): #------------------------------------------------------- class ScriptBrowseNode( unohelper.Base, XBrowseNode , XPropertySet, XInvocation, XActionListener ): - def __init__( self, provCtx, uri, fileName, funcName, func ): + def __init__( self, provCtx, uri, fileName, funcName ): self.fileName = fileName self.funcName = funcName self.provCtx = provCtx - self.func = func self.uri = uri def getName( self ): @@ -407,8 +433,6 @@ class ScriptBrowseNode( unohelper.Base, XBrowseNode , XPropertySet, XInvocation, if name == "URI": ret = self.provCtx.uriHelper.getScriptURI( self.provCtx.getPersistentUrlFromStorageUrl( self.uri + "$" + self.funcName ) ) - elif name == "Description": - ret = getattr( self.func, "__doc__", None ) elif name == "Editable" and ENABLE_EDIT_DIALOG: ret = not self.provCtx.sfa.isReadOnly( self.uri ) @@ -506,7 +530,7 @@ class FileBrowseNode( unohelper.Base, XBrowseNode ): self.provCtx = provCtx self.uri = uri self.name = name - self.module = None + self.funcnames = None def getName( self ): return self.name @@ -514,21 +538,14 @@ class FileBrowseNode( unohelper.Base, XBrowseNode ): def getChildNodes(self): ret = () try: - self.module = self.provCtx.getModuleByUrl( self.uri ) - values = self.module.__dict__.get( CALLABLE_CONTAINER_NAME , None ) + self.funcnames = self.provCtx.getFuncsByUrl( self.uri ) - # no g_exportedScripts, export every function - if not isinstance(values, type(())): - values = self.module.__dict__.values() - scriptNodeList = [] - for i in values: - if isScript( i ): - scriptNodeList.append( - ScriptBrowseNode( - self.provCtx, self.uri, self.name, i.__name__, i )) + for i in self.funcnames: + scriptNodeList.append( + ScriptBrowseNode( + self.provCtx, self.uri, self.name, i )) ret = tuple( scriptNodeList ) - # must compile ! log.isDebugLevel() and log.debug( "returning " +str(len(ret)) + " ScriptChildNodes on " + self.uri ) except Exception, e: text = lastException2String() diff --git a/scripting/source/stringresource/makefile.mk b/scripting/source/stringresource/makefile.mk index afb07fddfa2f8..dfc2d1979190b 100644 --- a/scripting/source/stringresource/makefile.mk +++ b/scripting/source/stringresource/makefile.mk @@ -44,7 +44,7 @@ SLOFILES= \ SHL1TARGET= $(TARGET)$(DLLPOSTFIX).uno SHL1IMPLIB= i$(TARGET) -SHL1VERSIONMAP=$(TARGET).map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) diff --git a/scripting/source/stringresource/stringresource.map b/scripting/source/stringresource/stringresource.map deleted file mode 100644 index 737cddbfe3dfe..0000000000000 --- a/scripting/source/stringresource/stringresource.map +++ /dev/null @@ -1,9 +0,0 @@ -OOO_1.1 { - global: - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; diff --git a/scripting/source/vbaevents/makefile.mk b/scripting/source/vbaevents/makefile.mk index 227da45f9f082..1946c61d1e0bc 100755..100644 --- a/scripting/source/vbaevents/makefile.mk +++ b/scripting/source/vbaevents/makefile.mk @@ -60,7 +60,7 @@ SLOFILES= \ SHL1TARGET= $(TARGET)$(DLLPOSTFIX).uno SHL1IMPLIB= i$(TARGET) -SHL1VERSIONMAP=$(TARGET).map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) diff --git a/scripting/source/vbaevents/vbaevents.map b/scripting/source/vbaevents/vbaevents.map deleted file mode 100755 index 737cddbfe3dfe..0000000000000 --- a/scripting/source/vbaevents/vbaevents.map +++ /dev/null @@ -1,9 +0,0 @@ -OOO_1.1 { - global: - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; |