@@ -13,21 +13,44 @@ ClassMethod dispatchRegisterComponent(
13
13
pCLASSPATHS As %String = " " ,
14
14
pFullpath As %String = " " ,
15
15
pOverwrite As %Boolean = 0 ,
16
- pProxyClassname As %String = " " ) As %Status
16
+ pProxyClassname As %String = " " ,
17
+ pPythonLib ,
18
+ pPythonPath ,
19
+ pPythonVersion ) As %Status
17
20
{
18
21
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 ))
20
23
return tSc
21
24
}
22
25
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
+
23
43
/// "bo","Duplex","/irisdev/app/src/python/demo/duplex/",1,"Duplex.Duplex"
24
44
ClassMethod RegisterComponent (
25
45
pModule As %String ,
26
46
pRemoteClassname As %String ,
27
47
pCLASSPATHS As %String = " " ,
28
48
pFullpath As %String = " " ,
29
49
pOverwrite As %Boolean = 0 ,
30
- pProxyClassname As %String = " " ) As %Status
50
+ pProxyClassname As %String = " " ,
51
+ pPythonLib ,
52
+ pPythonPath ,
53
+ pPythonVersion ) As %Status
31
54
{
32
55
#dim tSC As %Status = $$$OK
33
56
#dim ex As %Exception.AbstractException
@@ -39,6 +62,9 @@ ClassMethod RegisterComponent(
39
62
Quit :(" " =pModule ) $$$ERROR($$$EnsErrGeneral," Must specify the module of the remote code." )
40
63
41
64
Try {
65
+ LOCK +^PythonSettings :10
66
+ // Set the Python settings
67
+ $$$ThrowOnError(##class (IOP.Utils ).SetPythonSettings (pPythonLib , pPythonPath , pPythonVersion ))
42
68
43
69
$$$ThrowOnError(..GetRemoteClassInfo (pRemoteClassname ,pModule ,pCLASSPATHS ,pFullpath ,.tClassDetails ,.tRemoteSettings ))
44
70
@@ -47,13 +73,13 @@ ClassMethod RegisterComponent(
47
73
Set tConnectionSettings (" Classname" ) = pRemoteClassname
48
74
Set :(" " =pProxyClassname ) pProxyClassname = " User." _pRemoteClassname
49
75
50
- $$$ThrowOnError(..GenerateProxyClass (pProxyClassname ,.tConnectionSettings ,tClassDetails ,tRemoteSettings ,pOverwrite ))
76
+ $$$ThrowOnError(..GenerateProxyClass (pProxyClassname ,.tConnectionSettings ,tClassDetails ,tRemoteSettings ,pOverwrite , pPythonLib , pPythonPath , pPythonVersion ))
51
77
52
78
} Catch ex {
53
79
set msg = $System .Status .GetOneStatusText (ex .AsStatus (),1 )
54
80
set tSC = $$$ERROR($$$EnsErrGeneral,msg )
55
81
}
56
-
82
+ LOCK - PythonSettings
57
83
Quit tSC
58
84
}
59
85
@@ -165,7 +191,10 @@ ClassMethod GenerateProxyClass(
165
191
ByRef pConnectionSettings ,
166
192
pClassDetails As %String = " " ,
167
193
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 ]
169
198
{
170
199
#dim tSC As %Status = $$$OK
171
200
#dim ex As %Exception.AbstractException
@@ -226,7 +255,9 @@ ClassMethod GenerateProxyClass(
226
255
}
227
256
228
257
#; 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"
230
261
231
262
#dim tPropClassname As %Dictionary.PropertyDefinition = ##class (%Dictionary.PropertyDefinition ).%New ()
232
263
Set tPropClassname .Name = " %classname"
@@ -255,6 +286,38 @@ ClassMethod GenerateProxyClass(
255
286
Set tPropLanguage .InitialExpression = $$$quote(pConnectionSettings (" Module" ))
256
287
Set tSC = tCOSClass .Properties .Insert (tPropLanguage )
257
288
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
+ }
258
321
259
322
If $Case (tSuperClass ," IOP.BusinessService" :1 ," IOP.BusinessOperation" :1 ," IOP.DuplexService" :1 ," IOP.DuplexOperation" :1 ,:0 ) {
260
323
set builtins = ##class (%SYS.Python ).Import (" builtins" )
0 commit comments