# HG changeset patch # User trinity_ctat # Date 1506447200 14400 # Node ID 98d99fed9d358eb2572be7c6c030453578eef489 # Parent cb71c6b0bf66fe23562e6db6ac63a7ac57a3dbde Strip eol off of TrinityPath, so os.path.islink() works correctly. diff -r cb71c6b0bf66 -r 98d99fed9d35 trinityToolWrapper.py --- a/trinityToolWrapper.py Tue Sep 26 11:48:19 2017 -0400 +++ b/trinityToolWrapper.py Tue Sep 26 13:33:20 2017 -0400 @@ -16,7 +16,7 @@ TRINITY_BASE_DIR = "" if os.environ.has_key('TRINITY_HOME'): TRINITY_BASE_DIR = os.environ['TRINITY_HOME']; -else: +elif hasattr(os, 'symlink'): # symlink was implemented to always return false when it was not implemented in earlier versions. # 2017-09-26 # Cicada Dennis added looking for the location of the Trinity program using the Unix "which" utility. # I tried using "command -v Trinity" but for some reason, I was getting a OS permission error with that. @@ -32,8 +32,16 @@ # FIX - probably should be checking err_info for errors... # Determine the TRINITY_BASE_DIR from output1. # If TrinityPath is a link, we need to dereference the link. + TrinityPath = TrinityPath.rstrip() # Need to strip off a newline. + # print "Trinity that was found is: {:s}".format(repr(TrinityPath)) + # print os.path.islink(TrinityPath) + TrinityPath = os.path.abspath(TrinityPath) + print "The Absolute Trinity path that was found is: {:s}".format(TrinityPath) + # print os.path.islink(TrinityPath) while os.path.islink(TrinityPath): + print "That path is a link." TrinityPath = os.path.join(os.path.dirname(TrinityPath),os.readlink(TrinityPath)) + print "The new path is: {:s}".format(TrinityPath) # Take off the last part of the path (which is the Trinity command) TRINITY_BASE_DIR = "/".join(TrinityPath.split("/")[0:-1]) @@ -70,11 +78,13 @@ # If one needs to silence stdout #args.append( ">" ) #args.append( "/dev/null" ) + print "The TRINITY_BASE_DIR is:\n\t{:s}".format(TRINITY_BASE_DIR) args[0] = "".join([TRINITY_BASE_DIR, '/', args[0]]); cmdline = " ".join(args) + print "The command being invoked is:\n\t{:s}".format(cmdline) try: