Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move code that handles LSST_LIBRARY_PATH from tests to utils #10

Merged
merged 1 commit into from
Jan 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 3 additions & 10 deletions python/lsst/sconsUtils/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,9 @@ def run(self, fileGlob):

(should_pass, passedMsg, should_fail, failedMsg) = self.messages(f)

libpathstr = ""

# If we have an OS X with System Integrity Protection enabled or similar we need
# to pass through DYLD_LIBRARY_PATH to the test execution layer.
pass_through_var = utils.libraryPathPassThrough()
if pass_through_var is not None:
for varname in (pass_through_var, "LSST_LIBRARY_PATH"):
if varname in os.environ:
libpathstr = '{}="{}"'.format(pass_through_var, os.environ[varname])
break
# Determine any library load path values that we have to prepend
# to the command.
libpathstr = utils.libraryLoaderEnvironment()

# The TRAVIS environment variable is set to allow us to disable
# the matplotlib font cache. See ticket DM-3856.
Expand Down
16 changes: 16 additions & 0 deletions python/lsst/sconsUtils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
##

from __future__ import absolute_import, division, print_function
import os
import sys
import warnings
import subprocess
Expand Down Expand Up @@ -78,6 +79,21 @@ def libraryPathPassThrough():
def needShebangRewrite():
return _has_OSX_SIP()

##
# @brief Returns library loader path environment string to be prepended to external commands
# Will be "" if nothing is required.
##
def libraryLoaderEnvironment():
libpathstr = ""
# If we have an OS X with System Integrity Protection enabled or similar we need
# to pass through DYLD_LIBRARY_PATH to the external command.
pass_through_var = libraryPathPassThrough()
if pass_through_var is not None:
for varname in (pass_through_var, "LSST_LIBRARY_PATH"):
if varname in os.environ:
libpathstr = '{}="{}"'.format(pass_through_var, os.environ[varname])
break
return libpathstr

##
# @brief Safe wrapper for running external programs, reading stdout, and sanitizing error messages.
Expand Down