Skip to content

Commit

Permalink
reset LD_LIBRARY_PATH when calling external programs
Browse files Browse the repository at this point in the history
  • Loading branch information
davidemms committed Nov 25, 2016
1 parent cbacdb5 commit 692122e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
11 changes: 9 additions & 2 deletions orthofinder/orthofinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,17 @@
with open(os.devnull, "w") as f:
subprocess.call("taskset -p 0xffffffffffff %d" % os.getpid(), shell=True, stdout=f) # get round problem with python multiprocessing library that can set all cpu affinities to a single cpu

# Fix LD_LIBRARY_PATH when using pyinstaller
my_env = os.environ.copy()
if getattr(sys, 'frozen', False):
# my_env['LD_LIBRARY_PATH'] = my_env['LD_LIBRARY_PATH_ORIG']
my_env['LD_LIBRARY_PATH'] = ''
if 'LD_LIBRARY_PATH_ORIG' in my_env:
my_env['LD_LIBRARY_PATH'] = my_env['LD_LIBRARY_PATH_ORIG']
else:
my_env['LD_LIBRARY_PATH'] = ''
if 'DYLD_LIBRARY_PATH_ORIG' in my_env:
my_env['DYLD_LIBRARY_PATH'] = my_env['DYLD_LIBRARY_PATH_ORIG']
else:
my_env['DYLD_LIBRARY_PATH'] = ''

def RunBlastDBCommand(command):
capture = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=my_env)
Expand Down
12 changes: 10 additions & 2 deletions orthofinder/scripts/get_orthologues.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,18 @@
import blast_file_processor as BlastFileProcessor

nThreads = util.nThreadsDefault

# Fix LD_LIBRARY_PATH when using pyinstaller
my_env = os.environ.copy()
if getattr(sys, 'frozen', False):
# my_env['LD_LIBRARY_PATH'] = my_env['LD_LIBRARY_PATH_ORIG']
my_env['LD_LIBRARY_PATH'] = ''
if 'LD_LIBRARY_PATH_ORIG' in my_env:
my_env['LD_LIBRARY_PATH'] = my_env['LD_LIBRARY_PATH_ORIG']
else:
my_env['LD_LIBRARY_PATH'] = ''
if 'DYLD_LIBRARY_PATH_ORIG' in my_env:
my_env['DYLD_LIBRARY_PATH'] = my_env['DYLD_LIBRARY_PATH_ORIG']
else:
my_env['DYLD_LIBRARY_PATH'] = ''

class Seq(object):
def __init__(self, seqInput):
Expand Down
11 changes: 9 additions & 2 deletions orthofinder/scripts/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,17 @@
picProtocol = 1
version = "1.1.2"

# Fix LD_LIBRARY_PATH when using pyinstaller
my_env = os.environ.copy()
if getattr(sys, 'frozen', False):
# my_env['LD_LIBRARY_PATH'] = my_env['LD_LIBRARY_PATH_ORIG']
my_env['LD_LIBRARY_PATH'] = ""
if 'LD_LIBRARY_PATH_ORIG' in my_env:
my_env['LD_LIBRARY_PATH'] = my_env['LD_LIBRARY_PATH_ORIG']
else:
my_env['LD_LIBRARY_PATH'] = ''
if 'DYLD_LIBRARY_PATH_ORIG' in my_env:
my_env['DYLD_LIBRARY_PATH'] = my_env['DYLD_LIBRARY_PATH_ORIG']
else:
my_env['DYLD_LIBRARY_PATH'] = ''

def PrintNoNewLine(text):
sys.stdout.write(text)
Expand Down

0 comments on commit 692122e

Please sign in to comment.