@@ -11,11 +11,12 @@ ClassMethod dispatchRegisterComponent(
1111 pModule As %String ,
1212 pRemoteClassname As %String ,
1313 pCLASSPATHS As %String = " " ,
14+ pFullpath As %String = " " ,
1415 pOverwrite As %Boolean = 0 ,
1516 pProxyClassname As %String = " " ) As %Status
1617{
1718 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 ))
1920 return tSc
2021}
2122
@@ -24,6 +25,7 @@ ClassMethod RegisterComponent(
2425 pModule As %String ,
2526 pRemoteClassname As %String ,
2627 pCLASSPATHS As %String = " " ,
28+ pFullpath As %String = " " ,
2729 pOverwrite As %Boolean = 0 ,
2830 pProxyClassname As %String = " " ) As %Status
2931{
@@ -38,7 +40,7 @@ ClassMethod RegisterComponent(
3840
3941 Try {
4042
41- $$$ThrowOnError(..GetRemoteClassInfo (pRemoteClassname ,pModule ,pCLASSPATHS ,.tClassDetails ,.tRemoteSettings ))
43+ $$$ThrowOnError(..GetRemoteClassInfo (pRemoteClassname ,pModule ,pCLASSPATHS ,pFullpath , .tClassDetails ,.tRemoteSettings ))
4244
4345 Set tConnectionSettings (" Classpaths" ) = pCLASSPATHS
4446 Set tConnectionSettings (" Module" ) = pModule
@@ -103,6 +105,7 @@ ClassMethod GetRemoteClassInfo(
103105 pRemoteClassname As %String ,
104106 pModule As %String ,
105107 pClasspaths As %String ,
108+ pFullpath As %String = " " ,
106109 ByRef pClassDetails ,
107110 ByRef pRemoteSettings ) As %Status [ Internal ]
108111{
@@ -124,18 +127,15 @@ ClassMethod GetRemoteClassInfo(
124127
125128 set importlib = ##class (%SYS.Python ).Import (" importlib" )
126129 set builtins = ##class (%SYS.Python ).Import (" builtins" )
127- set sys = ##class (%SYS.Python ).Import (" sys" )
128- set os = ##class (%SYS.Python ).Import (" os" )
129130 // Load the module form a specific path
130- // Guess the full path to the module
131- set path = ..GuessFullPath (pModule , onePath )
132131 Try {
133- set spec = importlib .util ." spec_from_file_location" (pModule , path )
132+ set spec = importlib .util ." spec_from_file_location" (pModule , pFullpath )
134133 set module = importlib .util ." module_from_spec" (spec )
135134 do sys .modules ." __setitem__" (pModule , module )
136135 do spec .loader ." exec_module" (module )
137136 }
138137 Catch ex {
138+ // If the module is not found, try to import the frist one found
139139 set module = importlib ." import_module" (pModule )
140140 }
141141
@@ -160,21 +160,6 @@ ClassMethod GetRemoteClassInfo(
160160 Quit tSC
161161}
162162
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-
178163ClassMethod GenerateProxyClass (
179164 pClassname As %String ,
180165 ByRef pConnectionSettings ,
0 commit comments