Addon Manager: use versioned Python package dirs

This commit is contained in:
Chris Hennes
2022-11-01 17:02:20 -05:00
parent 30c76a6f34
commit 48307b91f5
5 changed files with 181 additions and 25 deletions

View File

@@ -339,11 +339,20 @@ def get_python_exe() -> str:
if not python_exe or not os.path.exists(python_exe):
return ""
python_exe = python_exe.replace("/",os.path.sep)
python_exe = python_exe.replace("/", os.path.sep)
prefs.SetString("PythonExecutableForPip", python_exe)
return python_exe
def get_pip_target_directory():
# Get the default location to install new pip packages
major, minor, _ = platform.python_version_tuple()
vendor_path = os.path.join(
FreeCAD.getUserAppDataDir(), "AdditionalPythonPackages", f"py{major}{minor}"
)
return vendor_path
def get_cache_file_name(file: str) -> str:
"""Get the full path to a cache file with a given name."""
cache_path = FreeCAD.getUserCachePath()