Skip to content

Commit 0ee3bcd

Browse files
authored
further which patching for py312 (#329)
* Update importing.py * Update importing.py * Update changelog.rst
1 parent b49b318 commit 0ee3bcd

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

docs/changelog.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Changelog
22
=========
33

4-
.. X.Y.0 / 2023-MM-DD
4+
.. X.Y.0 / 2023-MM-DD (Unreleased)
55
.. -------------------
66
..
77
.. Breaking Changes
@@ -20,6 +20,15 @@ Changelog
2020
.. +++++
2121
2222
23+
0.27.1 / 2023-10-26 (Unreleased)
24+
-------------------
25+
26+
Bug Fixes
27+
+++++++++
28+
- (:pr:`329`) Continues :pr:`328` adding ``util.which`` workaround for only python v3.12.0 and psi4
29+
(can be expanded) to correctly select among cmd, cmd.bat, cmd.exe.
30+
31+
2332
0.27.0 / 2023-10-24
2433
-------------------
2534

qcelemental/util/importing.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,14 @@ def which(
9999
lenv = {"PATH": os.pathsep.join([os.path.abspath(x) for x in env.split(os.pathsep) if x != ""])}
100100
lenv = {k: v for k, v in lenv.items() if v is not None}
101101

102+
ans = shutil.which(command, mode=os.F_OK | os.X_OK, path=lenv["PATH"])
103+
102104
if sys.platform == "win32" and sys.version_info >= (3, 12, 0) and sys.version_info < (3, 12, 1):
103105
# https://github.com/python/cpython/issues/109590
104106
if command == "psi4":
105-
command = "psi4.bat"
106-
107-
ans = shutil.which(command, mode=os.F_OK | os.X_OK, path=lenv["PATH"])
107+
ans = shutil.which("psi4.exe", mode=os.F_OK | os.X_OK, path=lenv["PATH"])
108+
if ans is None:
109+
ans = shutil.which("psi4.bat", mode=os.F_OK | os.X_OK, path=lenv["PATH"])
108110

109111
# secondary check, see https://github.com/MolSSI/QCEngine/issues/292
110112
local_raise_msg = ""

0 commit comments

Comments
 (0)