Returns a list containing all global site-packages directories. For each directory present in ``prefixes`` (or the global ``PREFIXES``), this function will find its `site-packages` subdirectory depending on the system environment, and will return a list of full paths.
(prefixes=None)
| 354 | return known_paths |
| 355 | |
| 356 | def getsitepackages(prefixes=None): |
| 357 | """Returns a list containing all global site-packages directories. |
| 358 | |
| 359 | For each directory present in ``prefixes`` (or the global ``PREFIXES``), |
| 360 | this function will find its `site-packages` subdirectory depending on the |
| 361 | system environment, and will return a list of full paths. |
| 362 | """ |
| 363 | sitepackages = [] |
| 364 | seen = set() |
| 365 | |
| 366 | if prefixes is None: |
| 367 | prefixes = PREFIXES |
| 368 | |
| 369 | for prefix in prefixes: |
| 370 | if not prefix or prefix in seen: |
| 371 | continue |
| 372 | seen.add(prefix) |
| 373 | |
| 374 | if os.sep == '/': |
| 375 | libdirs = [sys.platlibdir] |
| 376 | if sys.platlibdir != "lib": |
| 377 | libdirs.append("lib") |
| 378 | |
| 379 | for libdir in libdirs: |
| 380 | path = os.path.join(prefix, libdir, |
| 381 | "python%d.%d" % sys.version_info[:2], |
| 382 | "site-packages") |
| 383 | sitepackages.append(path) |
| 384 | else: |
| 385 | sitepackages.append(prefix) |
| 386 | sitepackages.append(os.path.join(prefix, "Lib", "site-packages")) |
| 387 | return sitepackages |
| 388 | |
| 389 | def addsitepackages(known_paths, prefixes=None): |
| 390 | """Add site-packages to sys.path""" |
no test coverage detected