Skip to content

Commit

Permalink
MINIFICPP-2425 Prioritize virtualenv packages over system packages in…
Browse files Browse the repository at this point in the history
… python processors
  • Loading branch information
lordgamez committed Jul 2, 2024
1 parent 35a8b2a commit 017b0c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion extensions/python/PythonDependencyInstaller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void PythonDependencyInstaller::addVirtualenvToPath() const {
if (!std::filesystem::exists(site_package_path)) {
throw PythonScriptException("Could not find python site package path: " + site_package_path.string());
}
evalScript("import sys\nsys.path.append(r'" + site_package_path.string() + "')");
evalScript("import sys\nsys.path.insert(0, r'" + site_package_path.string() + "')");
}
}

Expand Down
4 changes: 2 additions & 2 deletions extensions/python/PythonScriptEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ void PythonScriptEngine::evaluateModuleImports() {

for (const auto& module_path : module_paths_) {
if (std::filesystem::is_regular_file(module_path)) {
evalInternal("sys.path.append(r'" + module_path.parent_path().string() + "')");
evalInternal("sys.path.insert(0, r'" + module_path.parent_path().string() + "')");
} else {
evalInternal("sys.path.append(r'" + module_path.string() + "')");
evalInternal("sys.path.insert(0, r'" + module_path.string() + "')");
}
}
}
Expand Down

0 comments on commit 017b0c7

Please sign in to comment.