SitePackagesDir returns the relative path from prefix to site-packages. e.g. "lib/python3.10/site-packages" on Linux, "Lib/site-packages" on Windows.
()
| 377 | // SitePackagesDir returns the relative path from prefix to site-packages. |
| 378 | // e.g. "lib/python3.10/site-packages" on Linux, "Lib/site-packages" on Windows. |
| 379 | func (p pythonTool) SitePackagesDir() string { |
| 380 | if runtime.GOOS == "windows" { |
| 381 | return filepath.Join("Lib", "site-packages") |
| 382 | } |
| 383 | |
| 384 | minorVersion := p.version |
| 385 | if strings.Count(p.version, ".") > 1 { |
| 386 | parts := strings.Split(p.version, ".") |
| 387 | minorVersion = parts[0] + "." + parts[1] |
| 388 | } |
| 389 | |
| 390 | return filepath.Join("lib", "python"+minorVersion, "site-packages") |
| 391 | } |
| 392 | |
| 393 | // RegisterExprVars registers all Python-related expression variables. |
| 394 | func (p pythonTool) RegisterExprVars(exprVars *context.ExprVars) { |