File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
src/poetry/utils/env/python Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ import contextlib
34import dataclasses
45import shutil
56import sysconfig
1213from findpython .providers .path import PathProvider
1314
1415from poetry .config .config import Config
16+ from poetry .toml import TOMLFile
1517from poetry .utils ._compat import WINDOWS
1618
1719
@@ -43,7 +45,19 @@ def find_python_by_name(cls, name: str) -> findpython.PythonVersion | None:
4345class PoetryPythonPathProvider (PathProvider ): # type: ignore[misc]
4446 @classmethod
4547 def base_installation_dir (cls ) -> Path :
46- return Config .create ().python_installation_dir
48+ from poetry .factory import Factory
49+
50+ config = Config .create ()
51+
52+ # Let's check if there is a local config file.
53+ with contextlib .suppress (RuntimeError ):
54+ pyproject = Factory .locate ()
55+
56+ local_config_file = TOMLFile (pyproject .parent / "poetry.toml" )
57+ if local_config_file .exists ():
58+ config .merge (local_config_file .read ())
59+
60+ return config .python_installation_dir
4761
4862 @classmethod
4963 def installation_dir (cls , version : Version , implementation : str ) -> Path :
You can’t perform that action at this time.
0 commit comments