details: http://www.bx.psu.edu/hg/galaxy/rev/b400212305b6 changeset: 3161:b400212305b6 user: Nate Coraor <nate@bx.psu.edu> date: Wed Dec 09 10:15:15 2009 -0500 description: Fix libdrmaa runtime link path on OS X diffstat: scripts/scramble/scripts/DRMAA_python-macosx.py | 60 ++++++++++++++++++++++++++++++ 1 files changed, 60 insertions(+), 0 deletions(-) diffs (64 lines): diff -r 47b702c583a3 -r b400212305b6 scripts/scramble/scripts/DRMAA_python-macosx.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/scramble/scripts/DRMAA_python-macosx.py Wed Dec 09 10:15:15 2009 -0500 @@ -0,0 +1,60 @@ +import os, sys, shutil + +if "SGE_ROOT" not in os.environ: + print "scramble(): Please set SGE_ROOT to the path of your SGE installation" + print "scramble(): before scrambling DRMAA_python" + sys.exit(1) + +# change back to the build dir +if os.path.dirname( sys.argv[0] ) != "": + os.chdir( os.path.dirname( sys.argv[0] ) ) + +# find setuptools +scramble_lib = os.path.join( "..", "..", "..", "lib" ) +sys.path.append( scramble_lib ) +import get_platform # fixes fat python 2.5 +try: + from setuptools import * + import pkg_resources +except: + from ez_setup import use_setuptools + use_setuptools( download_delay=8, to_dir=scramble_lib ) + from setuptools import * + import pkg_resources + +# clean, in case you're running this by hand from a dirty module source dir +for dir in [ "build", "dist", "gridengine" ]: + if os.access( dir, os.F_OK ): + print "scramble_it.py: removing dir:", dir + shutil.rmtree( dir ) + +# patch +file = "setup.py" +print "scramble(): Patching", file +if not os.access( "%s.orig" %file, os.F_OK ): + shutil.copyfile( file, "%s.orig" %file ) +i = open( "%s.orig" %file, "r" ) +o = open( file, "w" ) +for line in i.readlines(): + if line == 'SGE6_ROOT="/scratch_test02/SGE6"\n': + line = 'SGE6_ROOT="%s"\n' % os.environ["SGE_ROOT"] + if line.startswith('link_args ='): + line = 'link_args = [ "-L%s" % os.path.join(SGE6_ROOT, "lib", SGE6_ARCH), "-ldrmaa" ]\n' + print >>o, line, +i.close() +o.close() + +# go +me = sys.argv[0] +sys.argv = [ me ] +sys.argv.append( "build" ) +execfile( "setup.py", globals(), locals() ) + +# fix _cDRMAA.so rpath +so = "build/lib.%s-%s/_cDRMAA.so" % ( pkg_resources.get_platform(), sys.version[:3] ) +libdrmaa = os.path.join(SGE6_ROOT, "lib", SGE6_ARCH, "libdrmaa.dylib.1.0" ) +os.system( "install_name_tool -change libdrmaa.dylib.1.0 %s %s" % ( libdrmaa, so ) ) + +sys.argv = [ me ] +sys.argv.append( "bdist_egg" ) +execfile( "setup.py", globals(), locals() )