mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
It doesn't make sense to even distribute DRMAA_python eggs. So instead
of downloading its own SGE and linking, scramble now just links to a user-supplied SGE in $SGE_ROOT. Added a seperate script to make it build right on sparc/x86 32/64 Solaris.
This commit is contained in:
@@ -1,104 +0,0 @@
|
||||
import os, sys, subprocess, tarfile, shutil, urllib2
|
||||
|
||||
def unpack_sge():
|
||||
os.makedirs( "gridengine" )
|
||||
for file in [ SGE_COMMON_ARCHIVE, SGE_BINARY_PPC_ARCHIVE, SGE_BINARY_X86_ARCHIVE ]:
|
||||
if not os.access( file, os.F_OK ):
|
||||
fetch( file )
|
||||
t = tarfile.open( file, "r" )
|
||||
print "unpack_sge() Unpacking:"
|
||||
print " ", file
|
||||
for fn in t.getnames():
|
||||
t.extract( fn, "gridengine" )
|
||||
t.close()
|
||||
|
||||
def lipo():
|
||||
darwin_dir = os.path.join( "gridengine", "lib", "darwin" )
|
||||
os.rename( "%s-ppc" % darwin_dir, "%s-ppc.orig" % darwin_dir )
|
||||
os.rename( "%s-x86" % darwin_dir, "%s-x86.orig" % darwin_dir )
|
||||
os.makedirs( darwin_dir )
|
||||
os.symlink( "darwin", "%s-ppc" % darwin_dir )
|
||||
os.symlink( "darwin", "%s-x86" % darwin_dir )
|
||||
ppc_libdrmaa = os.path.join( "%s-ppc.orig" % darwin_dir, "libdrmaa.dylib.1.0" )
|
||||
x86_libdrmaa = os.path.join( "%s-x86.orig" % darwin_dir, "libdrmaa.dylib.1.0" )
|
||||
fat_libdrmaa = os.path.join( darwin_dir, "libdrmaa.dylib.1.0" )
|
||||
lipo_cmd = "lipo %s %s -create -output %s" % ( ppc_libdrmaa, x86_libdrmaa, fat_libdrmaa )
|
||||
os.symlink( "libdrmaa.dylib.1.0", os.path.join( darwin_dir, "libdrmaa.dylib" ) )
|
||||
p = subprocess.Popen( args = lipo_cmd, shell = True )
|
||||
r = p.wait()
|
||||
if r != 0:
|
||||
print "lipo(): lipo failed"
|
||||
sys.exit( 1 )
|
||||
|
||||
def fetch( file ):
|
||||
url = SGE_BASE_URL + os.path.basename( file )
|
||||
print "fetch(): Fetching:"
|
||||
print " ", url
|
||||
inf = urllib2.urlopen( url )
|
||||
otf = open( file, 'wb' )
|
||||
otf.write( inf.read() )
|
||||
inf.close()
|
||||
otf.close()
|
||||
|
||||
# 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 )
|
||||
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
|
||||
|
||||
# get the tag
|
||||
if os.access( ".galaxy_tag", os.F_OK ):
|
||||
tagfile = open( ".galaxy_tag", "r" )
|
||||
tag = tagfile.readline().strip()
|
||||
else:
|
||||
tag = None
|
||||
|
||||
SGE_VERSION = ( tag.split( "_" ) )[1]
|
||||
SGE_BASE_URL = "http://gridengine.sunsource.net/download/SGE61/"
|
||||
SGE_COMMON_ARCHIVE = os.path.abspath( os.path.join( "..", "..", "..", "archives", "ge-%s-common.tar.gz" %SGE_VERSION ) )
|
||||
SGE_BINARY_PPC_ARCHIVE = os.path.abspath( os.path.join( "..", "..", "..", "archives", "ge-%s-bin-darwin-ppc.tar.gz" % SGE_VERSION ) )
|
||||
SGE_BINARY_X86_ARCHIVE = os.path.abspath( os.path.join( "..", "..", "..", "archives", "ge-%s-bin-darwin-x86.tar.gz" % SGE_VERSION ) )
|
||||
|
||||
# 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 )
|
||||
|
||||
# build/unpack SGE
|
||||
unpack_sge()
|
||||
lipo()
|
||||
|
||||
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="gridengine"\n'
|
||||
print >>o, line,
|
||||
i.close()
|
||||
o.close()
|
||||
|
||||
# tag
|
||||
me = sys.argv[0]
|
||||
sys.argv = [ me ]
|
||||
if tag is not None:
|
||||
sys.argv.append( "egg_info" )
|
||||
sys.argv.append( "--tag-build=%s" %tag )
|
||||
sys.argv.append( "bdist_egg" )
|
||||
|
||||
# go
|
||||
execfile( "setup.py", globals(), locals() )
|
||||
@@ -0,0 +1,81 @@
|
||||
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 )
|
||||
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 )
|
||||
|
||||
# if our python is 64 bit, use 64 bit sge...
|
||||
if sys.maxint < ( 2048 * 1024 * 1024 ):
|
||||
if sys.byteorder == 'big':
|
||||
arch = "sparc"
|
||||
else:
|
||||
arch = "x86"
|
||||
else:
|
||||
if sys.byteorder == 'big':
|
||||
arch = "sparc64"
|
||||
else:
|
||||
arch = "amd64"
|
||||
if not "CFLAGS" in os.environ:
|
||||
os.environ["CFLAGS"] = ""
|
||||
os.environ["CFLAGS"] += " -m64"
|
||||
|
||||
# if we're using sun cc, drop the gcc -Wno-unused option
|
||||
import distutils.sysconfig
|
||||
cc = distutils.sysconfig.get_config_var('CC')
|
||||
if os.popen( cc + ' --version 2>&1' ).read().strip().split('\n')[0].startswith('gcc'):
|
||||
compiler = 'gcc'
|
||||
elif os.popen( cc + ' -V 2>&1' ).read().strip().split('\n')[0].startswith('cc: Sun C'):
|
||||
compiler = 'sun'
|
||||
else:
|
||||
print "scramble(): Unable to determine compiler"
|
||||
sys.exit(1)
|
||||
|
||||
# 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"]
|
||||
elif line.startswith('SGE6_ARCH='):
|
||||
line = 'SGE6_ARCH="sol-%s"\n' % arch
|
||||
elif line.startswith('link_args ='):
|
||||
line = 'link_args = [ "-L%s" % os.path.join(SGE6_ROOT, "lib", SGE6_ARCH), "-Wl,-R%s" % os.path.join(SGE6_ROOT, "lib", SGE6_ARCH), "-ldrmaa" ]\n'
|
||||
if line == " + [ '-Wno-unused' ]\n":
|
||||
if compiler == 'sun':
|
||||
line = " #+ [ '-Wno-unused' ]\n"
|
||||
print >>o, line,
|
||||
i.close()
|
||||
o.close()
|
||||
|
||||
# go
|
||||
me = sys.argv[0]
|
||||
sys.argv = [ me ]
|
||||
sys.argv.append( "bdist_egg" )
|
||||
execfile( "setup.py", globals(), locals() )
|
||||
@@ -1,32 +1,9 @@
|
||||
import os, sys, subprocess, tarfile, shutil, urllib2
|
||||
import os, sys, shutil
|
||||
|
||||
def unpack_sge():
|
||||
os.makedirs( "gridengine" )
|
||||
for file in [ SGE_COMMON_ARCHIVE, SGE_BINARY_ARCHIVE ]:
|
||||
if not os.access( file, os.F_OK ):
|
||||
fetch( file )
|
||||
t = tarfile.open( file, "r" )
|
||||
print "unpack_sge() Unpacking:"
|
||||
print " ", file
|
||||
for fn in t.getnames():
|
||||
t.extract( fn, "gridengine" )
|
||||
t.close()
|
||||
# i doubt you're using a 64 bit python, but if you are, this will break things
|
||||
if arch == "sol-x86":
|
||||
os.symlink( "sol-x86", os.path.join( "gridengine", "lib", "sol-amd64" ) )
|
||||
if arch == "sol-sparc64":
|
||||
os.rename( os.path.join( "gridengine", "lib", "sol-sparc64" ), os.path.join( "gridengine", "lib", "sol-sparc64.orig" ) )
|
||||
os.symlink( "sol-sparc", os.path.join( "gridengine", "lib", "sol-sparc64" ) )
|
||||
|
||||
def fetch( file ):
|
||||
url = SGE_BASE_URL + os.path.basename( file )
|
||||
print "fetch(): Fetching:"
|
||||
print " ", url
|
||||
inf = urllib2.urlopen( url )
|
||||
otf = open( file, 'wb' )
|
||||
otf.write( inf.read() )
|
||||
inf.close()
|
||||
otf.close()
|
||||
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] ) != "":
|
||||
@@ -44,39 +21,13 @@ except:
|
||||
from setuptools import *
|
||||
import pkg_resources
|
||||
|
||||
# get the tag
|
||||
if os.access( ".galaxy_tag", os.F_OK ):
|
||||
tagfile = open( ".galaxy_tag", "r" )
|
||||
tag = tagfile.readline().strip()
|
||||
else:
|
||||
tag = None
|
||||
|
||||
SGE_VERSION = ( tag.split( "_" ) )[1]
|
||||
|
||||
platform = pkg_resources.get_platform()
|
||||
if platform.startswith( 'solaris' ):
|
||||
if platform.endswith( 'i86pc' ):
|
||||
arch = 'sol-x86'
|
||||
elif platform.endswith( 'sun4u' ):
|
||||
arch = 'sol-sparc64'
|
||||
elif platform == 'linux-i686':
|
||||
arch = 'lx24-x86'
|
||||
elif platform == 'linux-x86_64':
|
||||
arch = 'lx24-amd64'
|
||||
|
||||
SGE_BASE_URL = "http://gridengine.sunsource.net/download/SGE61/"
|
||||
SGE_COMMON_ARCHIVE = os.path.abspath( os.path.join( "..", "..", "..", "archives", "ge-%s-common.tar.gz" %SGE_VERSION ) )
|
||||
SGE_BINARY_ARCHIVE = os.path.abspath( os.path.join( "..", "..", "..", "archives", "ge-%s-bin-%s.tar.gz" %( SGE_VERSION, arch ) ) )
|
||||
|
||||
# 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 )
|
||||
|
||||
# build/unpack SGE
|
||||
unpack_sge()
|
||||
|
||||
# patch
|
||||
file = "setup.py"
|
||||
print "scramble(): Patching", file
|
||||
if not os.access( "%s.orig" %file, os.F_OK ):
|
||||
@@ -85,18 +36,15 @@ 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="gridengine"\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), "-Wl,-R%s" % os.path.join(SGE6_ROOT, "lib", SGE6_ARCH), "-ldrmaa" ]\n'
|
||||
print >>o, line,
|
||||
i.close()
|
||||
o.close()
|
||||
|
||||
# tag
|
||||
# go
|
||||
me = sys.argv[0]
|
||||
sys.argv = [ me ]
|
||||
if tag is not None:
|
||||
sys.argv.append( "egg_info" )
|
||||
sys.argv.append( "--tag-build=%s" %tag )
|
||||
sys.argv.append( "bdist_egg" )
|
||||
|
||||
# go
|
||||
execfile( "setup.py", globals(), locals() )
|
||||
|
||||
Reference in New Issue
Block a user