Add PYTOHNPATH to modules for python extensions.

This commit is contained in:
Todd Gamblin 2015-01-10 19:52:07 -08:00
parent bcccf02020
commit d13bbeb605

View File

@ -49,6 +49,7 @@
import re import re
import textwrap import textwrap
import shutil import shutil
from glob import glob
from contextlib import closing from contextlib import closing
import llnl.util.tty as tty import llnl.util.tty as tty
@ -123,6 +124,13 @@ def add_path(path_name, directory):
if os.path.isdir(directory): if os.path.isdir(directory):
add_path(var, directory) add_path(var, directory)
# Add python path unless it's an actual python installation
# TODO: is there a better way to do this?
if self.spec.name != 'python':
site_packages = glob(join_path(self.spec.prefix.lib, "python*/site-packages"))
if site_packages:
add_path('PYTHONPATH', site_packages[0])
# short description is just the package + version # short description is just the package + version
# TODO: maybe packages can optionally provide it. # TODO: maybe packages can optionally provide it.
self.short_description = self.spec.format("$_ $@") self.short_description = self.spec.format("$_ $@")