iris-pex-embedded-python 3.1.2__py3-none-any.whl → 3.1.3__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.

iop/_utils.py CHANGED
@@ -51,8 +51,9 @@ class _Utils():
51
51
  :return: The return value is a string.
52
52
  """
53
53
  path = os.path.abspath(os.path.normpath(path))
54
+ fullpath = _Utils.guess_path(module,path)
54
55
  try:
55
- iris.cls('IOP.Utils').dispatchRegisterComponent(module,classname,path,overwrite,iris_classname)
56
+ iris.cls('IOP.Utils').dispatchRegisterComponent(module,classname,path,fullpath,overwrite,iris_classname)
56
57
  except RuntimeError as e:
57
58
  # New message error : Make sure the iop package is installed in iris
58
59
  raise RuntimeError("Iris class : IOP.Utils not found. Make sure the iop package is installed in iris eg: iop --init.") from e
@@ -395,4 +396,26 @@ class _Utils():
395
396
  chunks = [string[i:i+n] for i in range(0, len(string), n)]
396
397
  for chunk in chunks:
397
398
  stream.Write(chunk)
398
- return stream
399
+ return stream
400
+
401
+ @staticmethod
402
+ def guess_path(module,path):
403
+ if "." in module:
404
+ if module.startswith("."):
405
+ # count the number of dots at the beginning of the module name
406
+ dots = 0
407
+ for c in module:
408
+ if c == ".":
409
+ dots += 1
410
+ else:
411
+ break
412
+ # remove the dots from the beginning of the module name
413
+ module = module[dots:]
414
+ # go to the parent directory dots times
415
+ for i in range(dots)-1:
416
+ path = os.path.dirname(path)
417
+ return os.path.join(path, module.replace(".", os.sep) + ".py")
418
+ else:
419
+ return os.path.join(path, module.replace(".", os.sep) + ".py")
420
+ else:
421
+ return os.path.join(path, module + ".py")
iop/cls/IOP/Utils.cls CHANGED
@@ -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,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iris_pex_embedded_python
3
- Version: 3.1.2
3
+ Version: 3.1.3
4
4
  Summary: Iris Interoperability based on Embedded Python
5
5
  Author-email: grongier <guillaume.rongier@intersystems.com>
6
6
  License: MIT License
@@ -105,7 +105,7 @@ iop/_outbound_adapter.py,sha256=YTAhLrRf9chEAd53mV6KKbpaHOKNOKJHoGgj5wakRR0,726
105
105
  iop/_pickle_message.py,sha256=noKfc2VkXufV3fqjKvNHN_oANQ1YN9ffCaSV0XSTAIE,331
106
106
  iop/_private_session_duplex.py,sha256=klzWKwRRBoKUSz85D3DNYuCpDcZe_kWLNCWq5JtR0yc,5044
107
107
  iop/_private_session_process.py,sha256=pGjWFOQhWpQxUVpTtvNKTPvDxgzjfw0VC4Aqj3KUq8w,1704
108
- iop/_utils.py,sha256=UYfBINcrwK9Uh3sfd8xA46RzGE8N5rmGz6wLhHnxExE,17165
108
+ iop/_utils.py,sha256=b1vFnAXbcNV4uN9zojIeSeLgr0CuSt9bBgguZra0ve8,18105
109
109
  iop/cls/IOP/BusinessOperation.cls,sha256=lrymqZ8wHl5kJjXwdjbQVs5sScV__yIWGh-oGbiB_X0,914
110
110
  iop/cls/IOP/BusinessProcess.cls,sha256=s3t38w1ykHqM26ETcbCYLt0ocjZyVVahm-_USZkuJ1E,2855
111
111
  iop/cls/IOP/BusinessService.cls,sha256=7ebn32J9PiZXUgXuh5Xxm_7X6zHBiqkJr9c_dWxbPO8,1021
@@ -116,7 +116,7 @@ iop/cls/IOP/Message.cls,sha256=n0r0FslXdDfPcHIiAlW7n596DDsDSNlTX8UTPaMnSV8,9911
116
116
  iop/cls/IOP/OutboundAdapter.cls,sha256=9eOwy5ojwcTzwrHs6LNrFQvUD8aqcoNCZrILN1ycdDM,958
117
117
  iop/cls/IOP/PickleMessage.cls,sha256=S3y7AClQ8mAILjxPuHdCjGosBZYzGbUQ5WTv4mYPNMQ,1673
118
118
  iop/cls/IOP/Test.cls,sha256=gAC9PEfMZsvAEWIa241-ug2FWAhITbN1SOispZzJPnI,2094
119
- iop/cls/IOP/Utils.cls,sha256=1fkb3ff-FhRRx5nIqPUzj7sndlo0ptHfOvMoC4bw0eY,14073
119
+ iop/cls/IOP/Utils.cls,sha256=ZTBr02spm4ppxVBfhnUwb08BmhTjG5-ZbItRshYHs1I,13746
120
120
  iop/cls/IOP/Duplex/Operation.cls,sha256=K_fmgeLjPZQbHgNrc0kd6DUQoW0fDn1VHQjJxHo95Zk,525
121
121
  iop/cls/IOP/Duplex/Process.cls,sha256=xbefZ4z84a_IUhavWN6P_gZBzqkdJ5XRTXxro6iDvAg,6986
122
122
  iop/cls/IOP/Duplex/Service.cls,sha256=sTMOQUCMBgVitmQkM8bbsrmrRtCdj91VlctJ3I7b8WU,161
@@ -135,9 +135,9 @@ iris/iris_ipm.pyi,sha256=j7CNUZcjeDu5sgeWUZJO_Qi4vQmHh6aD-jPWv8OdoUs,374
135
135
  iris/iris_utils.py,sha256=kg80O3yRpHIutM-mCyr4xCeTvKWPE-Kai-b6Dxw4vQ4,9882
136
136
  irisnative/_IRISNative.py,sha256=HQ4nBhc8t8_5OtxdMG-kx1aa-T1znf2I8obZOPLOPzg,665
137
137
  irisnative/__init__.py,sha256=6YmvBLQSURsCPKaNg7LK-xpo4ipDjrlhKuwdfdNb3Kg,341
138
- iris_pex_embedded_python-3.1.2.dist-info/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
139
- iris_pex_embedded_python-3.1.2.dist-info/METADATA,sha256=Kx_H2-6EMcf6mzT3B-eHL2uI3VByXxlssESfquC7u1M,50120
140
- iris_pex_embedded_python-3.1.2.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
141
- iris_pex_embedded_python-3.1.2.dist-info/entry_points.txt,sha256=pj-i4LSDyiSP6xpHlVjMCbg1Pik7dC3_sdGY3Yp9Vhk,38
142
- iris_pex_embedded_python-3.1.2.dist-info/top_level.txt,sha256=jkWtvFKOp1Q-uO_VpGpfx5TcW7DS39z1liOAVp6zLig,47
143
- iris_pex_embedded_python-3.1.2.dist-info/RECORD,,
138
+ iris_pex_embedded_python-3.1.3.dist-info/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
139
+ iris_pex_embedded_python-3.1.3.dist-info/METADATA,sha256=tOAb3jq9OHmTL3V9-G8pqf-BqQyFh5GlMsTzRdkcFpA,50120
140
+ iris_pex_embedded_python-3.1.3.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
141
+ iris_pex_embedded_python-3.1.3.dist-info/entry_points.txt,sha256=pj-i4LSDyiSP6xpHlVjMCbg1Pik7dC3_sdGY3Yp9Vhk,38
142
+ iris_pex_embedded_python-3.1.3.dist-info/top_level.txt,sha256=jkWtvFKOp1Q-uO_VpGpfx5TcW7DS39z1liOAVp6zLig,47
143
+ iris_pex_embedded_python-3.1.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.2)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5