MCPcopy Create free account
hub / github.com/MrNeRF/LichtFeld-Studio / site_packages_dir

Method site_packages_dir

src/python/package_manager.cpp:366–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364 }
365
366 std::filesystem::path PackageManager::site_packages_dir() const {
367#ifdef _WIN32
368 return m_venv_dir / "Lib" / "site-packages";
369#else
370 const auto lib_dir = m_venv_dir / "lib";
371 if (std::filesystem::exists(lib_dir)) {
372 std::filesystem::path best_match;
373 for (const auto& entry : std::filesystem::directory_iterator(lib_dir)) {
374 if (entry.is_directory()) {
375 const auto name = entry.path().filename().string();
376 // Prefer pythonX.Y over pythonX (more specific version)
377 if (name.find("python") == 0) {
378 if (best_match.empty() || name.length() > best_match.filename().string().length()) {
379 best_match = entry.path();
380 }
381 }
382 }
383 }
384 if (!best_match.empty())
385 return best_match / "site-packages";
386 }
387 return m_venv_dir / "lib" / "python3" / "site-packages";
388#endif
389 }
390
391 InstallResult PackageManager::execute_uv(const std::vector<std::string>& args) const {
392 const auto uv = uv_path();

Callers 4

run_plugin_commandFunction · 0.80
get_user_packages_dirFunction · 0.80
register_packagesFunction · 0.80

Calls 4

stringMethod · 0.80
lengthMethod · 0.80
findMethod · 0.45
emptyMethod · 0.45

Tested by 1