File tree 1 file changed +1
-32
lines changed
1 file changed +1
-32
lines changed Original file line number Diff line number Diff line change 5
5
from importlib .abc import MetaPathFinder
6
6
from importlib .metadata import Distribution
7
7
from importlib .util import spec_from_loader
8
+ from site import getsitepackages
8
9
import itertools
9
10
import os
10
11
import re
13
14
import tempfile
14
15
import zipfile
15
16
16
-
17
- try :
18
- from site import getsitepackages
19
- except :
20
- def getsitepackages (prefixes = [sys .prefix , sys .exec_prefix ]):
21
- """Returns a list containing all global site-packages directories.
22
-
23
- For each directory present in ``prefixes`` (or the global ``PREFIXES``),
24
- this function will find its `site-packages` subdirectory depending on the
25
- system environment, and will return a list of full paths.
26
- """
27
- sitepackages = []
28
- seen = set ()
29
-
30
- if prefixes is None :
31
- prefixes = PREFIXES
32
-
33
- for prefix in prefixes :
34
- if not prefix or prefix in seen :
35
- continue
36
- seen .add (prefix )
37
-
38
- if os .sep == '/' :
39
- sitepackages .append (os .path .join (prefix , "lib" ,
40
- "python%d.%d" % sys .version_info [:2 ],
41
- "site-packages" ))
42
- else :
43
- sitepackages .append (prefix )
44
- sitepackages .append (os .path .join (prefix , "lib" , "site-packages" ))
45
-
46
- return sitepackages
47
-
48
17
# Put this pex on the path before anything else.
49
18
PEX = os .path .abspath (sys .argv [0 ])
50
19
# This might get overridden down the line if the pex isn't zip-safe.
You can’t perform that action at this time.
0 commit comments