4
Map the .data/ subdirectory names to install paths.
9
import distutils.dist as dist
10
import distutils.command.install as install
12
def get_install_command(name):
13
# late binding due to potential monkeypatching
14
d = dist.Distribution({'name':name})
15
i = install.install(d)
19
def get_install_paths(name):
21
Return the (distutils) install paths for the named dist.
23
A dict with ('purelib', 'platlib', 'headers', 'scripts', 'data') keys.
27
i = get_install_command(name)
29
for key in install.SCHEME_KEYS:
30
paths[key] = getattr(i, 'install_' + key)
32
# pip uses a similar path as an alternative to the system's (read-only)
34
if hasattr(sys, 'real_prefix'): # virtualenv
35
paths['headers'] = os.path.join(sys.prefix,
38
'python' + sys.version[:3],