@@ -13,21 +13,44 @@ ClassMethod dispatchRegisterComponent(
1313 pCLASSPATHS As %String = " " ,
1414 pFullpath As %String = " " ,
1515 pOverwrite As %Boolean = 0 ,
16- pProxyClassname As %String = " " ) As %Status
16+ pProxyClassname As %String = " " ,
17+ pPythonLib ,
18+ pPythonPath ,
19+ pPythonVersion ) As %Status
1720{
1821 set tSc = $$$OK
19- $$$ThrowOnError(##class (IOP.Utils ).RegisterComponent (pModule , pRemoteClassname , pCLASSPATHS , pFullpath , pOverwrite , pProxyClassname ))
22+ $$$ThrowOnError(##class (IOP.Utils ).RegisterComponent (pModule , pRemoteClassname , pCLASSPATHS , pFullpath , pOverwrite , pProxyClassname , pPythonLib , pPythonPath , pPythonVersion ))
2023 return tSc
2124}
2225
26+ ClassMethod SetPythonSettings (
27+ pPythonLib As %String = " " ,
28+ pPythonPath As %String = " " ,
29+ pPythonVersion As %String = " " ) As %Status
30+ {
31+ #dim tSC As %Status = $$$OK
32+ #dim ex As %Exception.AbstractException
33+
34+ Try {
35+ Do ##class (IOP.Common ).SetPythonSettings (pPythonLib , pPythonPath , pPythonVersion )
36+ } Catch ex {
37+ Set tSC = ex .AsStatus ()
38+ }
39+
40+ Quit tSC
41+ }
42+
2343/// "bo","Duplex","/irisdev/app/src/python/demo/duplex/",1,"Duplex.Duplex"
2444ClassMethod RegisterComponent (
2545 pModule As %String ,
2646 pRemoteClassname As %String ,
2747 pCLASSPATHS As %String = " " ,
2848 pFullpath As %String = " " ,
2949 pOverwrite As %Boolean = 0 ,
30- pProxyClassname As %String = " " ) As %Status
50+ pProxyClassname As %String = " " ,
51+ pPythonLib ,
52+ pPythonPath ,
53+ pPythonVersion ) As %Status
3154{
3255 #dim tSC As %Status = $$$OK
3356 #dim ex As %Exception.AbstractException
@@ -39,6 +62,9 @@ ClassMethod RegisterComponent(
3962 Quit :(" " =pModule ) $$$ERROR($$$EnsErrGeneral," Must specify the module of the remote code." )
4063
4164 Try {
65+ LOCK +^PythonSettings :10
66+ // Set the Python settings
67+ $$$ThrowOnError(##class (IOP.Utils ).SetPythonSettings (pPythonLib , pPythonPath , pPythonVersion ))
4268
4369 $$$ThrowOnError(..GetRemoteClassInfo (pRemoteClassname ,pModule ,pCLASSPATHS ,pFullpath ,.tClassDetails ,.tRemoteSettings ))
4470
@@ -47,13 +73,13 @@ ClassMethod RegisterComponent(
4773 Set tConnectionSettings (" Classname" ) = pRemoteClassname
4874 Set :(" " =pProxyClassname ) pProxyClassname = " User." _pRemoteClassname
4975
50- $$$ThrowOnError(..GenerateProxyClass (pProxyClassname ,.tConnectionSettings ,tClassDetails ,tRemoteSettings ,pOverwrite ))
76+ $$$ThrowOnError(..GenerateProxyClass (pProxyClassname ,.tConnectionSettings ,tClassDetails ,tRemoteSettings ,pOverwrite , pPythonLib , pPythonPath , pPythonVersion ))
5177
5278 } Catch ex {
5379 set msg = $System .Status .GetOneStatusText (ex .AsStatus (),1 )
5480 set tSC = $$$ERROR($$$EnsErrGeneral,msg )
5581 }
56-
82+ LOCK - PythonSettings
5783 Quit tSC
5884}
5985
@@ -165,7 +191,10 @@ ClassMethod GenerateProxyClass(
165191 ByRef pConnectionSettings ,
166192 pClassDetails As %String = " " ,
167193 pRemoteSettings As %String = " " ,
168- pOverwrite As %Boolean = 0 ) As %Status [ Internal , Private ]
194+ pOverwrite As %Boolean = 0 ,
195+ pPythonLib ,
196+ pPythonPath ,
197+ pPythonVersion ) As %Status [ Internal , Private ]
169198{
170199 #dim tSC As %Status = $$$OK
171200 #dim ex As %Exception.AbstractException
@@ -226,7 +255,9 @@ ClassMethod GenerateProxyClass(
226255 }
227256
228257 #; Do not display any of the connection settings
229- #dim tSETTINGSParamValue As %String = " %classname:Python $type,%module:Python $type,%settings:Python $type,%classpaths:Python $type,%enable:Python Debug $type,%timeout:Python Debug $type,%port:Python Debug $type,%PythonInterpreterPath:Python Debug $type,%traceback:Python Debug $type"
258+ #dim tSETTINGSParamValue As %String = " %classname:Python $type,%module:Python $type,%settings:Python $type,%classpaths:Python $type"
259+ set tSETTINGSParamValue = tSETTINGSParamValue _" ," _" %enable:Python Debug $type,%timeout:Python Debug $type,%port:Python Debug $type,%PythonInterpreterPath:Python Debug $type,%traceback:Python Debug $type"
260+ set tSETTINGSParamValue = tSETTINGSParamValue _" ," _" %PythonPath:Python Settings $type,%PythonRuntimeLibrary:Python Settings $type,%PythonRuntimeLibraryVersion:Python Settings $type"
230261
231262 #dim tPropClassname As %Dictionary.PropertyDefinition = ##class (%Dictionary.PropertyDefinition ).%New ()
232263 Set tPropClassname .Name = " %classname"
@@ -255,6 +286,38 @@ ClassMethod GenerateProxyClass(
255286 Set tPropLanguage .InitialExpression = $$$quote(pConnectionSettings (" Module" ))
256287 Set tSC = tCOSClass .Properties .Insert (tPropLanguage )
257288 Quit :$$$ISERR(tSC )
289+
290+ if pPythonLib '=" " {
291+ #dim tPropPythonLib As %Dictionary.PropertyDefinition = ##class (%Dictionary.PropertyDefinition ).%New ()
292+ Set tPropPythonLib .Name = " %PythonRuntimeLibrary"
293+ Set tPropPythonLib .Type = " %String"
294+ Set tPropPythonLib .Internal = 1
295+ Set tSC = tPropPythonLib .Parameters .SetAt (" " ," MAXLEN" )
296+ Quit :$$$ISERR(tSC )
297+ Set tPropPythonLib .InitialExpression = $$$quote(pPythonLib )
298+ Set tSC = tCOSClass .Properties .Insert (tPropPythonLib )
299+ Quit :$$$ISERR(tSC )
300+ }
301+ if pPythonPath '=" " {
302+ #dim tPropPythonPath As %Dictionary.PropertyDefinition = ##class (%Dictionary.PropertyDefinition ).%New ()
303+ Set tPropPythonPath .Name = " %PythonPath"
304+ Set tPropPythonPath .Type = " %String"
305+ Set tSC = tPropPythonPath .Parameters .SetAt (" " ," MAXLEN" )
306+ Quit :$$$ISERR(tSC )
307+ Set tPropPythonPath .Internal = 1
308+ Set tPropPythonPath .InitialExpression = $$$quote(pPythonPath )
309+ Set tSC = tCOSClass .Properties .Insert (tPropPythonPath )
310+ Quit :$$$ISERR(tSC )
311+ }
312+ if pPythonVersion '=" " {
313+ #dim tPropPythonVersion As %Dictionary.PropertyDefinition = ##class (%Dictionary.PropertyDefinition ).%New ()
314+ Set tPropPythonVersion .Name = " %PythonRuntimeLibraryVersion"
315+ Set tPropPythonVersion .Type = " %String"
316+ Set tPropPythonVersion .Internal = 1
317+ Set tPropPythonVersion .InitialExpression = $$$quote(pPythonVersion )
318+ Set tSC = tCOSClass .Properties .Insert (tPropPythonVersion )
319+ Quit :$$$ISERR(tSC )
320+ }
258321
259322 If $Case (tSuperClass ," IOP.BusinessService" :1 ," IOP.BusinessOperation" :1 ," IOP.DuplexService" :1 ," IOP.DuplexOperation" :1 ,:0 ) {
260323 set builtins = ##class (%SYS.Python ).Import (" builtins" )
0 commit comments