iris-pex-embedded-python 3.1.1b4__py3-none-any.whl → 3.1.1b5__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
@@ -176,7 +176,7 @@ class _Utils():
176
176
  return module
177
177
 
178
178
  @staticmethod
179
- def migrate(filename=None,root_path=None):
179
+ def migrate(filename=None):
180
180
  """
181
181
  Read the settings.py file and register all the components
182
182
  settings.py file has two dictionaries:
@@ -188,17 +188,23 @@ class _Utils():
188
188
  * key: the name of the production
189
189
  * value: a dictionary containing the settings for the production
190
190
  """
191
- try:
192
- # if the filename is not provided
193
- if filename is None:
194
- settings = importlib.import_module('settings')
191
+ path = None
192
+ # try to load the settings file
193
+ if filename:
194
+ # check if the filename is absolute or relative
195
+ if os.path.isabs(filename):
196
+ path = os.path.dirname(filename)
195
197
  else:
196
- # import the settings file
197
- settings = _Utils.import_module_from_path('settings',filename)
198
- # get the path of the settings file
199
- path = os.path.dirname(inspect.getfile(settings))
200
- except ModuleNotFoundError as e:
201
- raise ModuleNotFoundError("settings.py not found") from e
198
+ raise ValueError("The filename must be absolute")
199
+ # add the path to the system path to the beginning
200
+ sys.path.insert(0,os.path.normpath(path))
201
+ # import settings from the specified file
202
+ settings = _Utils.import_module_from_path('settings',filename)
203
+ else:
204
+ # import settings from the settings module
205
+ import settings
206
+ # get the path of the settings file
207
+ path = os.path.dirname(inspect.getfile(settings))
202
208
  try:
203
209
  # set the classes settings
204
210
  _Utils.set_classes_settings(settings.CLASSES,path)
@@ -209,15 +215,17 @@ class _Utils():
209
215
  _Utils.set_productions_settings(settings.PRODUCTIONS,path)
210
216
  except AttributeError:
211
217
  print("No productions to register")
218
+ try:
219
+ # remove the path from the system path (with or without the trailing slash)
220
+ sys.path.remove(path+'/')
221
+ sys.path.remove(path)
222
+ except ValueError:
223
+ pass
212
224
 
213
225
  @staticmethod
214
226
  def import_module_from_path(module_name, file_path):
215
227
  if not os.path.isabs(file_path):
216
- file_path = os.path.abspath(file_path)
217
- # check is a file is persent at the path
218
- if not os.path.isfile(file_path):
219
- # append settings.py to the path
220
- file_path = os.path.join(file_path,'settings.py')
228
+ raise ValueError("The file path must be absolute")
221
229
 
222
230
  spec = importlib.util.spec_from_file_location(module_name, file_path)
223
231
  if spec is None:
@@ -225,6 +233,7 @@ class _Utils():
225
233
 
226
234
  module = importlib.util.module_from_spec(spec)
227
235
  sys.modules[module_name] = module
236
+ spec.loader.exec_module(module)
228
237
  return module
229
238
 
230
239
  @staticmethod
iop/cls/IOP/Utils.cls CHANGED
@@ -104,12 +104,10 @@ ClassMethod GetRemoteClassInfo(
104
104
  pModule As %String,
105
105
  pClasspaths As %String,
106
106
  ByRef pClassDetails,
107
- ByRef pRemoteSettings) As %Status [ Internal, Private ]
107
+ ByRef pRemoteSettings) As %Status [ Internal ]
108
108
  {
109
109
  #dim tSC As %Status = $$$OK
110
110
  #dim ex As %Exception.AbstractException
111
- #dim tGateway As %External.Gateway
112
- #dim tGatewayProxy As %Net.Remote.Object
113
111
 
114
112
  Try {
115
113
  if pClasspaths '="" {
@@ -120,14 +118,19 @@ ClassMethod GetRemoteClassInfo(
120
118
  set onePath = $p(extraClasspaths,"|",i)
121
119
  set onePath = ##class(%File).NormalizeDirectory(onePath)
122
120
  if onePath?1"$$IRISHOME"1P.E set onePath = $e($system.Util.InstallDirectory(),1,*-1)_$e(onePath,11,*)
123
- if onePath'="" && '$FIND(sys.path,onePath) do sys.path.insert(0, onePath)
121
+ if onePath'="" do ##class(IOP.Common).SetPythonPath(onePath)
124
122
  }
125
123
  }
126
- ;
127
124
 
128
125
  set importlib = ##class(%SYS.Python).Import("importlib")
129
126
  set builtins = ##class(%SYS.Python).Import("builtins")
130
- set module = importlib."import_module"(pModule)
127
+ set sys = ##class(%SYS.Python).Import("sys")
128
+ // Load the module form a specific path
129
+ set spec = importlib.util."spec_from_file_location"(pModule, onePath_pModule_".py")
130
+ set module = importlib.util."module_from_spec"(spec)
131
+ do sys.modules."__setitem__"(pModule, module)
132
+ do spec.loader."exec_module"(module)
133
+ // Get the class
131
134
  set class = builtins.getattr(module, pRemoteClassname)
132
135
  set tClass = class."__new__"(class)
133
136
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iris_pex_embedded_python
3
- Version: 3.1.1b4
3
+ Version: 3.1.1b5
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=dXrPfBIpS7dz2Zvui0em_1QaSDIxbg1kbcULHdnI6zY,16992
108
+ iop/_utils.py,sha256=-s1i_bZlmrcXm732A3VjzRNaZWf6vVT31v04-gMmNDQ,17291
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=9T4KR0Botlf45WgnNOJodHDF3djcy0Ow3MTy5_q_KeM,13788
119
+ iop/cls/IOP/Utils.cls,sha256=UgSEH2gqiNKYK_NAc2QUXF0A0VXHK-vbwWsHplHV2T8,13994
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.1b4.dist-info/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
139
- iris_pex_embedded_python-3.1.1b4.dist-info/METADATA,sha256=HUeMihLWadeBDPUQn_2bP6IuIB9dsGQlwlY0hhwCaws,49479
140
- iris_pex_embedded_python-3.1.1b4.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
141
- iris_pex_embedded_python-3.1.1b4.dist-info/entry_points.txt,sha256=pj-i4LSDyiSP6xpHlVjMCbg1Pik7dC3_sdGY3Yp9Vhk,38
142
- iris_pex_embedded_python-3.1.1b4.dist-info/top_level.txt,sha256=jkWtvFKOp1Q-uO_VpGpfx5TcW7DS39z1liOAVp6zLig,47
143
- iris_pex_embedded_python-3.1.1b4.dist-info/RECORD,,
138
+ iris_pex_embedded_python-3.1.1b5.dist-info/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
139
+ iris_pex_embedded_python-3.1.1b5.dist-info/METADATA,sha256=GzBu0XnguRuxK2p5an6oGvofByiY5ZQBQdLiBFD1vSc,49479
140
+ iris_pex_embedded_python-3.1.1b5.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
141
+ iris_pex_embedded_python-3.1.1b5.dist-info/entry_points.txt,sha256=pj-i4LSDyiSP6xpHlVjMCbg1Pik7dC3_sdGY3Yp9Vhk,38
142
+ iris_pex_embedded_python-3.1.1b5.dist-info/top_level.txt,sha256=jkWtvFKOp1Q-uO_VpGpfx5TcW7DS39z1liOAVp6zLig,47
143
+ iris_pex_embedded_python-3.1.1b5.dist-info/RECORD,,