Skip to content

Commit 62c02fe

Browse files
committed
Fix typo and formatting
Put comments before switching logic for consistency with the code base.
1 parent feed411 commit 62c02fe

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

khiops/core/internals/runner.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -957,16 +957,16 @@ def __init__(self):
957957
def _initialize_khiops_environment(self):
958958
installation_method = _infer_khiops_installation_method()
959959
match installation_method:
960+
# In conda-based environments, khiops_env is not in PATH;
961+
# its location must be inferred from the conda env directory.
960962
case "conda-based":
961-
# In conda-based environments, khiops_env is not in PATH;
962-
# its location must be inferred from the conda env directory.
963963
khiops_env_path = os.path.join(
964964
_infer_env_bin_dir_for_conda_based_installations(), "khiops_env"
965965
)
966966
if platform.system() == "Windows":
967967
khiops_env_path += ".cmd"
968+
# In an activated conda environment, khiops_env is in PATH.
968969
case "conda":
969-
# In an activated conda environment, khiops_env is in PATH.
970970
khiops_env_path = self._infer_khiops_env_from_path(installation_method)
971971
case "pip":
972972
# Ensure the binary dependency is still installed.
@@ -978,14 +978,15 @@ def _initialize_khiops_environment(self):
978978
"Re-install the Khiops Python library to automatically install "
979979
"Khiops. Go to https://khiops.org for more information.\n"
980980
) from exc
981+
# On Windows, determine the Scripts directory where pip placed
982+
# khiops_env.cmd.
983+
# If this library is installed under the user site-packages
984+
# directory, khiops-core (and its khiops_env.cmd) was also installed
985+
# there with `pip install --user`, so use the user Scripts directory.
986+
# Otherwise use the standard Scripts directory (venv or system-wide
987+
# install). This avoids an ambiguous search and mirrors how pip
988+
# resolves scripts.
981989
if platform.system() == "Windows":
982-
# Determine the Scripts directory where pip placed khiops_env.cmd.
983-
# If this library is installed under the user site-packages
984-
# directory, khiops-core (and its khiops_env.cmd) was also installed
985-
# there with`pip install --user`, so use the user Scripts directory.
986-
# Otherwise use the standard Scripts directory (venv or system-wide
987-
# install). This avoids an ambiguous search and mirrors how pip
988-
# resolves scripts.
989990
library_root_dir_path = Path(__file__).parents[2]
990991
user_site_packages_path = Path(site.getusersitepackages())
991992
if library_root_dir_path.is_relative_to(user_site_packages_path):
@@ -999,9 +1000,9 @@ def _initialize_khiops_environment(self):
9991000
"Make sure you have installed Khiops properly. "
10001001
"Go to https://khiops.org for more information."
10011002
)
1003+
# On UNIX, pip places khiops_env in the bin directory,
1004+
# which is in PATH.
10021005
else:
1003-
# On UNIX, pip places khiops_env in the bin directory,
1004-
# which is in PATH.
10051006
khiops_env_path = self._infer_khiops_env_from_path(
10061007
installation_method
10071008
)

0 commit comments

Comments
 (0)