iris-pex-embedded-python 3.5.1b1__py3-none-any.whl → 3.5.1b2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of iris-pex-embedded-python might be problematic. Click here for more details.

@@ -7,13 +7,13 @@ Class IOP.BusinessOperation Extends (Ens.BusinessOperation, IOP.Common) [ Inheri
7
7
 
8
8
  Parameter SETTINGS = "%classname:Python BusinessOperation,%module:Python BusinessOperation,%settings:Python BusinessOperation,%classpaths:Python BusinessOperation";
9
9
 
10
- Method OnMessage(
11
- request As %Library.Persistent,
12
- Output response As %Library.Persistent) As %Status
10
+ Method MessageHandler(
11
+ pRequest As %Library.Persistent,
12
+ Output pResponse As %Library.Persistent) As %Status
13
13
  {
14
14
  set tSC = $$$OK
15
15
  try {
16
- set response = ..%class."_dispatch_on_message"(request)
16
+ set pResponse = ..%class."_dispatch_on_message"(pRequest)
17
17
  } catch ex {
18
18
  set tSC = ..DisplayTraceback(ex)
19
19
  }
iop/cls/IOP/Common.cls CHANGED
@@ -104,7 +104,6 @@ Method OnInit() As %Status
104
104
  set tSC = $$$OK
105
105
 
106
106
  try {
107
- LOCK +^PythonSettings:5
108
107
 
109
108
  if ..%Venv {
110
109
  $$$ThrowOnError(##class(IOP.Utils).SetPythonSettings(..%PythonRuntimeLibrary, ..%PythonPath, ..%PythonRuntimeLibraryVersion))
@@ -115,7 +114,6 @@ Method OnInit() As %Status
115
114
  do $system.Python.Debugging(..%traceback)
116
115
 
117
116
  $$$ThrowOnError(..Connect())
118
- LOCK -^PythonSettings
119
117
 
120
118
  do ..%class."_debugpy"($this)
121
119
 
@@ -124,7 +122,7 @@ Method OnInit() As %Status
124
122
 
125
123
  set tSC = ..DisplayTraceback(ex)
126
124
  }
127
- LOCK -^PythonSettings
125
+
128
126
  quit tSC
129
127
  }
130
128
 
@@ -147,18 +145,19 @@ ClassMethod SetPythonPath(pClasspaths)
147
145
  {
148
146
  set sys = ##class(%SYS.Python).Import("sys")
149
147
 
150
- for i=0:1:(sys.path."__len__"()-1) {
151
- Try {
152
- if sys.path."__getitem__"(i) = pClasspaths {
153
- do sys.path."__delitem__"(i)
154
- }
155
- }
156
- Catch ex {
157
- // do nothing
148
+ // Add the classpaths to the Python sys.path only if they are not already present
149
+ // Check if the path is already in sys.path
150
+ set found = 0
151
+ for j=1:1:sys.path."__len__"() {
152
+ if sys.path."__getitem__"(j-1) = pClasspaths {
153
+ set found = 1
154
+ quit
158
155
  }
159
-
160
156
  }
161
- do sys.path.insert(0, pClasspaths)
157
+ if found = 0 {
158
+ // If not found, add to sys.path
159
+ do sys.path."append"(pClasspaths)
160
+ }
162
161
  }
163
162
 
164
163
  Method Connect() As %Status
@@ -167,24 +166,39 @@ Method Connect() As %Status
167
166
  try {
168
167
 
169
168
  set container = $this
170
-
171
- //set classpass
172
- if ..%classpaths '="" {
173
- set delimiter = $s($system.Version.GetOS()="Windows":";",1:":")
174
- set extraClasspaths = $tr(container.%classpaths,delimiter,"|")
175
- for i=1:1:$l(extraClasspaths,"|") {
176
- set onePath = $p(extraClasspaths,"|",i)
177
- set onePath = ##class(%File).NormalizeDirectory(onePath)
178
- do ..SetPythonPath(onePath)
179
- }
180
- }
181
- if $isObject(..%class)=0 {
182
- set importlib = ##class(%SYS.Python).Import("importlib")
169
+
170
+ // Before anything, try to check if the module is already present in the sys.modules
171
+ set sys = ##class(%SYS.Python).Import("sys")
172
+ set moduleName = ..%module
173
+ set module = sys.modules.get(moduleName, $$$NULLOREF)
174
+ if $isObject(module) {
175
+ $$$LOGINFO("Module "_moduleName_" is already imported in sys.modules")
176
+ // If the module is already present, we can skip the import
183
177
  set builtins = ##class(%SYS.Python).Import("builtins")
184
- set module = importlib."import_module"(..%module)
185
178
  set class = builtins.getattr(module, ..%classname)
186
179
  set ..%class = class."__new__"(class)
187
180
  }
181
+ else {
182
+
183
+ //set classpass
184
+ if ..%classpaths '="" {
185
+ set delimiter = $s($system.Version.GetOS()="Windows":";",1:":")
186
+ set extraClasspaths = $tr(container.%classpaths,delimiter,"|")
187
+ for i=1:1:$l(extraClasspaths,"|") {
188
+ set onePath = $p(extraClasspaths,"|",i)
189
+ set onePath = ##class(%File).NormalizeDirectory(onePath)
190
+ do ..SetPythonPath(onePath)
191
+ }
192
+ }
193
+
194
+ if $isObject(..%class)=0 {
195
+ set builtins = ##class(%SYS.Python).Import("builtins")
196
+ set module = ##class(%SYS.Python).Import(..%module)
197
+ set class = builtins.getattr(module, ..%classname)
198
+ set ..%class = class."__new__"(class)
199
+ }
200
+ }
201
+
188
202
  ;
189
203
  if ..%Extends("IOP.InboundAdapter") || ..%Extends("IOP.OutboundAdapter") {
190
204
  do ..%class."_set_iris_handles"($this,..BusinessHost)
@@ -352,9 +366,9 @@ ClassMethod OnGetConnections(
352
366
  if onePath'="" do sys.path.append(onePath)
353
367
  }
354
368
  }
355
- set importlib = ##class(%SYS.Python).Import("importlib")
369
+
356
370
  set builtins = ##class(%SYS.Python).Import("builtins")
357
- set module = importlib."import_module"(tModule)
371
+ set module = ##class(%SYS.Python).Import(tModule)
358
372
  set class = builtins.getattr(module, tClassname)
359
373
  set tClass = class."__new__"(class)
360
374
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iris_pex_embedded_python
3
- Version: 3.5.1b1
3
+ Version: 3.5.1b2
4
4
  Summary: Iris Interoperability based on Embedded Python
5
5
  Author-email: grongier <guillaume.rongier@intersystems.com>
6
6
  License: MIT License
@@ -51,10 +51,10 @@ iop/_private_session_duplex.py,sha256=c6Q0k-qnZi_JcIOdpUx1Edu44zVbUE2Kf2aCHM8Eq8
51
51
  iop/_private_session_process.py,sha256=rvZFO6nWVwZtaEWJkSHyLTV-vhzDqQhsVi7INQLLwWI,1685
52
52
  iop/_serialization.py,sha256=C9-88bb6vC8A4ugQ3QqjahAbv7NjAD2sZy8_D-X0Ois,7721
53
53
  iop/_utils.py,sha256=yAvssj3O3p9mLVJ_RvDIuawyYNhOIm5WrK0SANaSIwU,21256
54
- iop/cls/IOP/BusinessOperation.cls,sha256=E4rnujZi3QFd3uLtZ5YjLiMU_FWoN1gkBe19kxmYO34,932
54
+ iop/cls/IOP/BusinessOperation.cls,sha256=td4tFxy9KbZ6u5QEr9xCuCNjcqEJavdeYHErNrt-szk,941
55
55
  iop/cls/IOP/BusinessProcess.cls,sha256=XJxzbiV0xokzRm-iI2Be5UIJLE3MlXr7W3WS_LkOCYs,3363
56
56
  iop/cls/IOP/BusinessService.cls,sha256=fplKrbQgA7cQgjKIqDR2IK2iD1iNHmT-QvWrozhE4n4,1189
57
- iop/cls/IOP/Common.cls,sha256=lRnvXarMTyHWgtqtQjF84mAtYYPViiem-m5riB-RYZw,17149
57
+ iop/cls/IOP/Common.cls,sha256=GsFrrWY732-2Hzu5iiRS1C2Am_w2oDZmv-ZYa4Zeqy8,17769
58
58
  iop/cls/IOP/Director.cls,sha256=M43LoTb6lwSr0J81RFxi1YLW1mwda09wQ7Xqr3nBtxo,2008
59
59
  iop/cls/IOP/InboundAdapter.cls,sha256=H-gZfUy8M9YxAZXfp5HVYl3uLo-7Xg9YgojioB_eYMY,619
60
60
  iop/cls/IOP/Message.cls,sha256=6_iZzQaY0cA9FjXg0qECYZC6We8soAIrUwRBrlerC4w,25373
@@ -78,9 +78,9 @@ iop/cls/IOP/PrivateSession/Message/Start.cls,sha256=RsJLrhglrONBDGT0RqW2K9MDXa98
78
78
  iop/cls/IOP/PrivateSession/Message/Stop.cls,sha256=7g3gKFUjNg0WXBLuWnj-VnCs5G6hSE09YTzGEp0zbGc,1390
79
79
  iop/cls/IOP/Service/WSGI.cls,sha256=VLNCXEwmHW9dBnE51uGE1nvGX6T4HjhqePT3LVhsjAE,10440
80
80
  iop/wsgi/handlers.py,sha256=NrFLo_YbAh-x_PlWhAiWkQnUUN2Ss9HoEm63dDWCBpQ,2947
81
- iris_pex_embedded_python-3.5.1b1.dist-info/licenses/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
82
- iris_pex_embedded_python-3.5.1b1.dist-info/METADATA,sha256=0JwhOA7L2CteIK4EfvFBiEFR3rS6tDO1QAyuHJi77wk,4415
83
- iris_pex_embedded_python-3.5.1b1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
84
- iris_pex_embedded_python-3.5.1b1.dist-info/entry_points.txt,sha256=pj-i4LSDyiSP6xpHlVjMCbg1Pik7dC3_sdGY3Yp9Vhk,38
85
- iris_pex_embedded_python-3.5.1b1.dist-info/top_level.txt,sha256=4p0q6hCATmYIVMVi3I8hOUcJE1kwzyBeHygWv_rGvrU,13
86
- iris_pex_embedded_python-3.5.1b1.dist-info/RECORD,,
81
+ iris_pex_embedded_python-3.5.1b2.dist-info/licenses/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
82
+ iris_pex_embedded_python-3.5.1b2.dist-info/METADATA,sha256=80F-3Ci14m0KlmqHejgX3iYgi_gk6fjLx5adBUfQE34,4415
83
+ iris_pex_embedded_python-3.5.1b2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
84
+ iris_pex_embedded_python-3.5.1b2.dist-info/entry_points.txt,sha256=pj-i4LSDyiSP6xpHlVjMCbg1Pik7dC3_sdGY3Yp9Vhk,38
85
+ iris_pex_embedded_python-3.5.1b2.dist-info/top_level.txt,sha256=4p0q6hCATmYIVMVi3I8hOUcJE1kwzyBeHygWv_rGvrU,13
86
+ iris_pex_embedded_python-3.5.1b2.dist-info/RECORD,,