foamlib 0.3.13__py3-none-any.whl → 0.3.15__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.
foamlib/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """A Python interface for interacting with OpenFOAM."""
2
2
 
3
- __version__ = "0.3.13"
3
+ __version__ = "0.3.15"
4
4
 
5
5
  from ._cases import AsyncFoamCase, FoamCase, FoamCaseBase
6
6
  from ._files import FoamDict, FoamFieldFile, FoamFile
foamlib/_cases/_base.py CHANGED
@@ -183,12 +183,17 @@ class FoamCaseBase(Sequence["FoamCaseBase.TimeDirectory"]):
183
183
  all_clean = self.path / "Allclean"
184
184
 
185
185
  if clean.is_file():
186
- return clean
186
+ script = clean
187
187
  elif all_clean.is_file():
188
- return all_clean
188
+ script = all_clean
189
189
  else:
190
190
  return None
191
191
 
192
+ if sys.argv and Path(sys.argv[0]).absolute() == script.absolute():
193
+ return None
194
+
195
+ return script if Path(sys.argv[0]).absolute() != script.absolute() else None
196
+
192
197
  def _run_script(self, *, parallel: Optional[bool] = None) -> Optional[Path]:
193
198
  """Return the path to the (All)run script, or None if no run script is found."""
194
199
  run = self.path / "run"
@@ -199,21 +204,29 @@ class FoamCaseBase(Sequence["FoamCaseBase.TimeDirectory"]):
199
204
  if run.is_file() or all_run.is_file():
200
205
  if run_parallel.is_file() or all_run_parallel.is_file():
201
206
  if parallel:
202
- return run_parallel if run_parallel.is_file() else all_run_parallel
207
+ script = (
208
+ run_parallel if run_parallel.is_file() else all_run_parallel
209
+ )
203
210
  elif parallel is False:
204
- return run if run.is_file() else all_run
211
+ script = run if run.is_file() else all_run
205
212
  else:
206
213
  raise ValueError(
207
214
  "Both (All)run and (All)run-parallel scripts are present. Please specify parallel argument."
208
215
  )
209
- return run if run.is_file() else all_run
216
+ else:
217
+ script = run if run.is_file() else all_run
210
218
  elif parallel is not False and (
211
219
  run_parallel.is_file() or all_run_parallel.is_file()
212
220
  ):
213
- return run_parallel if run_parallel.is_file() else all_run_parallel
221
+ script = run_parallel if run_parallel.is_file() else all_run_parallel
214
222
  else:
215
223
  return None
216
224
 
225
+ if sys.argv and Path(sys.argv[0]).absolute() == script.absolute():
226
+ return None
227
+
228
+ return script
229
+
217
230
  def _run_cmds(
218
231
  self,
219
232
  cmd: Optional[Union[Sequence[Union[str, Path]], str, Path]] = None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foamlib
3
- Version: 0.3.13
3
+ Version: 0.3.15
4
4
  Summary: A Python interface for interacting with OpenFOAM
5
5
  Author-email: "Gabriel S. Gerlero" <ggerlero@cimec.unl.edu.ar>
6
6
  Project-URL: Homepage, https://github.com/gerlero/foamlib
@@ -1,9 +1,9 @@
1
- foamlib/__init__.py,sha256=aBzAnZKo5gyHjgjZ7PgMavAtG4_K_jDpMvYEE3Y23BA,432
1
+ foamlib/__init__.py,sha256=5PbwXABaXN8V_siZG54FSPFSLIJSvruHaJARRAfLFtA,432
2
2
  foamlib/_util.py,sha256=vL03aAzpWdZyYIhe2WTxHiz9b4lnttVnRuzqUmZvXXk,3047
3
3
  foamlib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  foamlib/_cases/__init__.py,sha256=4bHQRLtYh0IBOuuCSwUbipZEPqIF0sypU2xtoc6YW3c,166
5
5
  foamlib/_cases/_async.py,sha256=Rfbq3rerYZdt4lX7YxnStj4LSqwH2j0rAmbPkSDHhP0,4995
6
- foamlib/_cases/_base.py,sha256=jHgZAR1z7pZHPC0XTDTNXVfTJ8BKFv_ESYwUz2NPzWw,11416
6
+ foamlib/_cases/_base.py,sha256=6_zkF_TjKrwhsTZvqhmpaHQPVHIgZqmUfG5-9PV6gg4,11807
7
7
  foamlib/_cases/_sync.py,sha256=irMprDmcvjvdIj82griGhXvDU_L9UnyAbyJjS74Z3ug,3961
8
8
  foamlib/_files/__init__.py,sha256=vDkPj8u8bX_I_m2YfeKvXBgwg8D1ufyFCfHGHKN3JPQ,140
9
9
  foamlib/_files/_base.py,sha256=YA5a-i5HZuA3JslCD6r-DwZzpSA8r42dqSXef286Ako,2050
@@ -11,8 +11,8 @@ foamlib/_files/_files.py,sha256=4rZb3HMJADmJBGmRpChiujJNX1UIxhgHI5YPEmEOWvE,1078
11
11
  foamlib/_files/_io.py,sha256=pGYMoLI5Dz2Y90EB1CtklZiffpDTGuQbbbkyqRe0JAo,2115
12
12
  foamlib/_files/_parsing.py,sha256=-IgvCOFMAERNOrpw2NaHtVXubBg4Ey6xR55bzEZb2B4,7696
13
13
  foamlib/_files/_serialization.py,sha256=LCeaLWtNvkcs0dfowL7nViiByxw7U_fvgueVjFliipU,3462
14
- foamlib-0.3.13.dist-info/LICENSE.txt,sha256=5Dte9TUnLZzPRs4NQzl-Jc2-Ljd-t_v0ZR5Ng5r0UsY,35131
15
- foamlib-0.3.13.dist-info/METADATA,sha256=0EHpmOiX23zVIjv_CZYBLonPn4Ja_-BGBUUaR8RxiIY,5458
16
- foamlib-0.3.13.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
17
- foamlib-0.3.13.dist-info/top_level.txt,sha256=ZdVYtetXGwPwyfL-WhlhbTFQGAwKX5P_gXxtH9JYFPI,8
18
- foamlib-0.3.13.dist-info/RECORD,,
14
+ foamlib-0.3.15.dist-info/LICENSE.txt,sha256=5Dte9TUnLZzPRs4NQzl-Jc2-Ljd-t_v0ZR5Ng5r0UsY,35131
15
+ foamlib-0.3.15.dist-info/METADATA,sha256=VuGlrLKuyEexC-hzQVVLfzyM06kan66Aro_U_hPIs3c,5458
16
+ foamlib-0.3.15.dist-info/WHEEL,sha256=nCVcAvsfA9TDtwGwhYaRrlPhTLV9m-Ga6mdyDtuwK18,91
17
+ foamlib-0.3.15.dist-info/top_level.txt,sha256=ZdVYtetXGwPwyfL-WhlhbTFQGAwKX5P_gXxtH9JYFPI,8
18
+ foamlib-0.3.15.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (72.2.0)
2
+ Generator: setuptools (73.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5