@@ -11,11 +11,12 @@ ClassMethod dispatchRegisterComponent(
11
11
pModule As %String ,
12
12
pRemoteClassname As %String ,
13
13
pCLASSPATHS As %String = " " ,
14
+ pFullpath As %String = " " ,
14
15
pOverwrite As %Boolean = 0 ,
15
16
pProxyClassname As %String = " " ) As %Status
16
17
{
17
18
set tSc = $$$OK
18
- $$$ThrowOnError(##class (IOP.Utils ).RegisterComponent (pModule , pRemoteClassname , pCLASSPATHS , pOverwrite , pProxyClassname ))
19
+ $$$ThrowOnError(##class (IOP.Utils ).RegisterComponent (pModule , pRemoteClassname , pCLASSPATHS , pFullpath , pOverwrite , pProxyClassname ))
19
20
return tSc
20
21
}
21
22
@@ -24,6 +25,7 @@ ClassMethod RegisterComponent(
24
25
pModule As %String ,
25
26
pRemoteClassname As %String ,
26
27
pCLASSPATHS As %String = " " ,
28
+ pFullpath As %String = " " ,
27
29
pOverwrite As %Boolean = 0 ,
28
30
pProxyClassname As %String = " " ) As %Status
29
31
{
@@ -38,7 +40,7 @@ ClassMethod RegisterComponent(
38
40
39
41
Try {
40
42
41
- $$$ThrowOnError(..GetRemoteClassInfo (pRemoteClassname ,pModule ,pCLASSPATHS ,.tClassDetails ,.tRemoteSettings ))
43
+ $$$ThrowOnError(..GetRemoteClassInfo (pRemoteClassname ,pModule ,pCLASSPATHS ,pFullpath , .tClassDetails ,.tRemoteSettings ))
42
44
43
45
Set tConnectionSettings (" Classpaths" ) = pCLASSPATHS
44
46
Set tConnectionSettings (" Module" ) = pModule
@@ -103,6 +105,7 @@ ClassMethod GetRemoteClassInfo(
103
105
pRemoteClassname As %String ,
104
106
pModule As %String ,
105
107
pClasspaths As %String ,
108
+ pFullpath As %String = " " ,
106
109
ByRef pClassDetails ,
107
110
ByRef pRemoteSettings ) As %Status [ Internal ]
108
111
{
@@ -124,18 +127,15 @@ ClassMethod GetRemoteClassInfo(
124
127
125
128
set importlib = ##class (%SYS.Python ).Import (" importlib" )
126
129
set builtins = ##class (%SYS.Python ).Import (" builtins" )
127
- set sys = ##class (%SYS.Python ).Import (" sys" )
128
- set os = ##class (%SYS.Python ).Import (" os" )
129
130
// Load the module form a specific path
130
- // Guess the full path to the module
131
- set path = ..GuessFullPath (pModule , onePath )
132
131
Try {
133
- set spec = importlib .util ." spec_from_file_location" (pModule , path )
132
+ set spec = importlib .util ." spec_from_file_location" (pModule , pFullpath )
134
133
set module = importlib .util ." module_from_spec" (spec )
135
134
do sys .modules ." __setitem__" (pModule , module )
136
135
do spec .loader ." exec_module" (module )
137
136
}
138
137
Catch ex {
138
+ // If the module is not found, try to import the frist one found
139
139
set module = importlib ." import_module" (pModule )
140
140
}
141
141
@@ -160,21 +160,6 @@ ClassMethod GetRemoteClassInfo(
160
160
Quit tSC
161
161
}
162
162
163
- ClassMethod GuessFullPath (
164
- module As %String ,
165
- path As %String ) As %String
166
- {
167
- If $Find (module , " ." ) {
168
- Set module = $Piece (module , " ." , *)
169
- }
170
- If $Find (path , module ) {
171
- Set path = $Piece (path , module , 1 )
172
- }
173
- // append the module to the path
174
- Set path = path _ module _ " .py"
175
- Return path
176
- }
177
-
178
163
ClassMethod GenerateProxyClass (
179
164
pClassname As %String ,
180
165
ByRef pConnectionSettings ,
0 commit comments